http://stackoverflow.com/comment/34610498
comment on: http://stackoverflow.com/q/22712745
has text: Enjoy!!! http://ex-parrot.com/pdw/Mail-RFC822-Address.html
score: 3
type: QuestionComment
type: Comment

http://stackoverflow.com/q/22797246
has comment: http://stackoverflow.com/comment/34766457
score: 1
tagged with: java
tagged with: mysql
type: Question
downvote count: 0
has title: mySQL table exists in command line, JDBC says the table doesn't exist
favorite count: 0
tagged with: linux
tagged with: sql
has body: Let me start off saying this is my first time using JDBC and mySQL. I'm trying to use a .jar file (located on the server) to access my database. I can access and use the database fine through command line, meaning I can query, insert, etc. The DB I'm using is named "mydb", and when I "show tables;" while having mydb selected I get this output +----------------+ | Tables_in_mydb | +----------------+ | Orders | | U | Note Some of these tables were made during my testing process | Users | but both U and Users are near identical. | UsersTwo | +----------------+ But when I run "SELECT * FROM U;", I get the info from that table properly. However when I run my jar file (java -jar UserVerify.jar a a) I get the error Table 'mydb.U' doesn't exist. I am using InnoDB but I have not changed any of the directories, which I've read can cause problems. Currently this is running on a Linux VPS. The .jar file connects to the mySQL server using the root account so I don't think it is a permission problem (but I wouldn't be surprised though) EDIT: I found the problem it was within my stored procedure.
answer count: 0
type: UnansweredQuestion
upvote count: 1
has comment: http://stackoverflow.com/comment/34765376

http://stackoverflow.com/q/22771347
answer count: 2
has title: Making link go to servlet to redirect to another page
has answer: http://stackoverflow.com/a/34120808
has answer: http://stackoverflow.com/a/22772704
accepted answer: http://stackoverflow.com/a/22772704
type: AnsweredQuestion
possible better answer: http://stackoverflow.com/a/34120808
tagged with: java
type: Question
tagged with: jakarta-ee
tagged with: jsp
tagged with: servlets
has body: SO first off let me begin by saying that my servlet loads the option lists in a form i have just fine. The problem is when i start from the index.jsp like i want, the lists dont load. So basically, i want to click a link on the index.jsp to take me to the servlet to then redirect me to the correct page based on the link clicked. Maybe I have been looking at this too long and just need fresh eyes but I cant get why it wont work. I have included my Index.jsp and servlet Index.jsp <%@ page language="java" contentType="text/html; charset=ISO-8859-1" pageEncoding="ISO-8859-1"%> <%@ page import="java.util.ArrayList" %> Insert title here Add Customer Add Pet Servlet package edu.witc.Assignment03.controller; import java.io.IOException; import java.util.ArrayList; import java.util.Collection; import java.util.List; import javax.servlet.*; import javax.servlet.annotation.WebServlet; import javax.servlet.http.HttpServlet; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; //import javax.servlet.annotation.WebServlet; //import javax.servlet.http.HttpServlet; //import javax.servlet.http.HttpServletRequest; //import javax.servlet.http.HttpServletResponse; import javax.servlet.http.HttpSession; import edu.witc.Assignment03.model.Customer; import edu.witc.Assignment03.model.Phone; import edu.witc.Assignment03.model.States; @WebServlet(description = "servlet to get act as controller between form and models", urlPatterns = { "/customerServlet","/addCustomer","/addPet" }) public class CustomerServlet extends HttpServlet { private static final long serialVersionUID = 1L; public CustomerServlet() { super(); } private void processRequest(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { // TODO Auto-generated method stub HttpSession session = request.getSession(); Phone phone = new Phone(); States state = new States(); Collection<Phone> phones = phone.getPhoneCollection(); Collection<States> states =…
score: 0

http://stackoverflow.com/a/22687338
has body: You are passing Context as this in l.execute(this) and in class load you've passed Activity instance. You can do it in this way and it works like a charm for me public class SplashScreen extends Activity{ private static int SLPASH_TIME_OUT = 3000; @Override protected void onCreate(Bundle savedInstanceState) { // TODO Auto-generated method stub super.onCreate(savedInstanceState); setContentView(R.layout.activity_splash); new Handler().postDelayed(new Runnable() { @Override public void run() { // TODO Auto-generated method stub Intent i = new Intent(SplashScreen.this, MainActivity.class); startActivity(i); finish(); } }, SLPASH_TIME_OUT); } }
downvote count: 0
type: Answer
upvote count: 1
answers question: http://stackoverflow.com/q/22687209
score: 1

http://stackoverflow.com/comment/34547996
type: QuestionComment
type: Comment
has text: My professor doesn't lecture in class so we don't learn anything from him and the class is a "flipped classroom" so we work on stuff in class but all of our assignments labs and quizzes are online. Videos from another professor are posted there for learning the material but the reason I asked this is because it wasn't in any of the videos we have access to so far.
comment on: http://stackoverflow.com/q/22675542
score: 0

http://stackoverflow.com/comment/34633668
type: Comment
has text: @MikeB that's usually what I do, the thing with bitwise is that I don't know what to try. I could do `8 & 10` or any other expression but I wouldn't understand without the basics.
score: 0
type: QuestionComment
comment on: http://stackoverflow.com/q/22725047

http://stackoverflow.com/comment/34704761
comment on: http://stackoverflow.com/a/22764963
type: Comment
score: 2
has text: I'd be very surprised if theres any solution more efficient than this.
type: AnswerComment

http://stackoverflow.com/comment/34777611
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/22805635
type: Comment
has text: Thanks, I don't know what you are talking about but I'm going to check this.

http://stackoverflow.com/comment/34566800
comment on: http://stackoverflow.com/q/22688692
type: Comment
type: QuestionComment
has text: @BoristheSpider like i said, i know it is deprecated, just wondering, if it would interrupt `server.accept()`
score: 0

http://stackoverflow.com/q/22722561
tagged with: oracle-database
upvote count: 1
has body: I have also added another TMP2 and was not able to run the query... Could you please help me on this query? I am using Oracle 11g. WITH TMP1(REQUEST_NO) AS (SELECT REQUEST_NO FROM QUOTE) SELECT TMP1.REQUEST_NO FROM TMP1; WITH TMP1(REQUEST_NO) AS (SELECT REQUEST_NO FROM QUOTE), TMP2(AGENT) AS (SELECT AGENT FROM AGENT_TAB) SELECT TMP2.AGENT FROM TMP2; The exception I got is : org.h2.jdbc.JdbcSQLException: Syntax error in SQL statement "WITH TMP1(REQUEST_NO) AS (SELECT REQUEST_NO FROM QUOTE), [*]TMP2(AGENT) AS (SELECT AGENT FROM AGENT_TAB) SELECT TMP2.AGENT FROM TMP2 "; expected "(, SELECT, FROM"; SQL statement: The query is fine in sql developer but not working in the Junit tests. jdbc:h2:mem:request_no;MODE=Oracle We are using the h2 version 1.3.171 with windows 7 (64 bit) and jdk 1.7.0_25.
tagged with: java
tagged with: h2
downvote count: 3
tagged with: oracle11g
has title: Syntax error in SQL statement “WITH” keyword throwing exception
type: Question
score: -2
has answer: http://stackoverflow.com/a/22726366
tagged with: sql
answer count: 1
favorite count: 0
type: UnansweredQuestion

jhipster
tag name: jhipster
type: Tag
tags question: http://stackoverflow.com/q/22680663

http://stackoverflow.com/a/22795881
has body: If you want to cast Object[] to Double[] knowing that each your Object in your array is actually a Double, use Arrays.copyOf method. Otherwise it's impossible to do a "direct" cast, you must check your items type and figure out how to extract a double value for that. Maybe more optimal will be using Arrays.asList method and cast it to List&lt;Double&gt; directly. (because Arrays.asList doesn't copy the array) Example: static void test(Object[] a) { Double[] dummy = Arrays.copyOf(a, a.length, Double[].class); System.out.println(dummy[0]); // prints 42.0 } public static void main (String[] args) { Object[] a = new Object[1]; a[0] = new Double(42.0); test(a); } Example with generic List casting: static void test(Object[] a) { List&lt;Double&gt; dummy = (List&lt;Double&gt;)((List&lt;?&gt;)(Arrays.asList(a))); System.out.println(dummy.get(0)); }
accepted answer of: http://stackoverflow.com/q/22783024
answers question: http://stackoverflow.com/q/22783024
type: Answer
downvote count: 0
score: 1
upvote count: 1
type: AcceptedAnswer

http://stackoverflow.com/comment/40015317
has text: This looks good, but I'm unfortunately no longer in a position to verify if it works. I'll give it a few days to see if someone verify, but after that I'll assume this is correct and mark it as such.
score: 0
type: Comment
comment on: http://stackoverflow.com/a/25591797
type: AnswerComment

http://stackoverflow.com/comment/34634534
comment on: http://stackoverflow.com/a/22702535
has text: No problem! :) If you're going to be doing changing orthos a lot, you might create a helper function for it - I don't know if you're going to use shaders but when I do things like multipass rendering by binding a shader and repeatedly flip-flopping through FBOs if I'm going to do projection matrix changes.
type: AnswerComment
score: 0
type: Comment

http://stackoverflow.com/q/22729099
tagged with: parsing
has body: I'm currently developing an android application that required to parse an online JSON and display it into custom listview. My problem is when I run the application it has an error says that org.json.JSONException: End of input at character 0 Here's what I do: *layouts/row_listitem.xml* &lt;?xml version="1.0" encoding="utf-8"?&gt; &lt;RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="fill_parent" android:layout_height="80dp" android:orientation="vertical" android:padding="5dp" &gt; &lt;ImageView android:id="@+id/iv_icon_social" android:layout_width="60dp" android:layout_height="60dp" android:layout_centerVertical="true" android:background="@drawable/image1" android:src="@drawable/image1" android:visibility="gone" /&gt; &lt;LinearLayout android:id="@+id/thumbnail" android:layout_width="fill_parent" android:layout_height="85dp" android:layout_alignParentRight="true" android:layout_marginTop="0dp" android:layout_toRightOf="@+id/iv_icon_social" android:gravity="center_vertical" android:orientation="vertical" android:padding="5dip" android:visibility="visible" &gt; &lt;TextView android:id="@+id/txt_ttlsm_row" android:layout_width="fill_parent" android:layout_height="wrap_content" android:paddingLeft="10dp" android:text="Sample text" android:textSize="18dp" android:textStyle="bold" /&gt; &lt;TextView android:id="@+id/txt_ttlcontact_row2" android:layout_width="fill_parent" android:layout_height="wrap_content" android:layout_marginBottom="0dp" android:layout_marginTop="3dp" android:paddingLeft="10dp" android:maxEms="20" android:maxLines="2" android:singleLine="false" android:ellipsize="end" android:text="Sample text2" android:textColor="#808080" android:textSize="15dp" android:textStyle="normal" android:visibility="visible" /&gt; &lt;/LinearLayout&gt; &lt;/RelativeLayout&gt; *layouts/activity_main.xml* &lt;RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools" andr…
has comment: http://stackoverflow.com/comment/34640359
has comment: http://stackoverflow.com/comment/34640217
type: UnansweredQuestion
tagged with: java
tagged with: http://stackoverflow.com/tag/json
has comment: http://stackoverflow.com/comment/34640223
has comment: http://stackoverflow.com/comment/34640198
tagged with: listview
type: Question
has answer: http://stackoverflow.com/a/22729289
answer count: 1
has comment: http://stackoverflow.com/comment/34640377
score: 0
tagged with: android
has title: Parsing JSON and display it into custom listview android

http://stackoverflow.com/comment/34677479
type: Comment
type: QuestionComment
has text: Because you would be tying up threads. Websockets are designed to do short running work with gaps in between. This way the limited number of cpus can deal with a large number of tasks. Usually webservers deal with request-response cycles. Websockets open the possibility of duplex communications which in turn open the possibility of abusing the webserver.
comment on: http://stackoverflow.com/q/22749620
score: 0

http://stackoverflow.com/q/22693176
score: -3
tagged with: enumeration
has comment: http://stackoverflow.com/comment/34575038
has title: Method that returns EnumMap from an Enum passed to it
downvote count: 4
answer count: 1
has comment: http://stackoverflow.com/comment/34578725
favorite count: 0
accepted answer: http://stackoverflow.com/a/22693350
upvote count: 1
has body: Is this possible? I don't think it is but I just want to make sure. This is what I was trying. private Map enumToMap(Enum&lt;?&gt; e){ EnumMap map = new EnumMap&lt;e, String&gt;(e.getClass()); // error can't resolve constructor for EnumMap for (History h : History.values()) { map.put(h, h.answer()); } return map; }
type: AnsweredQuestion
tagged with: enums
tagged with: java
has comment: http://stackoverflow.com/comment/34575112
has comment: http://stackoverflow.com/comment/34575080
tagged with: methods
type: Question
has comment: http://stackoverflow.com/comment/34575116
has answer: http://stackoverflow.com/a/22693350

http://stackoverflow.com/q/22695688
possible better answer: http://stackoverflow.com/a/22695840
score: 0
has answer: http://stackoverflow.com/a/22695859
has title: Java Android - Trouble with New activity
tagged with: android
tagged with: android-activity
has comment: http://stackoverflow.com/comment/34579671
has body: The problem is that when I click on the ListView the application just closes. I use BaseAdapter. I need to open a new Acitivty to show detailed information, and that this problem prevents me. If i remove this code, it is not closed. Please help fix this problem, or can I have something wrong doing. Intent in = new Intent(getApplicationContext(), OnClickActivity.class); in.putExtra(TAG_RATING, rating2); in.putExtra(TAG_USER, name2); in.putExtra(TAG_DESC, desc2); in.putExtra(TAG_DATE, date2); in.putExtra(TAG_ID, postID); startActivity(in); Full code: public class AsyncTaskParseJson extends AsyncTask&lt;String, String, String&gt; { final String TAG = "AsyncTaskParseJson.java"; JSONArray dataJsonArr = null; @Override protected void onPreExecute() {} @Override protected String doInBackground(String... arg0) { try { JsonParser jParser = new JsonParser(); JSONObject json = jParser.getJSONFromUrl(URL); dataJsonArr = json.getJSONArray("data"); for (int i = 0; i &lt; dataJsonArr.length(); i++) { JSONObject c = dataJsonArr.getJSONObject(i); String nickname = c.getString("nickname"); String description = c.getString("description"); products.add(new ItemInfo(nickname, description)); } } catch (JSONException e) { e.printStackTrace(); } return null; } @Override protected void onPostExecute(String strFromDoInBg) { SetAdapter(); } } public void SetAdapter() { boxAdapter = new BoxAdapter(this, products); ListView lvMain = (ListView) findViewById(R.id.list); lvMain.setOnItemClickListener(new OnItemClickListener() { @Override public void onItemClick(AdapterView&lt;?&gt; parent, View view, int position, long id) { ListView lvMain = (ListView) findViewById(R.id.list); int pos = lvMain.getPositionForView(view); test(pos); } }); lvMain.setAdapter(boxAdapter); } public void test(int position) { ItemInfo p = boxAdapter.getItem(position); String name2 = p.username; String desc2 = p.description; Intent in = new Intent(getApplicationContext(), OnClickActivity.class); in.putExtra(TAG_USER, name2…
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/22695859
has comment: http://stackoverflow.com/comment/34579638
has answer: http://stackoverflow.com/a/22695840
tagged with: java
tagged with: http://stackoverflow.com/tag/json
type: Question
answer count: 2

http://stackoverflow.com/a/22757417
has comment: http://stackoverflow.com/comment/34701981
has comment: http://stackoverflow.com/comment/34691174
type: Answer
has body: Java compiler options can be specified in the Maven Compiler Plugin. Example: excluding debug information, enabling optimization: org.apache.maven.plugins maven-compiler-plugin 2.4 false none true A complete list of configuration options can be found here.
score: 1
answers question: http://stackoverflow.com/q/22757261
upvote count: 1
has comment: http://stackoverflow.com/comment/34691085
type: AcceptedAnswer
downvote count: 0
accepted answer of: http://stackoverflow.com/q/22757261

http://stackoverflow.com/comment/34746078
has text: Given that they aren't in the default package, they wouldn't compile if they didn't have a package statement.
type: Comment
score: 1
type: AnswerComment
comment on: http://stackoverflow.com/a/22788271

http://stackoverflow.com/comment/34695244
comment on: http://stackoverflow.com/q/22759822
has text: Just in case: [Java RMI](http://docs.oracle.com/javase/tutorial/rmi/overview.html), the canonical way of remote method invocation.
type: Comment
type: QuestionComment
score: 2

http://stackoverflow.com/q/22705924
score: 0
answer count: 1
has answer: http://stackoverflow.com/a/22705966
type: UnansweredQuestion
tagged with: maven
has title: Including a dependency from MavenRepository in my POM, do I need to put its dependencies in my POM?
tagged with: java
has body: I'm adding jersey to my project: http://mvnrepository.com/artifact/com.sun.jersey/jersey-server/1.18.1 do I need to add dependencies to my POM for items found in: "This artifact depends on ..."?
type: Question

http://stackoverflow.com/a/22666053
accepted answer of: http://stackoverflow.com/q/22665984
type: Answer
has body: Your negative number -5.485747E-5 finish by E-5 meaning that it is -0.0000548574 So the absolute value is 0.0000548574. So Math.abs(-0.0000548574) is 0.0000548574 (int)0.0000548574 is 0 result is 0 Are your sure your code is responding 0 no matter the value of random? Check the number you are trying to convert. You should unit test your code with your values.
answers question: http://stackoverflow.com/q/22665984
upvote count: 3
score: 3
type: AcceptedAnswer
downvote count: 0

http://stackoverflow.com/a/22707978
score: 2
answers question: http://stackoverflow.com/q/22707631
has comment: http://stackoverflow.com/comment/34602777
upvote count: 2
downvote count: 0
has comment: http://stackoverflow.com/comment/34603625
has body: I do not understand why you do convert the string, composed using the StringBuilder, into a byte array, but nevertheless, try this code: String text = "hallo!\n" + "How do\n" + "you do?\n"; System.out.println("Before conversion:"); System.out.print(text); ByteArrayInputStream is = new ByteArrayInputStream(text.getBytes(Charset.forName("UTF-8"))); StringBuilder builder = new StringBuilder(); try (BufferedReader in = new BufferedReader(new InputStreamReader(is))) { String line; while ((line = in.readLine()) != null) builder.append(line + lineSeparator()); } byte[] bytes = builder.toString().getBytes(Charset.forName("UTF-8")); System.out.println("After conversion:"); System.out.print(new String(bytes, "UTF-8")); OUTPUT: Before conversion: hallo! How do you do? After conversion: hallo! How do you do?
has comment: http://stackoverflow.com/comment/34603386
type: Answer

http://stackoverflow.com/comment/34537201
type: AnswerComment
type: Comment
has text: the isEmpty() function is fine, not efficient but still works... the problem is in the peek() function
comment on: http://stackoverflow.com/a/22671716
score: 0

http://stackoverflow.com/a/22732640
has body: You forgot to put a break in your switch statements. switch (v.getId()) { case R.id.button1: Intent i1 = new Intent(getActivity(), GameActivity.class); i1.putExtra("s", 10); startActivity(i1); break; case R.id.button2: Intent i2 = new Intent(getActivity(), GameActivity.class); i2.putExtra("s", 30); startActivity(i2); break; case R.id.button3: Intent i3 = new Intent(getActivity(), GameActivity.class); i3.putExtra("s", 50); startActivity(i3); break; }
type: AcceptedAnswer
downvote count: 0
answers question: http://stackoverflow.com/q/22732602
accepted answer of: http://stackoverflow.com/q/22732602
type: Answer
has comment: http://stackoverflow.com/comment/34646610
score: 2
upvote count: 2

http://stackoverflow.com/q/22739655
tagged with: java
has body: I just want to understand more about current popular garbage collection, malloc / free and counter. From my understanding, GC is the most popular because it relieves the burden of managing memory manually from the developers and also it is more bullet proof. malloc / free is easy to make mistake and cause memory leaks. From http://ocaml.org/learn/tutorials/garbage_collection.html: Why would garbage collection be faster than explicit memory allocation as in C? It's often assumed that calling free costs nothing. In fact free is an expensive operation which involves navigating over the complex data structures used by the memory allocator. If your program calls free intermittently, then all of that code and data needs to be loaded into the cache, displacing your program code and data, each time you free a single memory allocation. A collection strategy which frees multiple memory areas in one go (such as either a pool allocator or a GC) pays this penalty only once for multiple allocations (thus the cost per allocation is much reduced). Is it true that GC faster than malloc / free? Also, what if the counter style memory management (objective-c is using it) joins the party? I hope someone can summary the comparisons with deeper insights.
upvote count: 1
has answer: http://stackoverflow.com/a/22739767
type: Question
possible better answer: http://stackoverflow.com/a/22748477
answer count: 2
has title: Comparisons between GC and two other memory management methods
has answer: http://stackoverflow.com/a/22748477
accepted answer: http://stackoverflow.com/a/22739767
tagged with: http://stackoverflow.com/tag/c
downvote count: 0
favorite count: 0
has comment: http://stackoverflow.com/comment/34673106
tagged with: garbage-collection
tagged with: c++
type: AnsweredQuestion
tagged with: memory-management
score: 1

http://stackoverflow.com/comment/34652624
type: AnswerComment
has text: Thanks for your help i got the solution. I have done silly mistake in select query.
type: Comment
comment on: http://stackoverflow.com/a/22731433
score: 0

http://stackoverflow.com/a/22727130
has body: Looks like when you defined your date format you used DD which is day of year rather than dd for day of month. (March 29th is the 88th day of the year.)
answers question: http://stackoverflow.com/q/22725547
upvote count: 2
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/34636950
type: Answer
score: 2
accepted answer of: http://stackoverflow.com/q/22725547
downvote count: 0

java
tags question: http://stackoverflow.com/q/22671145
tags question: http://stackoverflow.com/q/22672578
tags question: http://stackoverflow.com/q/22685423
tags question: http://stackoverflow.com/q/22694804
tags question: http://stackoverflow.com/q/22708617
tags question: http://stackoverflow.com/q/22799393
tags question: http://stackoverflow.com/q/22767115
tags question: http://stackoverflow.com/q/22685245
tags question: http://stackoverflow.com/q/22793452
tags question: http://stackoverflow.com/q/22790663
tags question: http://stackoverflow.com/q/22667099
tags question: http://stackoverflow.com/q/22664088
tags question: http://stackoverflow.com/q/22681331
tags question: http://stackoverflow.com/q/22663952
tags question: http://stackoverflow.com/q/22703544
tags question: http://stackoverflow.com/q/22750958
tags question: http://stackoverflow.com/q/22786493
tags question: http://stackoverflow.com/q/22721279
tags question: http://stackoverflow.com/q/22681298
tags question: http://stackoverflow.com/q/22678891
tags question: http://stackoverflow.com/q/22690699
tags question: http://stackoverflow.com/q/22778360
tags question: http://stackoverflow.com/q/22731511
tags question: http://stackoverflow.com/q/22742282
tags question: http://stackoverflow.com/q/22784589
tags question: http://stackoverflow.com/q/22787482
tags question: http://stackoverflow.com/q/22783212
tags question: http://stackoverflow.com/q/22715917
tags question: http://stackoverflow.com/q/22790417
tags question: http://stackoverflow.com/q/22675068
tags question: http://stackoverflow.com/q/22738173
tags question: http://stackoverflow.com/q/22803142
tags question: http://stackoverflow.com/q/22699880
tags question: http://stackoverflow.com/q/22674805
tags question: http://stackoverflow.com/q/22792568
tags question: http://stackoverflow.com/q/22783294
tags question: http://stackoverflow.com/q/22667063
tags question: http://stackoverflow.com/q/22656752
tags question: http://stackoverflow.com/q/22760512
tags question: http://stackoverflow.com/q/22665984
tags question: http://stackoverflow.com/q/22698509
tags question: http://stackoverflow.com/q/22737593
tags question: http://stackoverflow.com/q/22754212
tags question: http://stackoverflow.com/q/22669660
tags question: http://stackoverflow.com/q/22658750
tags question: http://stackoverflow.com/q/22684800
tags question: http://stackoverflow.com/q/22748628
tags question: http://stackoverflow.com/q/22790826
tags question: http://stackoverflow.com/q/22724492
tags question: http://stackoverflow.com/q/22725032
tags question: http://stackoverflow.com/q/22709143
tags question: http://stackoverflow.com/q/22735605
tags question: http://stackoverflow.com/q/22740753
tags question: http://stackoverflow.com/q/22681969
tags question: http://stackoverflow.com/q/22658111
tags question: http://stackoverflow.com/q/22704800
tags question: http://stackoverflow.com/q/22724694
tags question: http://stackoverflow.com/q/22759408
tags question: http://stackoverflow.com/q/22702238
tags question: http://stackoverflow.com/q/22793619
tags question: http://stackoverflow.com/q/22730331
tags question: http://stackoverflow.com/q/22674497
tags question: http://stackoverflow.com/q/22676620
tags question: http://stackoverflow.com/q/22704972
tags question: http://stackoverflow.com/q/22710363
tags question: http://stackoverflow.com/q/22779804
tags question: http://stackoverflow.com/q/22752351
tags question: http://stackoverflow.com/q/22670874
tags question: http://stackoverflow.com/q/22766644
tags question: http://stackoverflow.com/q/22651975
tags question: http://stackoverflow.com/q/22796350
tags question: http://stackoverflow.com/q/22808066
tags question: http://stackoverflow.com/q/22692622
tags question: http://stackoverflow.com/q/22797177
tags question: http://stackoverflow.com/q/22779912
tags question: http://stackoverflow.com/q/22775173
tags question: http://stackoverflow.com/q/22702967
tags question: http://stackoverflow.com/q/22728063
tags question: http://stackoverflow.com/q/22741772
tags question: http://stackoverflow.com/q/22761852

http://stackoverflow.com/a/28705635
type: AcceptedAnswer
type: Answer
accepted answer of: http://stackoverflow.com/q/22770261
has body: The problem turned out to be adding PersonService as a singleton in the rest application registration. @ApplicationPath("api") public class RestApplication extends Application{ private Set&lt;Object&gt; singletons = new HashSet&lt;Object&gt;(); private Set&lt;Class&lt;?&gt;&gt; empty = new HashSet&lt;Class&lt;?&gt;&gt;(); public RestApplication(){ //below line caused @Inject not to work. commented out //singletons.add(new PersonService()); } @Override public Set&lt;Class&lt;?&gt;&gt; getClasses() { return empty; } @Override public Set&lt;Object&gt; getSingletons() { return singletons; } }
answers question: http://stackoverflow.com/q/22770261
score: 0

jfreechart
type: Tag
tags question: http://stackoverflow.com/q/22781240
tags question: http://stackoverflow.com/q/22668540
tags question: http://stackoverflow.com/q/22658844
tags question: http://stackoverflow.com/q/22720226
tags question: http://stackoverflow.com/q/22691692
tag name: jfreechart
tags question: http://stackoverflow.com/q/22803268

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

http://stackoverflow.com/comment/34549242
score: 0
type: AnswerComment
has text: Please, read full authentication flow description: api key and access token is what you give when connect to facebook, and authentication token is what facebook give to user when he allow your app to access his facebook account.
type: Comment
comment on: http://stackoverflow.com/a/22677511

http://stackoverflow.com/q/22664146
has comment: http://stackoverflow.com/comment/34522979
linked to: http://stackoverflow.com/q/22584938
type: AnsweredQuestion
tagged with: java
has answer: http://stackoverflow.com/a/43394462
has title: How to remove the last comma when I print out the index of arraylist
has answer: http://stackoverflow.com/a/22664244
type: Question
answer count: 8
linked to: http://stackoverflow.com/q/18297551
has answer: http://stackoverflow.com/a/22722469
accepted answer: http://stackoverflow.com/a/22664216
tagged with: arraylist
has body: List&lt;String&gt; list1 = new ArrayList&lt;String&gt;(words.length); List&lt;String&gt; list2 = new ArrayList&lt;String&gt;(word.length); for(String x: list1){ for(String y: list2){ if(x.equalsIgnoreCase(y)){ System.out.print(list1.indexOf(x) +" "+ ","); } } } For this function, after run it, the output will be 2,5,7....9, My question is how to remove the last comma?
score: 0
has answer: http://stackoverflow.com/a/22664388
has answer: http://stackoverflow.com/a/22664216
possible better answer: http://stackoverflow.com/a/22664212
has answer: http://stackoverflow.com/a/22667497
duplicate of: http://stackoverflow.com/q/18297551
has answer: http://stackoverflow.com/a/22664212
has answer: http://stackoverflow.com/a/22664213

http://stackoverflow.com/comment/35184108
comment on: http://stackoverflow.com/q/22738497
score: 0
type: Comment
type: QuestionComment
has text: Sure. I'm already upgrading to 2 but stuck again. I'll update question in a few hours in the morning

http://stackoverflow.com/q/22778450
upvote count: 1
tagged with: swing
type: Question
linked to: http://stackoverflow.com/q/1263425
score: 1
tagged with: java
tagged with: hibernate
linked to: http://stackoverflow.com/q/3440532
has body: I am aware that there are plenty of information around explaining how to use Swing + Hibernate and Maven in a project, but I think that all this info is way out-dated. I just tried to follow this and i just ended up having lots of import problems, once apparently the new versions of Hibernate-core dont have some of the classes that it had at the time of this tutorial (I laugh a bit when I saw a code using Vector (-: ) Question is, is it possible to create a project using the latest versions of Hibernate with Swing? Does any one have information on how to do it that is not from 3 years ago? Issues I had : 1 - Couldnt get HQL Query to work on Netbeans... it complains about org.hibernate.hql.internal.classic.ClassicQueryTranslatorFactory Cant find it.. tried other options but no luck (I dont really care about this) 2 - When running code, it complains about Caused by: java.lang.ClassNotFoundException: org.hibernate.util.DTDEntityResolver Which is a package from early days of hibernate. Would appreciate all the help, even pointing me towards a good documentation... Cheers UPDATE : Stack Trace --- exec-maven-plugin:1.2.1:exec (default-cli) @ SwingProject --- SLF4J: Failed to load class "org.slf4j.impl.StaticLoggerBinder". SLF4J: Defaulting to no-operation (NOP) logger implementation SLF4J: See http://www.slf4j.org/codes.html#StaticLoggerBinder for further details. Apr 01, 2014 4:48:07 PM org.hibernate.Version logVersion INFO: HHH000412: Hibernate Core {4.3.4.Final} Apr 01, 2014 4:48:07 PM org.hibernate.cfg.Environment <clinit> INFO: HHH000206: hibernate.properties not found Apr 01, 2014 4:48:07 PM org.hibernate.cfg.Environment buildBytecodeProvider INFO: HHH000021: Bytecode provider name : javassist Initial SessionFactory creation failed.java.lang.NoClassDefFoundError: org/hibernate/util/DTDEntityResolver Exception in thread "AWT-EventQueue-0" java.lang.ExceptionInInitializerError at padaria.util.NewHibernateUtil.<clinit>(NewHibernateUtil.java:30) at br.com.vaast.main.Adm…
downvote count: 0
answer count: 1
has answer: http://stackoverflow.com/a/22880832
accepted answer: http://stackoverflow.com/a/22880832
favorite count: 0
linked to: http://stackoverflow.com/q/644814
has title: Java Swing + Hibernate + Maven
type: AnsweredQuestion
tagged with: netbeans
tagged with: maven

http://stackoverflow.com/a/22793867
has body: You have to add an actionlistener to the button like this: JRadioButton myRadioButton = new JRadioButton(""); myRadioButton.addActionListener(new ActionListener(){ public void actionPerformed(ActionEvent e) { // Do something here... } }); To do the same with a checkbox it's pretty much the same: JCheckBox b = new JCheckBox("JCheckBox"); b.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { //change Image here } }); To show an image, there are multiple things you could do. One would be: ImageIcon icon = new ImageIcon(imgURL); JLabel imageLabel = new JLabel(); imageLabel.setIcon(icon); You could hide the imageLabel onstart (I think imageLabel.setVisible(false); would do that) and then put imageLabel.setVisitble(true); in your actionListener
answers question: http://stackoverflow.com/q/22793619
score: 0
has comment: http://stackoverflow.com/comment/34756916
has comment: http://stackoverflow.com/comment/34758311
type: Answer

http://stackoverflow.com/comment/34527099
score: 0
type: Comment
has text: Does it take care of special chars? If yes, it sounds like a good solution. If I use Java 7, maybe there's some apache or some other lib that does the same?
comment on: http://stackoverflow.com/a/22666397
type: AnswerComment

http://stackoverflow.com/q/22683449
type: Question
score: 0
answer count: 3
tagged with: http://stackoverflow.com/tag/html
has answer: http://stackoverflow.com/a/22683515
has answer: http://stackoverflow.com/a/22684013
has answer: http://stackoverflow.com/a/22683558
type: UnansweredQuestion
has body: I have tried the image uploading code in java.Images are upload in - D:\bridge\Project\.metadata\.plugins\ org.eclipse.wst.server.core\tmp0\wtpwebapps\bridghc\Example\image-folder\2nd page.jpg this directory. This fully path is also inserted in database.When i fetch the path from database i get the same result but when i write &lt;img id="0" src="D:\bridge\Project\.metadata\.plugins\org.eclipse.wst.server.core\tmp0\wtpwebapps\bridghc\Example\image-folder\2nd page.jpg" name="txtrepimg0"&gt;. In the web page i am not able to fetch the image.I got failed to load url. Please help.
has title: image is not displayed after getting the path from the database
tagged with: java
tagged with: eclipse

http://stackoverflow.com/q/22752789
type: Question
has title: Pause threads based on their ID
has comment: http://stackoverflow.com/comment/34682810
has comment: http://stackoverflow.com/comment/34682723
score: 0
has comment: http://stackoverflow.com/comment/34682840
has body: I'm wanting to only accept output from threads 1 at a time. I have a Boolean arraylist which holds all values as false bar 1. This true position then relates to a thread by its ID number. This is the only thread which is 'allowed' to output, I want to put all others into sleep until their respective arraylist number calls them. Here is my code so far int threadPos = 0; while (true) { if(turn.get(threadPos)==true) //see if value in arraylist is true {//if so accept its input, then increment count userInput = in.readLine(); System.out.println(userInput); turn.set(threadPos, false); if(threadPos &lt; turn.size()) { threadPos++; turn.set(threadPos, true); } else { threadPos = 0; turn.set(0, true); } } else { //Put all other threads to sleep } } Thanks
answer count: 0
type: UnansweredQuestion
tagged with: multithreading
tagged with: java
has comment: http://stackoverflow.com/comment/34682865
tagged with: sleep

http://stackoverflow.com/a/22774656
has body: Use JMapViewer#setDisplayPositionByLatLon() to zoom to a particular point. Addendum: I don't have the method setDisplayPositionByLatLon(). Ah, the method was removed in r30244 in favor of setDisplayPosition(). Coordinate paris = new Coordinate(48.8567, 2.3508); map.setDisplayPosition(paris, 8); From the log: $ svn log -r30244 src/org/openstreetmap/gui/jmapviewer/JMapViewer.java ------------------------------------------------------------------------ r30244 | glebius | 2014-01-31 07:51:51 -0500 (Fri, 31 Jan 2014) | 3 lines To match getPosition() and simplify code rename setDisplayPositionByLatLon() into setDisplayPosition(Coordinate to, ...).
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/34749585
type: Answer
answers question: http://stackoverflow.com/q/22771969
score: 3
upvote count: 3
has comment: http://stackoverflow.com/comment/76910435
has comment: http://stackoverflow.com/comment/34762011
accepted answer of: http://stackoverflow.com/q/22771969

http://stackoverflow.com/a/22720079
accepted answer of: http://stackoverflow.com/q/22719999
type: AcceptedAnswer
downvote count: 0
type: Answer
has comment: http://stackoverflow.com/comment/34624220
upvote count: 2
answers question: http://stackoverflow.com/q/22719999
has body: It's because you're returning false at the end of the onTouchEvent. When you return false, you are saying that your View can not handle any more touch events so the events will no longer be sent to the View. If you want to receive MOVE and UP events, then you need to return true.
score: 2

http://stackoverflow.com/comment/34672443
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/22747035
has text: Your error is here: this.houses = new House[size][size]; you cannot directly assign an object of type House to an object of type Houses. They're both different.
score: 0

http://stackoverflow.com/q/22737415
has body: Whats happening is when I try to add a new class to my student, I have to check to make sure that the class time I am trying to add doesn't conflict with my students other class times, but for some reason when the code gets into the loop to check the other course times stored in an array list, there is an exeption called when their shouldn't be. For example, I could put in 5:00p-10:00p for one course, then 1:00p-2:00p for the second course and it will throw the exception like there is a conflict there when there isn't. please check the comment to see where the problem occurs. any ideas? package myschool; import java.util.ArrayList; import java.util.Scanner; public class MySchool { private static Exception e; public static void main(String[] args) { ArrayList&lt;Student&gt; listStudent = new ArrayList&lt;&gt;(); ArrayList&lt;Integer&gt; listCourseStart = new ArrayList&lt;&gt;(); ArrayList&lt;Integer&gt; listCourseEnd = new ArrayList&lt;&gt;(); boolean continueLoop = true; boolean addFirstCourse = true; boolean addACourse = false; Scanner userInput = new Scanner(System.in); int option; do{ try { System.out.println(" What would you like to do?"); System.out.println(" 1) Add a student"); System.out.println(" 2) View students"); System.out.println(" 3) Remove a student"); System.out.println(" 4) Exit"); System.out.print("--&gt; "); option = userInput.nextInt(); switch( option ){ case 1: Scanner inputs = new Scanner(System.in); String fName, lName; int sID; double sGPA; System.out.print(" First Name:"); fName = inputs.nextLine(); System.out.print(" Last Name:"); lName = inputs.nextLine(); System.out.print(" ID Number:"); sID = inputs.nextInt(); System.out.print(" GPA:"); sGPA = inputs.nextDouble(); Student newStudent = new Student(fName, lName, sID, sGPA); listStudent.add(newStudent); inputs.nextLine(); while (true) { try { System.out.println("Would you like to add a course? Y/N"); String shouldAddCourse = inputs.nextLine(); if( "N".equals(shouldAddCourse.toUpperCase())) …
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/34654893
has comment: http://stackoverflow.com/comment/34655032
has title: Why is my program throwing an exception?
has answer: http://stackoverflow.com/a/22737664
has comment: http://stackoverflow.com/comment/34654924
has comment: http://stackoverflow.com/comment/34654805
has comment: http://stackoverflow.com/comment/34654928
tagged with: java
has answer: http://stackoverflow.com/a/22737538
has comment: http://stackoverflow.com/comment/34654824
type: Question
has comment: http://stackoverflow.com/comment/34654869
has comment: http://stackoverflow.com/comment/34654784
score: -1
tagged with: arraylist
answer count: 3
tagged with: exception
has comment: http://stackoverflow.com/comment/34655220
has comment: http://stackoverflow.com/comment/34654822
downvote count: 1
has comment: http://stackoverflow.com/comment/34654915
has answer: http://stackoverflow.com/a/22737695
favorite count: 0
upvote count: 0
has comment: http://stackoverflow.com/comment/34654894

http://stackoverflow.com/comment/76878281
type: AnswerComment
comment on: http://stackoverflow.com/a/22764367
type: Comment
has text: I can't understand why referencing args[0] directly had a speed increase. Why would that be?
score: 3

http://stackoverflow.com/q/22669660
has comment: http://stackoverflow.com/comment/34533322
has title: Delete element from an Array
tagged with: java
type: Question
has comment: http://stackoverflow.com/comment/34533531
has answer: http://stackoverflow.com/a/22670476
tagged with: arrays
has comment: http://stackoverflow.com/comment/34533376
has body: I need a method to delete a determinate element from a handmade list. I have a class called AudioFile. Each element of the list is an object from this class. Then, I have the class FileTable, with this atributes: private AudioFile[] table; private int size; I defined this method, but It doesn't work when I call it: public void deleteFile(AudioFile file){ AudioFile[] table2 = new AudioFile[100]; int j = 0; for (int i = 0; i &lt; size; i++){ if (table[i] != file){ table2[j] = table[i]; j++; } else { i++; } } for (int k = 0; k &lt; size); k++){ table2[k] = table[k]; } table[size-1] = null; } I think the code it's easy to understand, but if you don't understand something or you need some more information about the class AudioFile, you can say it and I'll try to help too. Thank you!
score: 0
has comment: http://stackoverflow.com/comment/34533272
has comment: http://stackoverflow.com/comment/34533301
answer count: 1
has comment: http://stackoverflow.com/comment/34533474
has comment: http://stackoverflow.com/comment/34533243
has comment: http://stackoverflow.com/comment/34533281
type: UnansweredQuestion

http://stackoverflow.com/comment/34672378
has text: I understand what your are saying however I know exactly where my problem is, it is highlighted in the code I posted. it is the conditional statement that is checking if Jbutton has been pressed already. I am just asking for someone to see my conditional statement and comment on why it is not working properly
comment on: http://stackoverflow.com/q/22747208
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/q/22778711
accepted answer: http://stackoverflow.com/a/22778741
upvote count: 0
linked to: http://stackoverflow.com/q/663923
tagged with: .net
downvote count: 5
has comment: http://stackoverflow.com/comment/34730421
duplicate of: http://stackoverflow.com/q/663923
type: AnsweredQuestion
score: -5
has title: Can i develop a .net project without visual studio ,if yes is .net framework is cost or freeware
favorite count: 0
type: Question
has answer: http://stackoverflow.com/a/22778741
answer count: 1
tagged with: java
has comment: http://stackoverflow.com/comment/34729291
has body: Everybody saying that java is freeware and .net is not freeware but i download and install .net framework to my lap and i can write asp.net code in freeware ide .can i able to develop it without visual studio and i want ti know which is not freeware .net or visualstudio

http://stackoverflow.com/a/22758029
type: AcceptedAnswer
downvote count: 1
type: Answer
has comment: http://stackoverflow.com/comment/34697135
has comment: http://stackoverflow.com/comment/34692254
has body: Try this: + (NSString *) GetMonth: (NSString *) month{ NSString* january = @"01;06:40;08:37;12:15;13:35;15:51;17:41&amp;02;06:40;08:37;12:15;13:36;15:52;17:42&amp;03;06:40;08:36;12:16;13:37;15:53;17:43&amp;04;06:40;08:36;12:16;13:38;15:54;17:44&amp;"; NSString* february = @"01;06:13;08:01;12:24;14:19;16:46;18:27&amp;02;06:12;07:59;12:25;14:21;16:48;18:29&amp;03;06:10;07:57;12:25;14:22;16:50;18:31&amp;04;06:09;07:55;12:25;14:24;16:52;18:33&amp;"; if ([[month lowercaseString] isEqualToString:@"january"]) return january; else if ([month lowercaseString] isEqualToString:@"february"]) return february; else return Nil; }
answers question: http://stackoverflow.com/q/22757839
has comment: http://stackoverflow.com/comment/34692324
has comment: http://stackoverflow.com/comment/34697261
accepted answer of: http://stackoverflow.com/q/22757839
score: 0
upvote count: 1

http://stackoverflow.com/a/22675771
type: Answer
answers question: http://stackoverflow.com/q/22675559
has body: This fulfills all the stated requirements: public class Fibonacci { public static void main(String[] args) { final int[] fibNumbers = new int[20]; fibNumbers[0] = fibNumbers[1] = 1; fillFibonacciArray(fibNumbers); for (int i = 0; i &lt; fibNumbers.length; i++) { System.out.print(fibNumbers[i] + " "); } } private static void fillFibonacciArray(int[] fibNumbers) { final int length = fibNumbers.length; if (length &lt; 2) { throw new IllegalArgumentException("Input array must have a least 2 elements."); } for (int i = 2; i &lt; length; i++) { fibNumbers[i] = fibNumbers[i - 2] + fibNumbers[i - 1]; } } } The output of main() is: 1 1 2 3 5 8 13 21 34 55 89 144 233 377 610 987 1597 2584 4181 6765
upvote count: 1
score: 1
downvote count: 0

http://stackoverflow.com/a/22699988
has comment: http://stackoverflow.com/comment/34772982
type: AcceptedAnswer
downvote count: 0
has body: So from my understanding this is a simple PHP page not a SOAP service. Remember XML is just the protocol used in a SOAP service however a SOAP service consists out of a WSDL that is published describing operations and how to call those operations. A simple PHP page even if it returns XML data is NOT a SOAP service and thus does NOT have a WSDL. You wont be able to use WSDL2JAVA for that. This PHP page seems more like a REST type service that returns XML instead of JSON. To be honest it really sounds like a REST service. Try using the latest SOAPUI to connect to the page and see if you can use the REST project type with this page. If it is a REST service it might have a WADL file. YOu can use the WADL2JAVA cxf utility to generate classes to you. HOwever this is a BIG might as most REST services dont use WADL's yet. See this link on CXF
type: Answer
accepted answer of: http://stackoverflow.com/q/22680189
score: 1
answers question: http://stackoverflow.com/q/22680189
upvote count: 1

http://stackoverflow.com/a/22719187
answers question: http://stackoverflow.com/q/22718898
type: Answer
has body: Hi things will be simpler for you if you use an ArrayList instead of an array, Here is how your code will look like assuming that you have a EmployerClass implementing the getFirstName() method List&lt;EmployerClass&gt; employees = new ArrayList&lt;EmployerClass&gt;(); // Here is the new type of your employees pool .... // do whatever you want to put employees in the poll using employees.add(...) private void deleteEmployee(){ Scanner scan = new Scanner(System.in); System.out.println("Enter the first name of the employee you want to delete from the list") String name = scan.nextLine(); EmployerClass tmpEmployer = null; for(EmployerClass emp : employees) { if(emp.getFirstName().equals(name)) { break; } } if(tmpEmployer != null){ // remove the employee to the pool employees.remove(tmpEmployer); } else { System.out.println("That requested person is not employed at this firm."); } } good luck !
score: 0

http://stackoverflow.com/a/22960073
has comment: http://stackoverflow.com/comment/35065117
has comment: http://stackoverflow.com/comment/62933548
answers question: http://stackoverflow.com/q/22663681
upvote count: 30
accepted answer of: http://stackoverflow.com/q/22663681
type: AcceptedAnswer
has body: import javafx.animation.*; import javafx.application.*; import javafx.beans.property.*; import javafx.embed.swing.SwingFXUtils; import javafx.geometry.Insets; import javafx.scene.*; import javafx.scene.control.Label; import javafx.scene.effect.*; import javafx.scene.Cursor; import javafx.scene.Node; import javafx.scene.image.*; import javafx.scene.layout.StackPane; import javafx.scene.paint.Color; import javafx.stage.Stage; import javafx.stage.StageStyle; import javafx.util.Duration; public class FrostyTech extends Application { private static final double BLUR_AMOUNT = 10; private static final Effect frostEffect = new BoxBlur(BLUR_AMOUNT, BLUR_AMOUNT, 3); private static final ImageView background = new ImageView(); private static final StackPane layout = new StackPane(); @Override public void start(Stage stage) { layout.getChildren().setAll(background, createContent()); layout.setStyle("-fx-background-color: null"); Scene scene = new Scene( layout, 200, 300, Color.TRANSPARENT ); Platform.setImplicitExit(false); scene.setOnMouseClicked(event -&gt; { if (event.getClickCount() == 2) Platform.exit(); }); makeSmoke(stage); stage.initStyle(StageStyle.TRANSPARENT); stage.setScene(scene); stage.show(); background.setImage(copyBackground(stage)); background.setEffect(frostEffect); makeDraggable(stage, layout); } // copy a background node to be frozen over. private Image copyBackground(Stage stage) { final int X = (int) stage.getX(); final int Y = (int) stage.getY(); final int W = (int) stage.getWidth(); final int H = (int) stage.getHeight(); try { java.awt.Robot robot = new java.awt.Robot(); java.awt.image.BufferedImage image = robot.createScreenCapture(new java.awt.Rectangle(X, Y, W, H)); return SwingFXUtils.toFXImage(image, null); } catch (java.awt.AWTException e) { System.out.println("The robot of doom strikes!"); e.printStackTrace(); return null; } } // create some content to be displayed on top of the frozen glass panel. private Label createContent() { Label label = ne…
has comment: http://stackoverflow.com/comment/35129342
downvote count: 1
type: Answer
score: 29
has comment: http://stackoverflow.com/comment/39800221

http://stackoverflow.com/comment/34693259
type: Comment
type: QuestionComment
has text: @T.J.Crowder package private solution will be suitable for only one class or two class because while returing the instance from factory i need to check for instance type eg. Property,Loan.Please Correct me if I am wrong?
score: 0
comment on: http://stackoverflow.com/q/22758715

http://stackoverflow.com/comment/34690680
type: Comment
comment on: http://stackoverflow.com/a/22756631
score: 0
type: AnswerComment
has text: OK, happy? The construction of the BufferedReader in outside your loop. It is reading your inputstream. It is using a readLine to get one line at a time.

http://stackoverflow.com/comment/47902405
has text: I like this better than my solution, even though @skiwi's comment above still stands—the imperative version is still better.
type: AnswerComment
type: Comment
score: 2
comment on: http://stackoverflow.com/a/27896721

http://stackoverflow.com/a/22696712
type: Answer
has comment: http://stackoverflow.com/comment/34626503
has comment: http://stackoverflow.com/comment/34626818
has comment: http://stackoverflow.com/comment/34619592
has body: Well, I'm not going to code your homework for you, but here is a high level look at it. You will need each marble to update it's position at regular intervals, so some type of looping is required. This loop is commonly known as a game loop. Here is a discussion of various types of them, going from simple to complex. http://www.java-gaming.org/index.php?topic=24220.0 For your project, something simply may be sufficient, but I don't know the requirements of it. Each time a marble tries to move, it must check to make sure it isn't being blocked. If you have the move method synchronized, as you mentioned, then only one marble should be able to move at a time, so that should avoid concurrency issues. Except for using a Thread.sleep in your game loops, I don't see any reason for you to doing any waiting. Java has a synchronize keyword, which can be used to lock the shared object that you mentioned using for movement, to avoid the concurrency issues. So I don't believe wait and notify are necessary. Just my thoughts, I hope it is of some help.
answers question: http://stackoverflow.com/q/22696309
has comment: http://stackoverflow.com/comment/34618444
accepted answer of: http://stackoverflow.com/q/22696309
score: 0
has comment: http://stackoverflow.com/comment/34581611
type: AcceptedAnswer

http://stackoverflow.com/comment/34761184
comment on: http://stackoverflow.com/q/22796385
type: QuestionComment
has text: @user2825125: In that case `int posComma = line.indexOf(',', posSemi);` failed to find another comma, and returned `-1`. `
score: 0
type: Comment

http://stackoverflow.com/q/22756639
has title: Java 2D-Graphics : Animate Fractal tree
tagged with: tree
score: 0
tagged with: java
tagged with: swing
answer count: 1
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/22756729
tagged with: thread-sleep
type: Question
tagged with: animation
has body: I'm trying to draw a fractal tree. It will draw the tree, but i want to make an animation so the tree can grow from its "trunk"? Also is it possible to make that animation smooth? If i use Thread.sleep method, it draws the tree pretty weird. Someone who can help me? Many thanks Here's my code: import java.awt.BasicStroke; import java.awt.Canvas; import java.awt.Color; import java.awt.Graphics; import java.awt.Graphics2D; import java.awt.RenderingHints; import javax.swing.JFrame; public class FractalTree extends Canvas { private JFrame frame; //Breedte en hoogte voor GUI private final int WINDOW_WIDTH = 1280; private final int WINDOW_HEIGHT = 720; public FractalTree() { frame = new JFrame("Fractal Tree"); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); frame.setSize(WINDOW_WIDTH, WINDOW_HEIGHT); frame.setLocationRelativeTo(null); frame.setResizable(false); frame.add(this); frame.setVisible(true); } public static void main(String[] args) { FractalTree ft = new FractalTree(); ft.setVisible(true); ft.setBackground(Color.black); } class FractalPanel extends JPanel implements ActionListener { private int x; private int y; private int xNew; private int yNew; private double angle; private int depth; public FractalPanel() { setBackground(Color.black); Timer timer = new Timer(200, this); } public void paintComponent(Graphics g) { g.setColor(Color.cyan); drawFractalTree(g, WINDOW_WIDTH / 2, WINDOW_HEIGHT - 75, -90, 11); } public void drawFractalTree(Graphics g, int x, int y, double angle, int depth) { if (depth == 0) { } else { int xNew = x + (int) (Math.cos(Math.toRadians(angle)) * depth * 10.0); int yNew = y + (int) (Math.sin(Math.toRadians(angle)) * depth * 10.0); Graphics2D g2d = (Graphics2D) g; g2d.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON); g2d.setStroke(new BasicStroke(0.5f * depth)); g2d.drawLine(x, y, xNew, yNew); drawFractalTree(g, xNew, yNew, angle + 30, depth - 1); drawFractalTree(g, xNew, yNew, angle - 30, depth - 1)…

http://stackoverflow.com/a/22670195
downvote count: 0
upvote count: 2
has body: Please see the Java Tutorials on Look and Feel. It will give you all the basic information you could want on Look and Feel. Available Look and Feels Programatically Setting the Look and Feel Specifying the Look and Feel: Command Line Specifying the Look and Feel: swing.properties How the UI Manager Chooses the Look and Feel Changing the Look and Feel After Startup An Example Themes
type: Answer
answers question: http://stackoverflow.com/q/22670035
score: 2

http://stackoverflow.com/a/22685713
accepted answer of: http://stackoverflow.com/q/22685451
upvote count: 1
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/34561289
type: Answer
has body: This code should print the values you want: final int[] values = {1, 2, 3, 4}; for (int size = 2; size &lt; values.length; size++) { for (int i = 0; i + size &lt;= values.length; i++) { for (int j = 0; j &lt;= size - 1; j++) { System.out.print(values[i + j]); } System.out.println(); } } From the example, we see that you want to print sets of values whose length is greater than 1 and smaller than the total set, so that 's what the following line does: for (int size = 2; size &lt; values.length; size++) { After that we compute the starting index of the subset, watching not to run into a IndexArrayOutOfBounds exception (see the line below) for (int i = 0; i + size &lt;= values.length; i++) { From there we just print the values starting at i index and with the subset length of size for (int j = 0; j &lt;= size - 1; j++)
downvote count: 0
answers question: http://stackoverflow.com/q/22685451
score: 1

http://stackoverflow.com/comment/34780457
has text: And yes, packages should be used. It is also *possible* to specify classes in the root package that has no package name, but this is not recommended and it has several drawbacks.
type: AnswerComment
comment on: http://stackoverflow.com/a/22807114
score: 0
type: Comment

http://stackoverflow.com/a/22780605
has comment: http://stackoverflow.com/comment/34734431
has comment: http://stackoverflow.com/comment/34776575
has comment: http://stackoverflow.com/comment/34734161
has comment: http://stackoverflow.com/comment/34732619
has body: From above code, it seems that you want to move one file from one directory to another. As per this assumption, you can use below code. String sourcePath = "D:\\other\\new.xls"; File source = new File(sourcePath); System.out.println("souce name " + sourcePath); File destDirPath = new File("D:\\"); try { FileUtils.moveFileToDirectory(source, destDirPath, false); } catch (IOException e) { e.printStackTrace(); } System.out.println("file moved successfully..."); This will definitely help you.
answers question: http://stackoverflow.com/q/22779928
score: 0
has comment: http://stackoverflow.com/comment/34732846
type: Answer
has comment: http://stackoverflow.com/comment/34774187

http://stackoverflow.com/a/22771061
score: 1
downvote count: 0
has comment: http://stackoverflow.com/comment/34716806
type: Answer
has body: The method you want is update() You can read about it by searching for "update" on this page: http://developer.android.com/reference/android/database/sqlite/SQLiteDatabase.html One way to use this would be: // function to create a pin for the locker public void createPin(tring lockerNumber, int pin, int status) { ContentValues cv = new ContentValues() cv.put(KEY_PIN, pin); cv.put(KEY_STATUS, status); ourDatabase.update(DATABASE_TABLE, cv, KEY_LOCKERNUMBER + " = ?" , new String[] {lockerNumber}); }
upvote count: 1
answers question: http://stackoverflow.com/q/22770951
has comment: http://stackoverflow.com/comment/34716056
has comment: http://stackoverflow.com/comment/34717160

http://stackoverflow.com/q/22673421
possible better answer: http://stackoverflow.com/a/22676737
score: 29
tagged with: java-8
upvote count: 29
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/66358073
has answer: http://stackoverflow.com/a/77616289
tagged with: java
tagged with: javadoc
type: Question
accepted answer: http://stackoverflow.com/a/55150289
has comment: http://stackoverflow.com/comment/85969504
has answer: http://stackoverflow.com/a/22676737
has answer: http://stackoverflow.com/a/55150289
answer count: 3
downvote count: 0
has title: New javadoc annotation @apiNote
has body: I found a new and undocumented javadoc tag at LongStream class documentation. The javadoc tag @apiNote seems to be used to detail some explanation about a method, but there's no documentation or release notes about this tag. What's the real purpose of it? Where is its documentation? A compiled javadoc example using @apiNote can be found at Reduce method documentation
favorite count: 0

http://stackoverflow.com/q/22747026
type: Question
linked to: http://stackoverflow.com/q/22526050
has comment: http://stackoverflow.com/comment/34672889
answer count: 1
has title: Java, spring with hibernate don't see any changes if I make them directly on DB?
has body: Hi all I have strange problem. I have application fully hibernate + spring. Everything works greate if I use only hibernate to add / edit / delete object. But when I make changes directly on DB application don't see the changes? (don't update them). My persitance is pretty simple: &lt;persistence-unit name="allegroTransactionPersistenceUnit" transaction-type="RESOURCE_LOCAL"&gt; &lt;provider&gt;org.hibernate.ejb.HibernatePersistence&lt;/provider&gt; &lt;properties&gt; &lt;property name="hibernate.dialect" value="org.hibernate.dialect.MySQLDialect" /&gt; &lt;property name="hibernate.connection.url" value="jdbc:mysql://localhost:3306/AllegroShop?UseUnicode=true&amp;amp;characterEncoding=utf8" /&gt; &lt;property name="hibernate.connection.driver_class" value="com.mysql.jdbc.Driver" /&gt; &lt;property name="hibernate.connection.username" value="topSecret" /&gt; &lt;property name="hibernate.connection.password" value="topSecret" /&gt; &lt;!-- &lt;property name="hibernate.hbm2ddl.auto" value="create" /&gt; --&gt; &lt;property name="hibernate.hbm2ddl.auto" value="update" /&gt; &lt;property name="show_sql" value="true" /&gt; &lt;property name="hibernate.hbm2ddl.import_files" value="/SQL/payment_type.sql"/&gt; &lt;property name="hibernate.connection.useUnicode" value="true" /&gt; &lt;property name="hibernate.connection.characterEncoding" value="UTF-8" /&gt; &lt;property name="hibernate.connection.charSet" value="UTF-8" /&gt; &lt;/properties&gt; &lt;/persistence-unit&gt; &lt;/persistence&gt; My example class isn't very hard to undestand too: @Entity(name = "PAYMENT_TYPE") public class PaymentTypeImpl implements PaymentType { @Id @Column(name = "PAYMENT_ID") @GeneratedValue(strategy = GenerationType.AUTO) protected Long id; @Column(name = "PAYMENT_NAME") protected String paymentName; @Column(name = "PRICE", nullable = false) protected float paymentPrice; @Column(name = "ACTIVE") protected boolean active; @Override public Long getId() { return id; } @Override public void setId(…
type: UnansweredQuestion
tagged with: spring
score: 0
tagged with: java
tagged with: hibernate
has comment: http://stackoverflow.com/comment/34672541
has answer: http://stackoverflow.com/a/22747329

http://stackoverflow.com/a/23065006
has body: If you want to read an ontology from a Virtuoso server, you will need the "JDBC"-like drivers for Virtuoso, as explained here: http://virtuoso.openlinksw.com/dataspace/doc/dav/wiki/Main/VirtJenaProvider The download is at http://virtuoso.openlinksw.com/dataspace/doc/dav/wiki/Main/VOSDownload#Jena%20Provider though I preferred to compile it from source - then you can do something like: VirtDataset dataSet = new VirtDataset("jdbc:virtuoso://localhost:1111/charset=UTF-8/","user","pass"); Model baseModel = dataSet.getNamedModel("http://my.graph.name/"); OntModel ontModel = ModelFactory.createOntologyModel(OntModelSpec.OWL_MEM, baseModel); This should allow access to all your RDF-Triples stored in Virtuoso (one graph at a time). If you just want the RDF, leave out the last line with the "OntModel" construction. Same if the store is very large, as it loads the complete ontology into RAM.
has comment: http://stackoverflow.com/comment/35252654
score: 2
upvote count: 2
answers question: http://stackoverflow.com/q/22719871
has comment: http://stackoverflow.com/comment/35278627
downvote count: 0
type: Answer

http://stackoverflow.com/comment/34667375
type: AnswerComment
comment on: http://stackoverflow.com/a/22744413
has text: Thanks, will they also be stored in the ArrayList this way? How would i also exclude certain cells from being read in excel. So for example if I had a table and i didn't want to include the headers?
score: 0
type: Comment

http://stackoverflow.com/comment/34686742
score: 1
type: AnswerComment
has text: `BeanPostProcessor`s have to be configured as `static` `@Bean` and right, they shouldn't have any dependencies from other beans. Mark them with `static` allow to configure `BPP` first, and only after that all other stuff: autowiring, property-placeholder etc. for other beans
type: Comment
comment on: http://stackoverflow.com/a/22749776

ide
tags question: http://stackoverflow.com/q/22717091
tag name: ide
type: Tag
tags question: http://stackoverflow.com/q/22671848

http://stackoverflow.com/q/22758646
has comment: http://stackoverflow.com/comment/34693242
answer count: 0
downvote count: 0
score: 1
has body: I encounter this error when deploying to Weblogic9.2 ����: Context initialization failed org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'sessionFactory' defined in class path resource [me/irix/spring/datasource.xml]: Invocation of init method failed; nested exception is org.springframework.beans.BeanInstantiationException: Could not instantiate bean class [org.hibernate.cfg.Configuration]: Constructor threw exception; nested exception is java.lang.NoSuchFieldError: INSTANCE at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1512) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:521) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:458) at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:296) at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:223) at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:293) at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:194) at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:610) at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:932) at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:479) at org.springframework.web.context.ContextLoader.configureAndRefreshWebApplicationContext(ContextLoader.java:410) at org.springframework.web.context.ContextLoader.initWebApplicationContext(ContextLoader.java:306) at org.springframework.web.conte…
tagged with: java
tagged with: hibernate
has comment: http://stackoverflow.com/comment/34693947
type: Question
has comment: http://stackoverflow.com/comment/34694150
has title: Hibernate java.lang.NoSuchFieldError: INSTANCE
has comment: http://stackoverflow.com/comment/34693541
has comment: http://stackoverflow.com/comment/34693512
has comment: http://stackoverflow.com/comment/34693375
upvote count: 1
has comment: http://stackoverflow.com/comment/34694814
favorite count: 0
type: UnansweredQuestion
tagged with: spring

http://stackoverflow.com/a/22767254
score: 0
type: Answer
answers question: http://stackoverflow.com/q/22767033
has body: The random number generated may repeat.That is the problem.So, you can save the generated random number temporarily , and check it with the next random number , if they are same loop it again.This is a wide logic. You can use Collections.shuffle(); . Then , there will be no head ache regarding repeatation.

http://stackoverflow.com/comment/34688762
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/22756090
has text: Where did you get those JAR files from? I cannot believe that you'd get them from Apache with unresolved compilation problems.
score: 0

http://stackoverflow.com/q/22757897
score: 0
type: UnansweredQuestion
has title: Sysout comes out before function finished
has comment: http://stackoverflow.com/comment/34692475
has comment: http://stackoverflow.com/comment/34691951
has comment: http://stackoverflow.com/comment/34691897
tagged with: java
type: Question
has comment: http://stackoverflow.com/comment/34691817
tagged with: function
has body: What I try to do : Call function1 =&gt; set values Call function2 =&gt; GetValues Sysout =&gt; print the modified values My problem, the sysout comes befor I do "Set Values" so it shows me the old values. What did I do wrong ? Here is my code : System.out.println("Cmd before SetParam : "+info1+"/"+info2+"/"+info3+"/"+info4+"/"+info5+"/"+info6+"/"+info7+"/"+info8); TMSSA2_1.SetParam(info1,info2,info3,info4,info5,info6,info7,info8); String[] cmd = new String[8]; cmd = TMSSA2_1.GetCmd(); System.out.println("New Cmd =&gt; "+Arrays.toString(cmd)); So my output look like : cMD before SetParam : 45/128/128/128/128/128/0/0 New Cmd =&gt; [null, null, null, null, null, null, null, null] SetParam =&gt; ok GetCmd =&gt; Ok So you can see that my 2 functions are called after my sysout. EDIT : Full Functions code : static int Check_jb1 = 0; static int Check_jb2 = 0; public static String[] Commande = new String[8]; public static void SetParam(final String info1,final String info2,final String info3,final String info4, final String info5,final String info6,final String info7,final String info8){ String d1 = info1,d2 = info2,d3 = info3,d4 = info4,d5 = info5,d6 = info6,d7 = info7,d8 = info8; final String[] cmd = new String[8]; cmd[0] = d1; cmd[1] = d2; cmd[2] = d3; cmd[3] = d4; cmd[4] = d5; cmd[5] = d6; cmd[6] = d7; cmd[7] = d8; //d1,d2,d3,d4,d5,d6,d7,d8; // valeur que l'on renvoie ds la cmd System.out.println("Debug : "+d1+"/"+d2+"/"+d3+"/"+d4+"/"+d5+"/"+d6+"/"+d7+"/"+d8); final JFrame fenetre = new JFrame(); fenetre.setTitle("Set Value(s)"); fenetre.setSize(375,450); fenetre.setLocationRelativeTo(null); fenetre.setResizable(true); JPanel jp1 = new JPanel(); jp1.setBorder(BorderFactory.createTitledBorder("Set Parameters : ")); jp1.setPreferredSize(new Dimension(325, 325)); jp1.setBackground(Color.white); JLabel jl1 = new JLabel(); jl1.setText("Installation Height : "+info1); jl1.setPreferredSize(new Dimension(175, 25)); final JTextField jt1 = new JTextField(); jt1.setPreferredSize(ne…
has comment: http://stackoverflow.com/comment/34693243
has comment: http://stackoverflow.com/comment/34692281
has comment: http://stackoverflow.com/comment/34693547
has comment: http://stackoverflow.com/comment/34691914
has comment: http://stackoverflow.com/comment/34692020
tagged with: system.out
has comment: http://stackoverflow.com/comment/34692351
has comment: http://stackoverflow.com/comment/34691854
answer count: 0

http://stackoverflow.com/comment/34655220
has text: Marco, these guys are giving me shit because I didn't make it easy enough to see but when I pasted it into the window earlier the text wrapped to the next line so you could see it then when I posted it looked like this. How the heck would I know that??? Anyway yeah the code looks fine to me, but for some reason its still thawing that exception.... I doubled checked the if statement and its how its supposed to be
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/22737415
score: 0

http://stackoverflow.com/comment/34669778
type: AnswerComment
has text: @deep_ecstasy You have a file and in one thread you seek(0) so the file jumps to 0, then in another thread you seek(n) so it jumps to `n`, now you write and it will be after `n` even if you did it from the first thread. Everything you write after that will be what ever downloaded from the two threads, in a somewhat random order.
score: 0
type: Comment
comment on: http://stackoverflow.com/a/22742912

http://stackoverflow.com/q/22782836
has title: sleep() thread is sleeping main thread and not separate specified thread
possible better answer: http://stackoverflow.com/a/22782874
has answer: http://stackoverflow.com/a/22782874
has answer: http://stackoverflow.com/a/22786006
tagged with: android
answer count: 4
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/22782881
tagged with: multithreading
has answer: http://stackoverflow.com/a/22784499
has body: At a high level, the following is what I intend to happen here: -- BroadcastReceiver within BackgroundManagerService receives a broadcast from Android (works fine) -- BroadcastReceiver within BackgroundManagerService sends the intent to startTestsRunnerThread() (works fine) -- startTestsRunnerThread() creates a BackgroundTestRunnerThread and starts it (seems to work fine) -- the thread which is an instance of BackgroundTestRunnerThread and was just created is put to sleep for 60 seconds (does not work). From extensive logging, when "BackgroundTestRunnerThread.sleep(milliseconds);" is executed, it is being run within the main thread. EDIT: I realize from the answers that sleep() is a static method and only works on the current thread. Is there a way to send a message into the thread that is running BackgroundTestRunnerThread and have it sleep (i.e., have sleep called from within the other thread)? I realize that, as per https://stackoverflow.com/a/3072338/1783829 and other posts I should probably be doing this with ScheduledExecutorService, but that is not my question here. At the present moment, my question is about why sleep() is executing in main thread and not in a separate thread. This is causing ANR (Android Not Responding) and Android kills my app. Here is my full code: public class Logger { public static void v(String tag, String msg) { Log.v(tag, Thread.currentThread().getName() + " **** " + msg); } } public class BackgroundTestRunnerThread extends Thread { @Override public void run() { try { while (!BackgroundTestRunnerThread.currentThread().isInterrupted()) { Intent intent = new Intent(MainActivity.getAppContext(), TestsRunnerService.class); Logger.v(this.getClass().getName(), "About to start TestsRunnerService "); MainActivity.getAppContext().startService(intent); SharedPreferences settings = PreferenceManager.getDefaultSharedPreferences( MainActivity.getAppContext()); int sleepTime; // Since Android saves preferences as strings, even with 'android:numeri…
tagged with: android-anr-dialog
type: Question
accepted answer: http://stackoverflow.com/a/22786006
tagged with: java
linked to: http://stackoverflow.com/q/3072173
score: 0

http://stackoverflow.com/comment/34728422
score: 0
has text: I don't know how @Autowired works, but shouldn't there be a return type for your function fooBargetProcessor ?
comment on: http://stackoverflow.com/q/22778149
type: Comment
type: QuestionComment

http://stackoverflow.com/a/22777624
upvote count: 3
has comment: http://stackoverflow.com/comment/34727260
has body: int is the primitive type, and is not a nullable value (it can't ever be null). Integer is a class object, which can be null if it has not yet been instantiated. Using an Integer vs. an int won't really affect anything in terms of functionality, and your code would behave the same if you changed "int" to "Integer" everywhere.
downvote count: 0
has comment: http://stackoverflow.com/comment/34727625
has comment: http://stackoverflow.com/comment/34727443
has comment: http://stackoverflow.com/comment/34727453
type: Answer
has comment: http://stackoverflow.com/comment/34727292
has comment: http://stackoverflow.com/comment/34727517
answers question: http://stackoverflow.com/q/22777568
score: 3

http://stackoverflow.com/q/22770562
tagged with: java
tagged with: loops
upvote count: 1
has answer: http://stackoverflow.com/a/22770975
has comment: http://stackoverflow.com/comment/34715848
downvote count: 1
has comment: http://stackoverflow.com/comment/34715867
type: Question
has title: Happy, Hungry, Energy states
has comment: http://stackoverflow.com/comment/34714768
score: 0
has comment: http://stackoverflow.com/comment/34715085
answer count: 1
favorite count: 0
has body: I'm designing a simple tamagotchi with a Jpanel interface using Eclipse. Im trying to decide what would be best method to use when writing code for happy, hungry, energy states using loops, These are my two classes, I'm using abstract Animal class, and MyPet which extends an Animal class: Animal Class: package GroupAnimal; import java.util.*; public abstract class Animal { protected int hungry; protected int happy; protected int energy; protected int toilet; protected int love; protected int health; protected int limbs; protected String name; protected String dob; protected double weight; protected double height; public int getHungry() { return hungry; } public int getHappy() { return happy; } public int getEnergy() { return energy; } public int gettoilet() { return toilet; } public int getLove() { return love; } public int getLimbs() { return limbs; } public int getHealth() { return health; } public String getName() { return name; } public String getDob() { return dob; } public double getWeight() { return weight; } public double getHeight() { return height; } protected void setName(String newName) { name = newName; } protected void setHeight(double newHeight) { height = newHeight; } protected void setWeight(double newWeight) { weight = newWeight; } protected void setLimbs (int newLimbs) { limbs = newLimbs; } protected void setDOB (String newDOB) { dob = newDOB; } protected abstract void die(); protected abstract void feed(int amount); protected abstract void sleep (int amount); protected abstract void play (int amount); protected abstract void annoy (int amount); protected abstract void cuddles (int amount); protected abstract void sick (int amount); } MyPet: package IndividualPet; import GroupAnimal.Animal; public class MyPet extends Animal { int Dec = 10; int Inc = 10; public MyPet(String aName, String aDOB, int aRelease, int aLimbs, double aWeight, double aHeight, int aEnergy, int aHungry) { energy = aEnergy; hungry = aHungry; name = aName; dob = aDOB; toilet = …
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/34714806
has comment: http://stackoverflow.com/comment/34715868

http://stackoverflow.com/a/22655189
downvote count: 0
answers question: http://stackoverflow.com/q/22655022
score: 3
upvote count: 3
has body: A json is a particular type of structured string, which can be used (among other things) to represent the state of POJOs. An interface is just a contract, and hence converting it to JSON doesn't really make sense. What you might want to do instead is define a method in the interface that returns the JSON representation of the concrete objects created using that interface. Something like (using Gson): public interface Something { String toJson(); } Now, any implementing class would be required to implement this method, as below: public class SomethingImpl implements Something { public String toJson() { Gson gson = new Gson(); return gson.toJson(this); } }
type: Answer

http://stackoverflow.com/comment/34569191
has text: Watch out, hope it's a typo, ` ` is not a valid tag
score: 0
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/22690006

http://stackoverflow.com/q/22726876
has answer: http://stackoverflow.com/a/22727241
has comment: http://stackoverflow.com/comment/34636562
has body: How can i remove lines from a JTextArea one by one instead of all together? I have a JTextArea which gets appended with string results from a thread, now i would like to remove one line at a time while the thread is executing.
score: 2
type: AnsweredQuestion
downvote count: 0
tagged with: java
type: Question
upvote count: 2
answer count: 2
tagged with: jtextarea
possible better answer: http://stackoverflow.com/a/22727241
has answer: http://stackoverflow.com/a/22726913
accepted answer: http://stackoverflow.com/a/22726913
has title: how to remove lines one by one from a JTextArea
favorite count: 0

http://stackoverflow.com/q/22677801
has answer: http://stackoverflow.com/a/22677835
has body: Working on Selenium Webdriver and using Java. I'm getting error as The system cannot find the path specified Code: package test; import java.io.BufferedReader; import java.io.FileInputStream; import java.io.FileReader; import java.util.ArrayList; import java.util.List; import java.util.Properties; import java.util.ResourceBundle; import org.openqa.selenium.By; import org.openqa.selenium.JavascriptExecutor; import org.openqa.selenium.WebDriver; import org.openqa.selenium.WebElement; import org.openqa.selenium.firefox.FirefoxDriver; import org.openqa.selenium.interactions.Actions; import org.openqa.selenium.support.ui.ExpectedConditions; import org.openqa.selenium.support.ui.Select; import org.openqa.selenium.support.ui.WebDriverWait; import org.testng.Assert; import org.testng.Reporter; import org.testng.annotations.AfterTest; import org.testng.annotations.BeforeTest; import org.testng.annotations.Test; import org.apache.log4j.Logger; import org.apache.log4j.xml.DOMConfigurator; import com.thoughtworks.selenium.DefaultSelenium; import com.thoughtworks.selenium.Selenium; public class OEPR_DefaultTab{ private static Logger Log = Logger.getLogger(OEPR_DefaultTab.class.getName()); private WebDriver driver; private StringBuffer verificationErrors = new StringBuffer(); Properties p= new Properties(); public Selenium selenium; @BeforeTest public void Login() throws Exception { driver = new FirefoxDriver(); try { p.load(new FileInputStream("C:/Login.txt")); } catch (Exception e) { e.getMessage(); } String url=p.getProperty("url"); DOMConfigurator.configure("src/log4j.xml"); Log.info("______________________________________________________________"); Log.info("Initializing Selenium..."); selenium = new DefaultSelenium("localhost", 4444, "*firefox",url); Thread.sleep(5000); Log.info("Selenium instance started"); try { p.load(new FileInputStream("C:/Login.txt")); } catch (Exception e) { e.getMessage(); } Log.info("Accessing Stored uid,pwd from the stored text file"); String uid=…
tagged with: selenium-webdriver
tagged with: java
tagged with: selenium
tagged with: webdriver
type: Question
linked to: http://stackoverflow.com/q/22651007
has answer: http://stackoverflow.com/a/22681717
score: 0
answer count: 2
has title: The system cannot find the path specified in java
has comment: http://stackoverflow.com/comment/34553391
type: UnansweredQuestion

http://stackoverflow.com/a/22846365
upvote count: 1
type: Answer
downvote count: 0
score: 1
answers question: http://stackoverflow.com/q/22801066
has body: From the looks of it - your eclipse is running under the same folder of your jar files (i.e. C:\test). So when you run from eclipse the program executes. But when you run from your command line you possibly opened your command window in a different folder (maybe C:) - so it can't find your classes that are located in "C:\test" or other folders. Maybe you can try running your program from C:\test or point to the location of the jar files in your command prompt (see Java command line with external .jar). When your program loads - it loads the previous A.jar file in the classpath. So when you point to class A (Class&lt;?&gt; cls = Class.forName("A");) it returns the A from the old jar files as it is not aware that you have replaced the old jar in the file system. You need to reload the jar files loaded in memory - please see Reloading jar files contents dynamically.

http://stackoverflow.com/q/22725622
has comment: http://stackoverflow.com/comment/34634438
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/22725662
tagged with: java
has title: What am I not seeing whilst getting info from a String[]
has comment: http://stackoverflow.com/comment/34634391
type: Question
score: 0
answer count: 3
tagged with: arrays
tagged with: string
has comment: http://stackoverflow.com/comment/34634558
accepted answer: http://stackoverflow.com/a/22725722
has answer: http://stackoverflow.com/a/22725661
has comment: http://stackoverflow.com/comment/34634388
possible better answer: http://stackoverflow.com/a/22725661
has answer: http://stackoverflow.com/a/22725722
has body: I am trying to split up my info first into a String[] by using "\n" as delimiter and than afterwards ,split them again into a String[] but this time using ";" as delimiter. I however fail at getting info out of the second split. public static void initHashMap(){ String[] lijnen = readDefinitioncsv(definitioncsv).split("\n"); for (int i =2;i&lt;lijnen.length;i++){ String[] detaillijn = lijnen[i].split(";"); // on the line below I get //java.lang.ArrayIndexOutOfBoundsException: 1 int rood = Integer.parseInt(detaillijn[1]); int groen = Integer.parseInt(detaillijn[2]); int blauw = Integer.parseInt(detaillijn[3]); String provincieNaam = detaillijn[4]; RGBProvince.put(new Color(rood,groen,blauw), provincieNaam); } } Thank you for your time

http://stackoverflow.com/q/22800159
answer count: 2
has comment: http://stackoverflow.com/comment/34768525
score: 0
has answer: http://stackoverflow.com/a/22800304
has answer: http://stackoverflow.com/a/22800396
type: UnansweredQuestion
has body: I am having trouble implementing my linkedlist. When I run the code it just doesn't produce anything and keeps running. UPDATE: I edited the toString to look like this: LinearNode&lt;T&gt; current = head; String result = ""; while (current != null) { result = result + (current.getElement()).toString() + "\n"; current = current.next; } return result; Now it works and prints so the error must be in the iterator. Here is LinkedList class: import java.util.*; import java.util.Iterator; public class LinkedList10Handout&lt;T&gt; implements ListADT&lt;T&gt; { protected int count; protected LinearNode&lt;T&gt; head, tail, current, previous; //=========================================================== // Creates an empty list. //=========================================================== public LinkedList10Handout() { count = 0; head = tail = null; current = null; } // constructor List /************************************************************** // Precondition: head is the head reference of a linked list. // The list might be empty or it might be non-empty. // PostCondition: One node has been added to the list. //**************************************************************/ public void InsertFirst(T addData)//********************************* { LinearNode&lt;T&gt; newnode = new LinearNode&lt;T&gt;(addData, null); if (isEmpty()) { head = newnode; tail = newnode; } else { newnode.next = head; head = newnode; } if (current == head.next) previous = head; count++; // LIST REQUIREMENTS: // if the list was initially empty, put tail on the list //if current was initially at the first node, we must now put previous behind it } /************************************************************** // this method calls insertAfter method after it finds the node it wants to insert a node after /**************************************************************/ public boolean Insert(T target, T addData)//************************* { LinearNode&lt;T&gt; find = find(target); boolean found = fa…
tagged with: linked-list
has title: Linked List not working
tagged with: java
type: Question

http://stackoverflow.com/comment/34667521
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/22744125
has text: it's not the full logcat of the crash
score: 0

http://stackoverflow.com/comment/34705625
comment on: http://stackoverflow.com/q/22765459
type: Comment
has text: "_An error is thrown_" Which error? And is it an error or exception?(You used both terms in your post)
type: QuestionComment
score: 2

http://stackoverflow.com/comment/106619009
type: AnswerComment
has text: @fire_water That statement `s1.executeUpdate()` *is* indeed wrapped in a try-catch, the outer try-with-resources defining three resources (the `Connection` and the pair of `PreparedStatement` objects). If that `executeUpdate` call throws an exception, the exception will be caught by the `catch` clause at the bottom, and the three resources (`con`, `s1`, and `s2`) will be closed.
type: Comment
comment on: http://stackoverflow.com/a/45133734
score: 1

http://stackoverflow.com/q/22703501
has comment: http://stackoverflow.com/comment/34594410
has body: I need to call another @RequestMapping from inside of a spring controller. Now I can easily do it by return "redirect:anotherMapping.htm"; But the I need to pass value in form object as well. @RequestMapping("/anotherMapping") public ModelAndView addUser(final @ModelAttribute("userLogin") UserLogin userLogin, final HttpServletRequest request){ I need to pass userId in UserLogin. If I write return "redirect:anotherMapping.htm";, then it invokes this controller method but form object is null. Please help.
tagged with: servlets
upvote count: 2
answer count: 1
favorite count: 0
has comment: http://stackoverflow.com/comment/34594349
has comment: http://stackoverflow.com/comment/34606914
tagged with: spring
tagged with: spring-mvc
type: AnsweredQuestion
score: 2
downvote count: 0
has title: how to call spring controller @RequestMapping from another action method passing form object along with the call
tagged with: java
has answer: http://stackoverflow.com/a/22703602
accepted answer: http://stackoverflow.com/a/22703602
type: Question

http://stackoverflow.com/q/22718965
has title: Why do I get a NPE exception when nothing matches the query
score: 0
tagged with: java
has comment: http://stackoverflow.com/comment/34634531
type: Question
has comment: http://stackoverflow.com/comment/34633629
has answer: http://stackoverflow.com/a/22725723
has body: Using the following datanucleus query the execute method throws a NullPointerException when nothing matches the query. StringBuilder query = new StringBuilder("select avg(millis) from "); query.append(clazz.getName()); query.append(String.format(" where name.equals('%s')", name)); query.append(String.format(" &amp;&amp; database.equals('%s')", props.get("database"))); query.append(String.format(" &amp;&amp; version.equals('%s')", props.get("version"))); Double ave = (Double) pm.newQuery(query.toString()).execute(); The NPE is as follows: at org.datanucleus.query.evaluator.memory.SetExpression.avg(SetExpression.java:414) at org.datanucleus.query.evaluator.memory.InMemoryExpressionEvaluator.getValueForInvokeExpression(InMemoryExpressionEvaluator.java:719) at org.datanucleus.query.evaluator.memory.InMemoryExpressionEvaluator.processInvokeExpression(InMemoryExpressionEvaluator.java:562) at org.datanucleus.query.evaluator.AbstractExpressionEvaluator.compilePrimaryExpression(AbstractExpressionEvaluator.java:200) ... I spent some time in the debugger and I can see that the collection passed to the SetExpression constructor is empty. This eventually leads to NPE in the SetExpression.avg method. Is the correct behavior of 'avg' when the collection is empty? The documentation is ambiguous about what the 'avg' return value would be if nothing matched the query, but I would not have expected an NPE.
has comment: http://stackoverflow.com/comment/34645214
answer count: 2
tagged with: datanucleus
has comment: http://stackoverflow.com/comment/34628095
has comment: http://stackoverflow.com/comment/34633097
has comment: http://stackoverflow.com/comment/34627969
has answer: http://stackoverflow.com/a/22725286
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/34627928
has comment: http://stackoverflow.com/comment/34651794
has comment: http://stackoverflow.com/comment/34629367
has comment: http://stackoverflow.com/comment/34627901

http://stackoverflow.com/comment/34722800
comment on: http://stackoverflow.com/q/22774896
score: 1
has text: The linked question has an explanation edited into the bottom of it. If you don't understand the explanation, write a comment on that question.
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/34696067
has text: Have you looked at [Bézier curves](https://en.wikipedia.org/wiki/B%C3%A9zier_curve). They are a fairly standard piecewise polynomial solution to curve fitting. They are normally used in a 2D case but can be used in 1D as well.
score: 0
comment on: http://stackoverflow.com/q/22758774
type: Comment
type: QuestionComment

http://stackoverflow.com/q/22701182
has answer: http://stackoverflow.com/a/22701214
tagged with: dictionary
has answer: http://stackoverflow.com/a/22701351
has body: I sometimes had such a difficult situation in debugging. I have a Java HashMap which contains many entries, and the program doesn't work as expected because it says the map doesn't contain a particular entry, but that entry is supposed to be in the map. However, I can't debug into the map. In Eclipse I can see the internals of the Map in variables, but given so many entries it's hard to eye-scan all the entries in the map to see whether that entry is in the map or not. Is there a better way to debug this type of situation? For you for your insight and thoughts.
downvote count: 0
tagged with: java
upvote count: 8
type: Question
has answer: http://stackoverflow.com/a/22701501
has comment: http://stackoverflow.com/comment/34590242
answer count: 3
has title: How to debug into a map?
favorite count: 0
score: 8
type: UnansweredQuestion

http://stackoverflow.com/comment/83371654
score: 0
type: Comment
has text: well, i was confused exactly by that answer, that's why i created that test
comment on: http://stackoverflow.com/a/22743508
type: AnswerComment

http://stackoverflow.com/comment/34534023
type: Comment
comment on: http://stackoverflow.com/a/22669773
has text: Thanks. There is only one "background-image" value but can be more "url(XYZ)" values.
type: AnswerComment
score: 0

http://stackoverflow.com/q/22689291
has comment: http://stackoverflow.com/comment/34572771
has comment: http://stackoverflow.com/comment/34572675
has comment: http://stackoverflow.com/comment/34568771
has answer: http://stackoverflow.com/a/22693011
accepted answer: http://stackoverflow.com/a/22693011
has title: LibGDX set bullet initial position around the ship's circle 2D graphics
type: AnsweredQuestion
tagged with: libgdx
tagged with: java
type: Question
has comment: http://stackoverflow.com/comment/34572980
has body: Have a small issue with some thoughts, but have no idea which libraries to use and how. So far I am creating 2D game and I have a small ship sprite and bullets. For this moment my bullets launched from the central point of the ship. What I want: To create something like a circle around my ship and make possible to fire bullets from the circle lines according to the direction. Maybe it is possible to make by using Quaternion class, but need some hints, how to start. Another idea, is to create another bullet, which will be always parallel to the first one and will be fired simultaneously. Image below describes what I is my aim in this project. So far my update() method inside player class makes next operations: @Override public void update() { //When player touches the screen, TouchInputHandler class sets the variable isAiming = true. if (TouchInputHandler.isAiming) { //Creating an Vector2 object which takes coordinates from user input on the screen. Vector2 aim = new Vector2(TouchInputHandler.getAimDirection().x, TouchInputHandler.getAimDirection().y); //Checking if aim is real value. //Waiting for the delay between previous and next bullet launched. if (aim.len2() &gt; 0 &amp;&amp; cooldownRemaining &lt;= 0) { //cooldownFrames if final static value equal to 6. //So loop will go through 6 times before next bullet. cooldownRemaining = cooldownFrames; //Taking the current position of the ship and applying it to the current position of bullet. Vector2 currentPos = new Vector2(position.x, position.y); //Substituting current bullet position from the aim position and getting direction vector. aim.sub(currentPos); //Normalizing the aim (bullet direction) vector, so the sum of scalars of vector = 1; aim.nor(); //Incresing the speed of bullet movement. aim.x *= 10; aim.y *= 10; //adding new entity with the bullet currentPos and direction where it has to move. EntityManager.addEntity(new Bullet(currentPos, aim)); //After bullet has been launched, set isAiming to false. TouchIn…
has comment: http://stackoverflow.com/comment/34568221
answer count: 1
has comment: http://stackoverflow.com/comment/34571572
score: 0
has comment: http://stackoverflow.com/comment/34573527

http://stackoverflow.com/comment/34641839
score: 0
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/22729989
has text: Well then how do you print Unicode code point U+1F601 (a [smiley](http://en.wiktionary.org/wiki/Appendix:Unicode/Emoticons)) in C/C++, provided your display supports that?

http://stackoverflow.com/q/22718712
has body: I have two BufferedReader objects: BufferedReader br = new BufferedReader(new FileReader("tekst.txt")); BufferedReader pmc = new BufferedReader(new FileReader("tekst.txt")); What I want to do is read char by char the entire file. I need two Readers because one of them (pmc) will get sometimes "one char to many". So let's say the Reader br read 4 characters, and pmc read 5 characters - after that I want to assign br to pmc, so that both of them looked like they read 4 characters. Thought that simple pmc = br; would work, but pmc is still one character too far. How can I do this?
answer count: 3
tagged with: bufferedreader
score: 0
has title: How to use properly BufferedReader
has answer: http://stackoverflow.com/a/22718835
has answer: http://stackoverflow.com/a/22718843
has answer: http://stackoverflow.com/a/22718996
accepted answer: http://stackoverflow.com/a/22718996
type: AnsweredQuestion
possible better answer: http://stackoverflow.com/a/22718835
type: Question
tagged with: java

http://stackoverflow.com/comment/34639330
has text: @user3367768 java.sql.Date itself IS a timestamp. It contains date and time information. Your Oracle Date type also contains date and time information.
score: 0
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/22728026

http://stackoverflow.com/comment/59483884
comment on: http://stackoverflow.com/q/22807912
score: 19
type: QuestionComment
has text: While this is possible (see the selected answer), everyone should probably think twice about actually doing this. It is officially ["strongly discouraged"](https://docs.oracle.com/javase/tutorial/java/javaOO/lambdaexpressions.html#serialization) and can have [serious](http://stackoverflow.com/questions/25443655/possibility-to-explicit-remove-serialization-support-for-a-lambda) [security](https://www.contrastsecurity.com/security-influencers/serialization-must-die-act-1-kryo) [implications](https://www.contrastsecurity.com/security-influencers/serialization-must-die-act-2-xstream).
type: Comment

http://stackoverflow.com/comment/34567485
type: Comment
comment on: http://stackoverflow.com/a/22688105
has text: @fanky you're welcome :) Please see updated answer, there's a simplest way to write this `for` loop.
type: AnswerComment
score: 0

http://stackoverflow.com/q/22662173
has answer: http://stackoverflow.com/a/22769432
score: 0
answer count: 3
tagged with: jar
has answer: http://stackoverflow.com/a/22790298
has answer: http://stackoverflow.com/a/22672875
tagged with: xpages
has body: I have a long standing domino application that uses embedded views to display data. This application has been moved from a server 2003, 32 bit, domino 8.5 environment to a new server 2008 R2 64 bit domino 8.5.3 FP6 environment. I have everything up and working as before with the exception of embedded views. They are giving a SecurityException "Missing required Permissions manifest attribute in main jar: http://*.com/domjava/nvapplet.jar". I have confirmed that the actionbar.jar, editor.jar, nvapplet.jar, and outline.jar are the current version on the server. I have even replaced them with the version from the IBM download (http://www-01.ibm.com/support/docview.wss?uid=swg21662233). I can get this to work by displaying the view as HTML instead of Java Applet, but I don't understand what the issue is with the java version?
type: AnsweredQuestion
tagged with: java
tagged with: lotus-domino
possible better answer: http://stackoverflow.com/a/22672875
accepted answer: http://stackoverflow.com/a/22769432
type: Question
has title: Domino nvapplet.jar Security Exception

http://stackoverflow.com/a/22748186
score: 1
answers question: http://stackoverflow.com/q/22748076
has comment: http://stackoverflow.com/comment/34674714
downvote count: 0
has body: toString method is not a static method, so you should call it from a Report object like: Report report = new Report();//suppose this a valid declaration form a Report class. totalTaxField.setText(report.toString());
type: Answer
has comment: http://stackoverflow.com/comment/34675407
upvote count: 1

http://stackoverflow.com/q/22666480
favorite count: 0
tagged with: http://stackoverflow.com/tag/html
has comment: http://stackoverflow.com/comment/48277379
type: AnsweredQuestion
score: 2
upvote count: 2
linked to: http://stackoverflow.com/q/15738259
tagged with: java
has comment: http://stackoverflow.com/comment/34528745
has title: jsp autocomplete="off" not working in Chrome or Firefox
tagged with: google-chrome
type: Question
has answer: http://stackoverflow.com/a/24415798
tagged with: firefox
has body: I've made a modification to the following, to prevent a users username appearing in the login box. Username: <input tabindex="1" type="text" name="j_username" id="j_userName" class="text" value='<c:if test="${param.login_error == 'authFailure'}">${SPRING_SECURITY_LAST_USERNAME}</c:if>' /> Forgot your username or password? <input tabindex="1" type="text" name="j_username" id="j_userName" **autocomplete="off"** class="text" value='<c:if test="${param.login_error == 'authFailure'}">${SPRING_SECURITY_LAST_USERNAME}</c:if>' /> I thought this would prevent usernames being saved, do you know why Chrome and FF seem to ignore this? cheers, Ben
accepted answer: http://stackoverflow.com/a/24415798
tagged with: security
has comment: http://stackoverflow.com/comment/34527579
answer count: 1
downvote count: 0

http://stackoverflow.com/comment/34693294
type: Comment
has text: Indeed, you can use volley or [Picasso](http://square.github.io/picasso/) (created by folks at Square) which is probably simpler to use only for pictures.
type: AnswerComment
comment on: http://stackoverflow.com/a/22758489
score: 0

http://stackoverflow.com/comment/34775687
type: AnswerComment
comment on: http://stackoverflow.com/a/22804640
type: Comment
has text: Can you explain the difference between exception and error?
score: 0

http://stackoverflow.com/q/22762375
has title: How can a subclass override the mapping of an inherited association so that it is ignored (not mapped for the subclass entity)?
tagged with: orm
type: Question
score: 0
has answer: http://stackoverflow.com/a/22763217
upvote count: 1
tagged with: jpa
answer count: 1
downvote count: 1
favorite count: 0
has body: Given some entities like this: @MappedSuperclass public abstract class BaseEntity { @ManyToOne(optional = true) @JoinColumn(name = "friend_id") private AnotherEntity friend; } @Entity public class AnotherEntity { // ... } @Entity public class ConcreteEntity extends BaseEntity { //... } How can ConcreteEntity override the mapping of friend so that it is not mapped at all for instances of ConcreteEntity?
type: UnansweredQuestion
tagged with: java
tagged with: hibernate

http://stackoverflow.com/comment/34801778
score: 0
type: Comment
comment on: http://stackoverflow.com/a/22801097
type: AnswerComment
has text: Sure - I'll expand on the answer a bit.

http://stackoverflow.com/comment/34612622
type: AnswerComment
type: Comment
score: 1
comment on: http://stackoverflow.com/a/22713721
has text: @Phoenix I am also using 1.7.0_25 version but it is not allowed in this version

http://stackoverflow.com/comment/34618775
has text: i have 100 elements, and i want show 10, and when the user reaches the end, I want to get another 10 and so on until 100
type: Comment
comment on: http://stackoverflow.com/a/22717129
score: 0
type: AnswerComment

http://stackoverflow.com/q/22778975
favorite count: 0
tagged with: betamax
has title: Betamax fails to record HTTPS traffic
possible better answer: http://stackoverflow.com/a/39331577
has answer: http://stackoverflow.com/a/22779318
linked to: http://stackoverflow.com/q/2893819
score: 1
tagged with: java
has body: My question is connected with Betamax library. I have problem with recording HTTPS traffic. I am using Betamax 1.1.2, JDK 1.6, Groovy 2.2.2 and jUnit 4.11. My test code: @Rule public Recorder recorder = new Recorder(); @Before public void setup() { recorder.setSslSupport(true); } @Betamax(tape = "my_tape") @Test public void test1() throws Exception { MyConnector connector = new Connector(); String response = connector.getResponse(); assertThat(response, is("response")); } Response that I get is: 2014-04-01 08:34:16 DEBUG log:70 - REQUEST *:443 on org.eclipse.jetty.server.nio.SelectChannelConnector$2@10eaa67 2014-04-01 08:34:16 DEBUG CustomConnectHandler:70 - CONNECT request for webserivce:443 2014-04-01 08:34:16 DEBUG ssl:70 - [Session-1, SSL_NULL_WITH_NULL_NULL] channel=java.nio.channels.SocketChannel[connected local=/127.0.0.1:5556 remote=/127.0.0.1:51033] 2014-04-01 08:34:16 DEBUG ssl:70 - [Session-1, SSL_NULL_WITH_NULL_NULL] unwrap filled 0 2014-04-01 08:34:16 DEBUG CustomConnectHandler:70 - Upgraded connection to ClientToProxy(:5555&lt;=&gt;:51032) 2014-04-01 08:34:16 DEBUG log:70 - RESPONSE webservice:443 101 2014-04-01 08:34:16 DEBUG CustomConnectHandler:70 - ClientToProxy(:5555&lt;=&gt;:51032): begin reading from client 2014-04-01 08:34:16 DEBUG CustomConnectHandler:70 - ClientToProxy(:5555&lt;=&gt;:51032): registered channel java.nio.channels.SocketChannel[connected local=/127.0.0.1:51033 remote=/127.0.0.1:5556] with ection ProxyToServer(:51033&lt;=&gt;:5556) 2014-04-01 08:34:16 DEBUG CustomConnectHandler:70 - ClientToProxy(:5555&lt;=&gt;:51032): end reading from client 2014-04-01 08:34:16 DEBUG CustomConnectHandler:70 - ProxyToServer(:51033&lt;=&gt;:5556): begin reading from server 2014-04-01 08:34:16 DEBUG CustomConnectHandler:70 - ProxyToServer(:51033&lt;=&gt;:5556): end reading from server 2014-04-01 08:34:16 DEBUG CustomConnectHandler:70 - ClientToProxy(:5555&lt;=&gt;:51032): begin reading from client 2014-04-01 08:34:16 DEBUG CustomConnectHandler:70 -…
upvote count: 1
type: Question
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/39331577
tagged with: ssl
answer count: 2
downvote count: 0
accepted answer: http://stackoverflow.com/a/22779318

http://stackoverflow.com/comment/34696596
comment on: http://stackoverflow.com/q/22760420
has text: Sorry I had a brainfart. Now I cannot delete this question even though I want to. :(
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/34606218
has text: I think there is still a bug in the code: You do not ignore daylight saving time, by using CET. Swatch internet time is **not** CET, it is UTC+1 **without** DST. `cal.set(2013, 2, 31, 2, 0, 0);` and `cal.set(2013, 2, 31, 3, 0, 0);` both result to 124. You should use `Calendar.getInstance(java.util.TimeZone.getTimeZone("UTC+1")`.
comment on: http://stackoverflow.com/a/22693795
type: Comment
score: 3
type: AnswerComment

http://stackoverflow.com/a/22746820
type: Answer
score: 3
upvote count: 3
downvote count: 0
has body: As others have suggested, you need to get a reference to the BeanFactory which the ApplicationContext uses, cast it to a DefaultListableBeanFactory and invoke the destroySingleton(..) method Student st = gc.getBean("st", Student.class); ((DefaultListableBeanFactory) gc.getBeanFactory()).destroySingleton("st"); The underlying DefaultListableBeanFactory keeps a reference to your singleton beans. The call to destroySingleton(..) will remove all references to the specified bean and call any DisposableBean or other registered Spring-managed finalizers on it. However, your program has another reference to the instance in the variable st. So you also need to clear that reference if you want the instance to be garbage collected. st = null;
answers question: http://stackoverflow.com/q/22742229

http://stackoverflow.com/comment/34770559
has text: `java.io` has all the classes you need to read files. You'll need to either write the code to decode a BMP file or find a library that does it for you, though.
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/22801392
score: 0

http://stackoverflow.com/q/22801321
tagged with: arrays
downvote count: 0
has comment: http://stackoverflow.com/comment/34769997
favorite count: 0
possible better answer: http://stackoverflow.com/a/22801342
answer count: 5
tagged with: android
score: 2
type: AnsweredQuestion
upvote count: 2
tagged with: java
has comment: http://stackoverflow.com/comment/34770106
has comment: http://stackoverflow.com/comment/34770229
has answer: http://stackoverflow.com/a/22801566
has answer: http://stackoverflow.com/a/22801520
type: Question
has answer: http://stackoverflow.com/a/22801342
has title: check same value between two Array android
has comment: http://stackoverflow.com/comment/34770259
has body: I have two Array as below : String a[]={"book","pen"}; String b[]={"pen","pencil","bottle","book","bag"}; I want to check, same value between array b and array a, i have try with this : for (int i=0; i &lt; b.length; i++){ for (int j=0; j &lt; a.length(); j++){ if(!(a.contains(b[i]))){ //delete if not same } so my question,how to check same value between two arraylist android?
accepted answer: http://stackoverflow.com/a/22801381
has answer: http://stackoverflow.com/a/22801509
has answer: http://stackoverflow.com/a/22801381

http://stackoverflow.com/comment/34701774
has text: switch is not necessarily faster than if/else - it depends on several factors, including the type of the switch variable (int vs String etc.), whether the case values are contiguous or not and how many cases there are.
comment on: http://stackoverflow.com/q/22763021
type: QuestionComment
type: Comment
score: 1

http://stackoverflow.com/comment/34543971
has text: Yes, I totally agree with you. I will edit my post more clearly
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/22675496
score: 0

http://stackoverflow.com/comment/34499906
type: Comment
type: QuestionComment
has text: http://stackoverflow.com/questions/2501861/how-can-i-remove-a-jpanel-from-a-jframe may help. In other words, use `frame1.remove()`.
comment on: http://stackoverflow.com/q/22650872
score: 0

http://stackoverflow.com/comment/34553850
score: 0
type: AnswerComment
type: Comment
has text: Arun, Thanks for replying but I am using latest version of Oracle IDE.
comment on: http://stackoverflow.com/a/22679255

http://stackoverflow.com/q/22764221
answer count: 1
has comment: http://stackoverflow.com/comment/34703584
has comment: http://stackoverflow.com/comment/34703393
has comment: http://stackoverflow.com/comment/34704218
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/34703448
tagged with: http-status-code-404
has comment: http://stackoverflow.com/comment/34703502
has comment: http://stackoverflow.com/comment/34704332
tagged with: java
has comment: http://stackoverflow.com/comment/34703508
has body: Even though I found several similar questions I'm not able to create my first Hello World Servlet. I keep receiving status code 404. So in the following folder /home/smihai/apache-tomcat-7.0.52/webapps/HelloWorld/WEB-INF/ I have a web.xml file and another folder "classes" with 2 files: HelloWorld.java and HelloWorld.class. The web.xml file contains: HelloWorld HelloWorld HelloWorld /HelloWorld The HelloWorld.java contains: import java.io.*; import javax.servlet.*; import javax.servlet.http.*; public class HelloWorld extends HttpServlet{ public void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException,IOException{ response.setContentType("text/html"); PrintWriter pw = response.getWriter(); pw.println(" "); pw.println(" Hello World "); pw.println(" "); pw.println(" Hello World "); pw.println(" "); } } What am I doing wrong?
has answer: http://stackoverflow.com/a/22764921
tagged with: tomcat7
tagged with: http
type: Question
has comment: http://stackoverflow.com/comment/34703763
has title: HTTP Status Code 404 Java/Servlets
tagged with: servlets
has comment: http://stackoverflow.com/comment/34704065
score: 0

http://stackoverflow.com/q/22666659
tagged with: javabeans
favorite count: 0
tagged with: apache-commons-beanutils
tagged with: propertychangelistener
has answer: http://stackoverflow.com/a/22715631
upvote count: 1
type: AnsweredQuestion
tagged with: java
has title: Bean utils with property change listeners dynamic addition?
type: Question
accepted answer: http://stackoverflow.com/a/22715631
has body: Commons Beanutils library contains good methods to operate on beans in runtime. But strangely I can find any methods to operate with change listeners. I.e. I can set some property in underlying bean with WrapDynaBean, but I can't add listener for this property change. Is it true? Why? Ans is there any library which fulfills this gap?
tagged with: changelistener
downvote count: 0
answer count: 1
score: 1

http://stackoverflow.com/a/22747529
has body: phew... got it working. Moved &lt;context:component-scan base-package="app.com,app.com.controller,app.com.dao,app.com.service,app.com.model"/&gt; &lt;bean id="messageSource" class="org.springframework.context.support.ResourceBundleMessageSource" p:basename="messages"/&gt; from dispatcher-servlet to application-context.xml Would anyone care to tell why it started working?
score: 0
type: Answer
answers question: http://stackoverflow.com/q/22747108
accepted answer of: http://stackoverflow.com/q/22747108
type: AcceptedAnswer

http://stackoverflow.com/comment/34666521
comment on: http://stackoverflow.com/q/22742097
score: 0
type: Comment
type: QuestionComment
has text: In c sharp I get a different string per every call encrypt method. But it's not true about java!!! in java I get the same string for every time !!! I dizzied :(

http://stackoverflow.com/comment/34599859
score: 0
comment on: http://stackoverflow.com/a/22706800
has text: Thanks, how about if I only read the variable after Thread A is DONE and FINISHED?
type: AnswerComment
type: Comment

http://stackoverflow.com/comment/34563798
type: AnswerComment
has text: Actually I have added common-io and fileupload jar in project lib ->build path and as well as in Tomcat edit launch configuration properties classpath, may be thats why it was getting conflicted. After i delete them from launch config. classpath , it start executing. Thanks all who tried to help.
score: 0
type: Comment
comment on: http://stackoverflow.com/a/22683263

http://stackoverflow.com/comment/55734301
type: Comment
has text: I don't understand the code snippet, but I assure you that if you generate an id *inside* of a transaction (with either the auto generator or the allocator), you will generate new ids every time the txn attempts to execute. If you want an idempotency guarantee, generate the id outside of a transaction. I've been told, however, that GAE is changing behavior so that CME is never thrown on a successful commit, which makes this less precarious. I don't know if/when that change became live.
type: AnswerComment
comment on: http://stackoverflow.com/a/22826602
score: 0

http://stackoverflow.com/a/22735229
answers question: http://stackoverflow.com/q/22735089
has comment: http://stackoverflow.com/comment/34651445
upvote count: 1
has body: <FrameLayout 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" >
downvote count: 0
score: 1
type: Answer

http://stackoverflow.com/comment/34639759
score: 0
type: Comment
comment on: http://stackoverflow.com/a/22728774
has text: im looking for a way to create a new instance using the index of the superclass animal.
type: AnswerComment

http://stackoverflow.com/q/22676504
type: Question
has body: Developing an android drive mode application that doesn't allow the user to access other apps when in drive mode. Looking for a way to detect when the user tries to open other apps such as Facebook, twitter, and bring him/her back to my application. Anyone have any ideas? I have been researching for a while with no solution. Is there a way to intercept the activity launch intent by other apps and then dismiss that intent by launching your own application?
has comment: http://stackoverflow.com/comment/34545441
score: 0
has comment: http://stackoverflow.com/comment/34545761
has comment: http://stackoverflow.com/comment/34550121
type: UnansweredQuestion
tagged with: android
tagged with: android-intent
linked to: http://stackoverflow.com/q/3290936
has comment: http://stackoverflow.com/comment/34550168
has title: How to detect a launch of an application and open my app instead?
answer count: 0
tagged with: java

http://stackoverflow.com/q/22709897
has comment: http://stackoverflow.com/comment/35479352
has comment: http://stackoverflow.com/comment/35391867
has comment: http://stackoverflow.com/comment/35397409
has comment: http://stackoverflow.com/comment/35423986
has comment: http://stackoverflow.com/comment/35318242
has title: Https connection Java, Android, self-signed certificate, java
answer count: 0
type: UnansweredQuestion
tagged with: java
tagged with: https
type: Question
tagged with: ssl
tagged with: sslsocketfactory
has comment: http://stackoverflow.com/comment/35324166
has body: I have following source code written in Java, which creates https connection to remote server and makes some request to http server: import java.io.FileInputStream; import java.security.KeyStore; import java.security.cert.Certificate; import java.util.*; import java.security.cert.X509Certificate; import java.security.*; import javax.net.ssl.SSLContext; import org.apache.http.HttpEntity; import org.apache.http.conn.ssl.TrustSelfSignedStrategy; import javax.net.ssl.SSLContext; import org.apache.http.conn.ssl.SSLContexts; import org.apache.http.conn.ssl.SSLConnectionSocketFactory; import org.apache.http.impl.client.CloseableHttpClient; import org.apache.http.impl.client.HttpClients; import org.apache.http.client.methods.HttpGet; import org.apache.http.client.methods.CloseableHttpResponse; import org.apache.http.util.EntityUtils; public class trustStore { public static void main(String[] args) throws Exception { char[] password = "OQASNRati6c=".toCharArray(); FileInputStream fIn = new FileInputStream("lamkin.p12"); KeyStore keystore = KeyStore.getInstance("PKCS12"); keystore.load(fIn, password); SSLContext sslcontext = SSLContexts.custom().loadTrustMaterial(keystore, new TrustSelfSignedStrategy()).build(); SSLConnectionSocketFactory sslsf = new SSLConnectionSocketFactory(sslcontext, new String[] { "TLSv1" }, null, SSLConnectionSocketFactory.ALLOW_ALL_HOSTNAME_VERIFIER); CloseableHttpClient httpclient = HttpClients.custom().setSSLSocketFactory(sslsf).build(); try { HttpGet httpget = new HttpGet("https://172.20.175.1/kani/"); System.out.println("executeng request" + httpget.getRequestLine()); CloseableHttpResponse response = httpclient.execute(httpget); try { HttpEntity entity = response.getEntity(); System.out.println("-------------------------------"); System.out.println(response.getStatusLine()); if (entity != null) { System.out.println("Response content lingth: " + entity.getContentLength()); } EntityUtils.consume(entity); } finally { response.close(); } } finally { h…
score: 0

http://stackoverflow.com/a/22662711
has comment: http://stackoverflow.com/comment/34520334
has comment: http://stackoverflow.com/comment/34520458
type: Answer
has body: You might have to change some of the variables in this method. I use this one in one of my apps. Animates a relativeLayout from bottom to top private void animate(){ RelativeLayout rl = (RelativeLayout)findViewById(R.id.yourLayout); AnimationSet set = new AnimationSet(true); Animation animation = new TranslateAnimation( Animation.RELATIVE_TO_SELF, 0.0f, Animation.RELATIVE_TO_SELF, 0.0f, Animation.RELATIVE_TO_SELF, 0.85f, Animation.RELATIVE_TO_SELF, 0.0f ); animation.setDuration(250); set.addAnimation(animation); LayoutAnimationController controller = new LayoutAnimationController(set, 0.25f); rl.setLayoutAnimation(controller); }
has comment: http://stackoverflow.com/comment/34552428
has comment: http://stackoverflow.com/comment/34520271
downvote count: 0
score: 1
has comment: http://stackoverflow.com/comment/34539853
answers question: http://stackoverflow.com/q/22662342
upvote count: 1
has comment: http://stackoverflow.com/comment/34520294

http://stackoverflow.com/a/24749847
answers question: http://stackoverflow.com/q/22723857
upvote count: 1
type: AcceptedAnswer
downvote count: 0
type: Answer
has body: Have you tried loading all of them at once? Start with that, and if it doesn't work, then look at memory management. You should be able to keep at least three or four models in memory on an older device. If you do have issues with ram, try to predict which models are going to be used next, and pre-load them in. Keeping them all loaded is normally preferable, because it means your app will appear fluid and responsive.
accepted answer of: http://stackoverflow.com/q/22723857
score: 1

http://stackoverflow.com/q/22654501
tagged with: resources
score: 0
answer count: 1
has body: I originally had my .mid file in the project directory and I had got it like this: File file = new File("hmr.mid"); It all worked fine, then I tried to export it to a runnable .jar, because than I had NullPointerException when I tried to access the file later. I have read that I should add the resource to the package, so I did this: http://kepfeltoltes.hu/140326/115027543proj_www.kepfeltoltes.hu_.png Since than, I have did a ton of googling, SOF search, looked at a ton of examples (and I think most of people are getting it wrong, e.g. use absolute path), read articles like this: http://www.thinkplexx.com/learn/howto/java/system/java-resource-loading-explained-absolute-and-relative-names-difference-between-classloader-and-class-resource-loading but nothing ever worked. I get a NullPointerException just when I export to .jar, but even when I simply run it. Here is my resource loader with some residue of my attempts. It works fine with images. import java.awt.Image; import java.awt.Toolkit; import java.io.File; import java.io.InputStream; import java.net.URL; public class ResourceLoader { static ResourceLoader rl = new ResourceLoader(); public static Image getImage(String filename) { return Toolkit.getDefaultToolkit().getImage(rl.getClass().getResource(filename)); } public static File getFile(String filename) { //InputStream is = rl.getClass().getResourceAsStream("hmr.mid"); //URL url = Thread.currentThread().getContextClassLoader().getResource("hmr.mid"); //File file = new File(url.toString()); //url = File.class.getClassLoader().getResource("/Users/peti/Documents/workspace/java_workspace/BluesBox_v0_21/200_Stlye/resources/hmr.mid"); //File file = new File(url.getFile()); //File file = new File("/Users/peti/Documents/workspace/java_workspace/BluesBox_v0_21/200_Stlye/resources/hmr.mid"); //File file = new File("src/200_Stlye/resources/hmr.mid"); File file = new File("hmr.mid"); return file; } }
has title: Java - Cannot get MIDI file as resource
tagged with: classloader
tagged with: getresource
type: UnansweredQuestion
tagged with: java
tagged with: file
has answer: http://stackoverflow.com/a/22654542
type: Question

http://stackoverflow.com/q/22710118
tagged with: java
has comment: http://stackoverflow.com/comment/35830630
accepted answer: http://stackoverflow.com/a/23391318
type: Question
has comment: http://stackoverflow.com/comment/34648828
has comment: http://stackoverflow.com/comment/35831738
possible better answer: http://stackoverflow.com/a/22754094
has body: I believe I've seen all of the other posts on this issue. I think this is a different question because I am looking for a way to determine which class is causing the problem. I build my jar using Maven. If I ask it to build for Java 5 and I run it under Java 6 it works fine. If I ask it to build for Java 6 and I run it under Java 6 it works fine. If I ask it to build for Java 5 and I run it under Java 5 it fails: java.lang.RuntimeException: public static void ....main(java.lang.String[]) failed for arguments (String[]{...}) Caused by: java.lang.reflect.InvocationTargetException: ... Caused by: java.lang.UnsupportedClassVersionError: Bad version number in .class file at java.lang.ClassLoader.defineClass1(Native Method) ... I have inspected the jar using Java Version Check and it reports all classes in the jar as built for Java 5. I can only conclude that it is hacking its own classpath and linking up with some other library/jar on my machine that is not Java 5. This is quite possible but I do not have access to the source of that process and as far as I am aware I cannot single-step into the class loader to find out which class it is loading. Are there any techniques I can use that will help me work out which class is causing the exception?
has answer: http://stackoverflow.com/a/22754094
tagged with: class
answer count: 2
has comment: http://stackoverflow.com/comment/34605906
score: 3
has title: Bad version number in .class file - how to find which class it is
downvote count: 0
has answer: http://stackoverflow.com/a/23391318
has comment: http://stackoverflow.com/comment/34701279
has comment: http://stackoverflow.com/comment/34648476
favorite count: 0
has comment: http://stackoverflow.com/comment/34698912
type: AnsweredQuestion
upvote count: 3

http://stackoverflow.com/comment/34654530
type: Comment
type: QuestionComment
score: 0
has text: Have you checked the received json string ? is it a valid json string ?
comment on: http://stackoverflow.com/q/22737265

http://stackoverflow.com/q/22726240
has answer: http://stackoverflow.com/a/22726296
answer count: 2
upvote count: 0
has comment: http://stackoverflow.com/comment/34635572
has comment: http://stackoverflow.com/comment/34680235
has comment: http://stackoverflow.com/comment/34635454
favorite count: 0
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/22726460
score: -2
tagged with: recursion
tagged with: java
downvote count: 2
type: Question
has body: I need some help with a program for my programming class. It's a recursive program that takes a subtotal and a gratuity rate given by the user that outputs the full total and the gratuity cost. This is what I've got so far, and for some reason it just doesn't work: import java.io.*; import java.until.Scanner; public class gratuity { private double total; private double subTotal; private double gratRate; private double newSubTotal; private double newGratRate; public static void main(String[] args) { System.out.print("Enter the subtotal: "); System.out.print("Enter the gratuity rate: "); Scanner scan = new Scanner(System.in); Scanner myScan = new Scanner(System.in); double subtotal = scan.nextDouble(); double gratRate = myScan.nextDouble(); System.out.println("The Gratuity is: " + newSubtotal); System.out.println("The Total is: " + Total); } public static double computeGratRate() { double newGratRate = (gratRate/100); return newGratRAte; } public static double computeNewSub() { double newSubTotal - (subTotal * newGratRate); return newSubTotal; } public static double computeTotal() { double total = (newSubTotal + newGratRate); return total; } } If anyone would help me figure out how to fix it, I would be very grateful! Thank you!
has title: A recursive program to help calculate two values in Java

http://stackoverflow.com/comment/34714362
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/22770241
score: 0
has text: @ElliottFrisch I was just showing part of the code, I included the full if statement. I also made a slight edit to be above/equal to 1.

http://stackoverflow.com/q/22676296
type: Question
score: 0
answer count: 2
has comment: http://stackoverflow.com/comment/34545057
has title: Compiler error cannot find symbol in tester for investment class
tagged with: java
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/22677048
has body: This is my simple investment class that I have created along with a tester class. I dont know why the tester is giving me a error cannot find symbol for the tester. public class Investments { // instance variables private double moneyInvested; private double investRate; private int numOfYears; double amount; double rate; int time; public Investments(double moneyInvested, double investRate, int numOfYears) { this.amount = moneyInvested; this.rate = investRate; this.time = numOfYears; } public double ruleOf72() { return (72 / this.rate/100); } public int simpleAnnual() { return Math.round(this.amount * Math.pow(1 + this.rate/100, this.time)); } public int compoundAnnual() { return Math.round(this.amount * Math.pow((1 + this.rate/100) ^ this.time)); } } Tester: import java.util.Scanner; public class InvestmentsTester { public static void main(String[] args) { Scanner scanner = new Scanner(System.in); System.out.println("How much money do you plan on investing?"); double moneyInvested = scanner.nextDouble(); System.out.println("How many years do you plan to invest this money?"); int numOfYears = scanner.nextInt(); System.out.println("At what percent rate would you like to invest?"); double investRate = scanner.nextDouble(); System.out.println("At a " + investRate + "% annual interest rate it would take you" + ruleOf72 + "years for your investments to double"); System.out.println("Your simple annual interest after " + numOfYears + "years, with a initial investment of" + moneyInvested + "at" + investRate + "% will be worth:" + simpleAnnual); System.out.println("Your compound annual interest after " + numOfYears + "years, with a initial investment of" + moneyInvested + "at" + investRate + "% will be worth:" + compoundAnnual); } }
has answer: http://stackoverflow.com/a/22676378

http://stackoverflow.com/q/22742728
tagged with: field
has body: In the following code, field1 does not have a modifier: public/protected/private public class class1 { String field1; } So what is the modifier of field1? In the Modifier definition in Java, these are all the Modifiers that are relevant to a field: Modifier.PUBLIC | Modifier.PROTECTED | Modifier.PRIVATE | Modifier.STATIC | Modifier.FINAL | Modifier.TRANSIENT | Modifier.VOLATILE; Which of the modifier(s) does field1 have? I feel it does not have any of Modifier.PUBLIC,Modifier.PROTECTED, and Modifier.PRIVATE I ask this because I want to access this field one via Java reflection. Thanks. For the answers. It indeed has no modifier. I have tested getModifiers() for field1. It returns 0. Thanks.
has comment: http://stackoverflow.com/comment/34664240
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/22742798
tagged with: reflection
score: 1
tagged with: java
has answer: http://stackoverflow.com/a/22742868
possible better answer: http://stackoverflow.com/a/22742798
type: Question
has comment: http://stackoverflow.com/comment/34664159
tagged with: access-modifiers
has answer: http://stackoverflow.com/a/22742821
upvote count: 1
answer count: 4
has title: What is the default field Modifier in Java class?
favorite count: 0
has comment: http://stackoverflow.com/comment/34664194
has answer: http://stackoverflow.com/a/22742778
accepted answer: http://stackoverflow.com/a/22742778
has comment: http://stackoverflow.com/comment/34664383
downvote count: 0

http://stackoverflow.com/comment/34674659
score: 0
type: AnswerComment
has text: Thak you for your answer! Yes i don't change this list anywhere outside OrderScheduler, so i won't get this exception.
type: Comment
comment on: http://stackoverflow.com/a/22747674

http://stackoverflow.com/comment/34657439
type: QuestionComment
has text: Your linked list class is all jacked up to the point that you should completely start over. You need to review how to implement a LinkedList. For one this line makes absolutely no sense: `front = new linklist_MP(input, front);`. `front` is null, so you just set the "initiallink" to null in the `front` node. I don't know know what that's supposed to mean, but I'm quite sure it's not what you intended.
comment on: http://stackoverflow.com/q/22738820
score: 0
type: Comment

http://stackoverflow.com/a/22765172
upvote count: 3
answers question: http://stackoverflow.com/q/22765071
type: AcceptedAnswer
downvote count: 0
type: Answer
has comment: http://stackoverflow.com/comment/34705926
has body: Do something like this instead, with heldDown being a member variable: heldDown = true; do { ... } while (heldDown); Then, in the mouse released event: heldDown = false; That should do the trick.
accepted answer of: http://stackoverflow.com/q/22765071
score: 3

http://stackoverflow.com/q/22800087
tagged with: http://stackoverflow.com/tag/html
has answer: http://stackoverflow.com/a/22847380
tagged with: java
tagged with: mysql
type: Question
tagged with: servlets
has title: Send database data to a set html page
score: 0
has body: I'm building a dynamic web project using HTML, MYSql and Java Servlets and it is been run on tomcat server. Have everything working so far as storing and extracting from the DB. I am displaying back to a HTML web page using response.setContentType("text/html"); PrintWriter out = response.getWriter(); out.println(); but this creates a new web page each time and this is not what i want. What i want is to have the data sent back to a webpage in my site.. My question is: Is there a way to get the Servlet to send it back a set web page?? Thanks In Advance
answer count: 1
type: UnansweredQuestion

http://stackoverflow.com/comment/34542538
has text: But then "10, 9, 100" will sort as "10, 100, 9".
score: 0
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/22674773

http://stackoverflow.com/q/22668785
has title: Is SOAP always the message encoding in JAX-WS services?
type: Question
has answer: http://stackoverflow.com/a/22669414
has comment: http://stackoverflow.com/comment/34541773
has comment: http://stackoverflow.com/comment/34581717
upvote count: 1
answer count: 1
favorite count: 0
type: UnansweredQuestion
tagged with: soap
tagged with: web-services
has body: Does the encoding of a message in a JAX-WS service have to use SOAP? Or does JAX-WS simply define the interfaces/contracts (wsdl) but not the encoding?
has comment: http://stackoverflow.com/comment/34532690
downvote count: 0
score: 1
tagged with: java
tagged with: jax-ws

http://stackoverflow.com/a/22792679
upvote count: 1
has comment: http://stackoverflow.com/comment/34755418
has comment: http://stackoverflow.com/comment/34754528
has comment: http://stackoverflow.com/comment/34754919
downvote count: 0
score: 1
has body: Your error doesn't have anything to do with XML parsing. You have connection error. You are using localhost, which is the phone itself, of course it returns connection error. You probably meant your machine where you develop. If you want to refer to the computer which is running the Android simulator, use the IP address 10.0.2.2 instead. You can read more from here.
answers question: http://stackoverflow.com/q/22792607
has comment: http://stackoverflow.com/comment/34755264
type: Answer
has comment: http://stackoverflow.com/comment/34756182
has comment: http://stackoverflow.com/comment/34755680

http://stackoverflow.com/a/22784650
type: AcceptedAnswer
type: Answer
accepted answer of: http://stackoverflow.com/q/22784562
has body: I see three possible solutions: If you generate the internal properties randomly with java.util.Random and using the same seed (but two different Random objects), then the generated sequences will be identical, and so the objects. You can provide some method to copy the values from one object to the other, or just override clone() and create a clone of the first object. You can provide another constructor that takes the values from the outside, so you can generate them as you wish and inject them into the two objects.
answers question: http://stackoverflow.com/q/22784562
downvote count: 0
score: 1
upvote count: 1

http://stackoverflow.com/comment/34577085
type: AnswerComment
score: 0
has text: Glad, that helped you. This conflict was because the placeholderconfigurer (say p1) set in method is overriding the properties of the one(say p2) set in springConfigXml2.xml. p1 is being loaded before p2 by beanfactorypostprocessor and p1 is overwriting the properties in p2.
comment on: http://stackoverflow.com/a/22670040
type: Comment

http://stackoverflow.com/comment/34750219
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/22790501
has text: +1, I was writing pretty much the same thing - key being "smallest scope possible."
score: 0

http://stackoverflow.com/a/22749699
has comment: http://stackoverflow.com/comment/34677258
accepted answer of: http://stackoverflow.com/q/22749517
has comment: http://stackoverflow.com/comment/34677212
has comment: http://stackoverflow.com/comment/34677091
score: 0
type: AcceptedAnswer
answers question: http://stackoverflow.com/q/22749517
type: Answer
has body: It is generally good idea in programming, to seperate each logic part into seperate method (in more complex programs, you separate it into classes, components etc.). Then you can easily test each logic part separately, it is more reusable (using already existing methods), it is much more userfriendly (you just look to it and you see, aah, here I am doing "sumDigit"). This is working code : public class NthStrangePrime { public static void main(String args[]) { System.out.println("29 is : " + isStrangePrime(29)); System.out.println("13 is : " + isStrangePrime(13)); System.out.println("14 is : " + isStrangePrime(14)); System.out.println("15 is : " + isStrangePrime(15)); System.out.println("16 is : " + isStrangePrime(16)); System.out.println("17 is : " + isStrangePrime(17)); System.out.println("13th strange number is : " + nThStrangePrime(13)); } public static int nThStrangePrime(int n){ int strangePrimes = 0; int number = 2; while (strangePrimes != n){ if (isStrangePrime(number)){ strangePrimes++; System.out.println("This is a Strange Prime :"+number); } number++; } return number-1; } public static boolean isStrangePrime(int n) { while ((n &gt; 9) &amp;&amp; (isItPrime(n))){ n = sumDigit(n); } if ((n &lt;= 9) &amp;&amp; (isItPrime(n))){ return true; } else { return false; } } public static int sumDigit(int n) { int sum = 0; while (n &gt; 0) { sum += n % 10; n /= 10; } return sum; } public static boolean isItPrime(int n) { if (n &lt;= 1){ return false; } if (n == 2) { return true; } boolean isPrimeNumber = true; for (int i = 2; i &lt; n; i++) { if (n % i == 0) { isPrimeNumber = false; break; // exit the inner for loop } } return isPrimeNumber; } } Output for this code : 29 is : true 13 is : false 14 is : false 15 is : false 16 is : false 17 is : false This is a Strange Prime :2 This is a Strange Prime :3 This is a Strange Prime :5 This is a Strange Prime :7 This is a Strange Prime :11 This is a Strange Prime :23 This is a Strange Prime :29 This is a Strange Prime :41 T…

http://stackoverflow.com/a/22694158
has body: Coding style is like writing style. If you write in a style that is diFFicult TO READ And does not read very well your mINd hAs GReat diFFICULTies actUally understanding what you are reading. If, however, like in normal reading text - it is laid out in a form that matches well with what your mind expects then it is clear and easy to understand. On the other hand, if the language actually FORCED you to write everything using EXACTLY the the right syntax then not only would it make coding slow and awkward but it would restrict your expressiveness. Many years ago I came across a language that allowed you to add strange symbols to variable names. Users were allowed to do thing like: var a=b = a = b; var c&lt;d = c &gt; d; if ( a=b &amp; c&lt;d ) ... i.e. a=b was a perfectly acceptable variable name, so was c&lt;d. As I am sure you would agree, this led to many mistakes of interpretation. Even if a new language allowed that I would not use it. Coding standards are for consistency and helping the human mind understand, syntax is for helping the computer mind understand.
has comment: http://stackoverflow.com/comment/34576769
type: AcceptedAnswer
score: 4
has comment: http://stackoverflow.com/comment/34577354
answers question: http://stackoverflow.com/q/22693967
has comment: http://stackoverflow.com/comment/34577554
downvote count: 0
has comment: http://stackoverflow.com/comment/34576899
accepted answer of: http://stackoverflow.com/q/22693967
type: Answer
has comment: http://stackoverflow.com/comment/34577913
upvote count: 4

http://stackoverflow.com/comment/34901232
score: 0
type: AnswerComment
type: Comment
has text: for the original problem pre-hibernate 3 addition, can you post here the full stractrace with all caused by clauses, if 's too long could you use pastebin.com? That trace would give us which part of the program was trying to use a hibernate 3 class, this seems the best direction to solve the problem
comment on: http://stackoverflow.com/a/22872120

http://stackoverflow.com/comment/34710723
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/22768371
score: 0
has text: Do you really want to represent names by individual chars? I think you want your array to be of type String, not char.

http://stackoverflow.com/q/22734877
downvote count: 0
favorite count: 0
type: UnansweredQuestion
tagged with: android
tagged with: spring
has body: I have some difficulty (I just spent an afternoon above) to upload an image with a InputStreamResource, here is my current code : MultiValueMap&lt;String, Object&gt; parts = new LinkedMultiValueMap&lt;String, Object&gt;(); ByteArrayOutputStream bos = new ByteArrayOutputStream(); bitmap.compress(CompressFormat.PNG, 0, bos); bos.toByteArray(); ByteArrayInputStream bs = new ByteArrayInputStream(bos.toByteArray()); parts.add("photo", new InputStreamResource(bs)); HttpHeaders headers = new HttpHeaders(); headers.setContentType(MediaType.APPLICATION_FORM_URLENCODED); HttpEntity&lt;MultiValueMap&lt;String, Object&gt;&gt; request = new HttpEntity&lt;MultiValueMap&lt;String, Object&gt;&gt;(parts, headers); RestTemplate template = getRestTemplate(); template.setErrorHandler(new MyDefaultReponseErrorHandler()); template.getMessageConverters().add(new FormHttpMessageConverter()); return template.postForObject("http://bottlapp.cleverapps.io/api/pic", request, Result.class); and traces generated : 03-29 19:00:45.438: E//RequestRunner.java:134(18769): 19:00:45.454 Thread-28593 An exception occurred during request network execution :org.springframework.core.io.InputStreamResource cannot be cast to java.lang.String 03-29 19:00:45.438: E//RequestRunner.java:134(18769): java.lang.ClassCastException: org.springframework.core.io.InputStreamResource cannot be cast to java.lang.String Someone could help me ? Thanks you.
answer count: 0
score: 1
tagged with: java
upvote count: 1
type: Question
has title: Robospice - Upload InputStreamResource

http://stackoverflow.com/comment/34572628
has text: @user3149905: Are you saying that you supply the same path to FileReader() and FileInputStream(), and that the latter succeeds while the former fails? Are these separate programs you are running in separate environments by any chance?
comment on: http://stackoverflow.com/a/22677835
type: AnswerComment
score: 0
type: Comment

http://stackoverflow.com/a/22782808
has comment: http://stackoverflow.com/comment/34761454
has comment: http://stackoverflow.com/comment/34761498
has comment: http://stackoverflow.com/comment/34791835
has comment: http://stackoverflow.com/comment/34794550
has comment: http://stackoverflow.com/comment/34761581
has comment: http://stackoverflow.com/comment/34794319
accepted answer of: http://stackoverflow.com/q/22767701
has comment: http://stackoverflow.com/comment/34783820
has body: Immediate fix From documentation of SwingWorker Type Parameters: T - the result type returned by this SwingWorker's doInBackground and get methods V - the type used for carrying out intermediate results by this SwingWorker's publish and process methods So replace class Process extends SwingWorker&lt;String, String&gt; with class Process extends SwingWorker&lt;DefaultTableModel, Void&gt; Note: It's better if you rename your class from Process, there is already a class named [Process][2] in java. You have to pass the String via SwingWorker's constructor. (In this case, have it as a member of Process class and pass it in constructor. Calling the SwingWorker In your actionPerformed method, replace DefaultTableModel model = createModel(srtPath); with Process p = new Process(srtPath); p.extecute(); DefaultTableModel model = p.get(); // Rest of actionPerformed content. Doing it in background Now everything is working, but you have not achieved the desired effect. The ui thread is still waiting for the output. Make execute method last thing to do in actionPerformed method. (Ui thread will be released.) Everything else after getting returned DefaultModel should be put in overridden done method of SwingWorker (Process). (You need to pass required objects from constructor). @Override protected void done() { table.setModel(model); table.setFillsViewportHeight(true); table.setAutoResizeMode(JTable.AUTO_RESIZE_ALL_COLUMNS); TableColumn columnA = table.getColumn("#"); columnA.setMinWidth(10); columnA.setMaxWidth(40); TableColumn columnB= table.getColumn("Start"); columnB.setMinWidth(80); columnB.setMaxWidth(90); TableColumn columnC= table.getColumn("End"); columnC.setMinWidth(80); columnC.setMaxWidth(90); } You have to pass table object from constrictor of Process. Therefore in actionPerformed, Process p = new Process(srtPath, table); p.execute(); Hope this helps. Edit: Constructor would be like following. class Worker extends SwingWorker { private String srtPath; private JTable t…
has comment: http://stackoverflow.com/comment/34793358
has comment: http://stackoverflow.com/comment/34794523
has comment: http://stackoverflow.com/comment/34791029
has comment: http://stackoverflow.com/comment/34794796
score: 0
has comment: http://stackoverflow.com/comment/34763029
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/34794346
has comment: http://stackoverflow.com/comment/34792736
answers question: http://stackoverflow.com/q/22767701
type: Answer

http://stackoverflow.com/a/22656399
downvote count: 0
has comment: http://stackoverflow.com/comment/34509449
has body: If you use Java 7, you can use Files.probeContentType(). It is not lured by extensions... The JDK has a number of file formats recognized as a default; this may be enough for you. Otherwise, well, it is extensible! Usage: Files.probeContentType(file.toPath().toAbsolutePath())
type: Answer
has comment: http://stackoverflow.com/comment/34513517
has comment: http://stackoverflow.com/comment/134574959
upvote count: 3
score: 3
answers question: http://stackoverflow.com/q/22656157
has comment: http://stackoverflow.com/comment/34509641

http://stackoverflow.com/a/22731106
has body: private void display() { JFrame f = new JFrame("ImageShuffle"); f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); f.add(this); f.add(label); f.pack(); f.setLocationRelativeTo(null); f.setSize(x,y) f.setVisible(true); X is ur width and y ur height! If you write for example f.setSize(800,600); It should set the size when you insert it like I did! If you want to set the JLabel size it is like this: panelName.setSize(x,y); panelName.setVisible(true);
downvote count: 1
score: -1
upvote count: 0
type: Answer
has comment: http://stackoverflow.com/comment/34643772
answers question: http://stackoverflow.com/q/22731018

http://stackoverflow.com/a/33151737
has body: Download JDK 1.8 to resolve this issue. change the JAVA_HOME environment variables path to jdk_1.8. Right Click on the project folder which has the above mentioned compilation error and select properties. In Sources tab change the source/binary format to JDK 8. In libraries change Java Platform to JDK 1.8.
type: Answer
score: 0
answers question: http://stackoverflow.com/q/22686174

http://stackoverflow.com/a/22735334
score: 1
accepted answer of: http://stackoverflow.com/q/22734770
has body: Rewrite your code as follows : ObjectInputStream objectInput = new ObjectInputStream(sock.getInputStream()); Object objectFromClient = objectInput.readObject(); if (objectFromClient instanceof MyClass1) { } else if (objectFromClient instanceof MyClass2) { }// etc..
upvote count: 1
type: AcceptedAnswer
answers question: http://stackoverflow.com/q/22734770
type: Answer
downvote count: 0

http://stackoverflow.com/q/22666491
has title: Run a process once inside a loop without that process repeating until told to
has comment: http://stackoverflow.com/comment/34527476
score: 0
answer count: 2
tagged with: runnable
has answer: http://stackoverflow.com/a/22666870
has comment: http://stackoverflow.com/comment/34527553
has comment: http://stackoverflow.com/comment/34529705
tagged with: android
has comment: http://stackoverflow.com/comment/34527898
has body: I have an Android service that is creating quite a bug for me. It is a runnable with an if/else statement. Basically, I need it to continuously run a check and execute the if continuously. It does this flawlessly. I need it the execute the else just one time until it detects the if again. The problem I have is that it runs the else process in a loop also. How can I make the else statement run once while still detecting for the if? Heres a code example... if(mTimer != null) { mTimer.cancel(); } else { // recreate new mTimer = new Timer(); } // schedule task mTimer.scheduleAtFixedRate(new TimeDisplayTimerTask(), 0, NOTIFY_INTERVAL); } class TimeDisplayTimerTask extends TimerTask { @Override public void run() { // run on another thread mHandler.post(new Runnable() { @Override public void run() { // display toast if(musicActive) { // Set Ringer to vibrate } else { // Set Ringer to Normal } } }); } the problem is that when the service is running and music isnt detected, people are unable to change their ringer setting because my app is still holding it inside the service. If I leave the }else{ empty, I get my desired result, but I need it to run that process one time to set the ringer to normal. I just dont need it to set the ringer to normal once every second.
has comment: http://stackoverflow.com/comment/34532914
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/22667473
accepted answer: http://stackoverflow.com/a/22666870
has comment: http://stackoverflow.com/comment/34527670
tagged with: loops
possible better answer: http://stackoverflow.com/a/22667473
type: Question
has comment: http://stackoverflow.com/comment/34527839
tagged with: if-statement
tagged with: java

http://stackoverflow.com/q/22743765
possible better answer: http://stackoverflow.com/a/39660391
has answer: http://stackoverflow.com/a/50534923
favorite count: 0
has answer: http://stackoverflow.com/a/22744879
answer count: 3
accepted answer: http://stackoverflow.com/a/22744879
has body: e.g. class tester { @Test public void testBeanUtils() throws InvocationTargetException, IllegalAccessException, NoSuchMethodException { Stranger stranger = new Stranger(); BeanUtils.setProperty(stranger,"name","wener"); BeanUtils.setProperty(stranger,"xname","xwener"); BeanUtils.setProperty(stranger,"yname","ywener"); System.out.println(stranger); } @Data// lombok annotation generate all setter and getter public static class Stranger { @Accessors(chain = true)// generate chained setter String name; String xname; String yname; public Stranger setYname(String yname)// no lombok, still not work { this.yname = yname; return this; } } } My output: TestValues.Stranger(name=null, xname=xwener, yname=null) What's wrong with this? chain setter is a good thing. Any suggests ? EDIT Back to this problem again.This time I can not remove the Accessors chain. Now, I use the commons-lang3 to achieve. // force access = true is required Field field = FieldUtils.getField(bean.getClass(), attrName, true); field.set(bean,value); For those who got the same problem.
tagged with: chaining
has title: BeanUtils not works for chain setter
tagged with: apache-commons-beanutils
has answer: http://stackoverflow.com/a/39660391
type: AnsweredQuestion
tagged with: reflection
tagged with: java
score: 10
upvote count: 10
type: Question
tagged with: lombok
downvote count: 0

http://stackoverflow.com/q/22742612
tagged with: jlabel
type: Question
has title: Multiple threads used to update JLabels
answer count: 2
tagged with: multithreading
tagged with: swing
has answer: http://stackoverflow.com/a/22742721
has answer: http://stackoverflow.com/a/22743117
score: 0
tagged with: java
has comment: http://stackoverflow.com/comment/34675788
possible better answer: http://stackoverflow.com/a/22742721
has comment: http://stackoverflow.com/comment/34664812
has body: The following code is a simple JFrame with a button and two JLabels, the objective of the code is to update the ""number JLabel by invoking a new Thread, instead of trying to do it in the EDT. My problem is that the run method invokes a new thread each time you press the button, however, it does not cancel the old one. Therefore, if you press the button, and press it again a couple of seconds later you will have two threads updating the JLabel, and this looks crappy. PROBLEM STATEMENT: Every time You press the button, the counter has to start at 0, and the old thread that was updating it, has to be cancelled. import java.awt.Font; import java.awt.GridBagConstraints; import java.awt.GridBagLayout; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import java.util.List; import java.util.concurrent.ExecutionException; import javax.swing.JButton; import javax.swing.JFrame; import javax.swing.JLabel; import javax.swing.SwingUtilities; import javax.swing.SwingWorker; public class MainFrame extends JFrame { private JLabel countLabel1 = new JLabel("0"); private JLabel statusLabel = new JLabel("Task not completed."); private JButton startButton = new JButton("Start"); public MainFrame(String title) { super(title); setLayout(new GridBagLayout()); countLabel1.setFont(new Font("serif", Font.BOLD, 28)); GridBagConstraints gc = new GridBagConstraints(); gc.fill = GridBagConstraints.NONE; gc.gridx = 0; gc.gridy = 0; gc.weightx = 1; gc.weighty = 1; add(countLabel1, gc); gc.gridx = 0; gc.gridy = 1; gc.weightx = 1; gc.weighty = 1; add(statusLabel, gc); gc.gridx = 0; gc.gridy = 2; gc.weightx = 1; gc.weighty = 1; add(startButton, gc); startButton.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent arg0) { start(); } }); setSize(200, 400); setDefaultCloseOperation(EXIT_ON_CLOSE); setVisible(true); } private void start() { Thread worker = new Thread() { public void run() { // Simulate doing something useful. for(int i=0; i&lt;=10; i++) …
accepted answer: http://stackoverflow.com/a/22743117
has comment: http://stackoverflow.com/comment/34664077
type: AnsweredQuestion
linked to: http://stackoverflow.com/q/22603095
linked to: http://stackoverflow.com/q/37168031

eclipse
tags question: http://stackoverflow.com/q/22677815
tags question: http://stackoverflow.com/q/22741706
tags question: http://stackoverflow.com/q/22775605
tags question: http://stackoverflow.com/q/22749950
tags question: http://stackoverflow.com/q/22732530
tag name: eclipse
tags question: http://stackoverflow.com/q/22708452
tags question: http://stackoverflow.com/q/22676792
tags question: http://stackoverflow.com/q/22797337
tags question: http://stackoverflow.com/q/22791153
tags question: http://stackoverflow.com/q/22782671
tags question: http://stackoverflow.com/q/22714505
tags question: http://stackoverflow.com/q/22660063
tags question: http://stackoverflow.com/q/22706023
tags question: http://stackoverflow.com/q/22735089
tags question: http://stackoverflow.com/q/22671786
tags question: http://stackoverflow.com/q/22735340
tags question: http://stackoverflow.com/q/22674204
tags question: http://stackoverflow.com/q/22703039
tags question: http://stackoverflow.com/q/22731427
tags question: http://stackoverflow.com/q/22781437
tags question: http://stackoverflow.com/q/22744584
tags question: http://stackoverflow.com/q/22725122
tags question: http://stackoverflow.com/q/22708288
tags question: http://stackoverflow.com/q/22715894
tags question: http://stackoverflow.com/q/22674059
tags question: http://stackoverflow.com/q/22737265
tags question: http://stackoverflow.com/q/22708241
tags question: http://stackoverflow.com/q/22654041
tags question: http://stackoverflow.com/q/22664342
tags question: http://stackoverflow.com/q/22799658
tags question: http://stackoverflow.com/q/22760234
tags question: http://stackoverflow.com/q/22676371
tags question: http://stackoverflow.com/q/22776968
tags question: http://stackoverflow.com/q/22755503
tags question: http://stackoverflow.com/q/22795267
tags question: http://stackoverflow.com/q/22662069
tags question: http://stackoverflow.com/q/22785910
tags question: http://stackoverflow.com/q/22732312
tags question: http://stackoverflow.com/q/22801376
tags question: http://stackoverflow.com/q/22707501
tags question: http://stackoverflow.com/q/22769253
tags question: http://stackoverflow.com/q/22766272
tags question: http://stackoverflow.com/q/22778572
tags question: http://stackoverflow.com/q/22678042
tags question: http://stackoverflow.com/q/22707510
tags question: http://stackoverflow.com/q/22710942
tags question: http://stackoverflow.com/q/22767495
tags question: http://stackoverflow.com/q/22663917
tags question: http://stackoverflow.com/q/22808404
tags question: http://stackoverflow.com/q/22654031
tags question: http://stackoverflow.com/q/22753101
tags question: http://stackoverflow.com/q/22756779
tags question: http://stackoverflow.com/q/22703940
tags question: http://stackoverflow.com/q/22802193
tags question: http://stackoverflow.com/q/22754018
tags question: http://stackoverflow.com/q/22807811
tags question: http://stackoverflow.com/q/22707869
tags question: http://stackoverflow.com/q/22657601
tags question: http://stackoverflow.com/q/22805552
tags question: http://stackoverflow.com/q/22716471
tags question: http://stackoverflow.com/q/22724576
tags question: http://stackoverflow.com/q/22784284
tags question: http://stackoverflow.com/q/22777249
tags question: http://stackoverflow.com/q/22765189
tags question: http://stackoverflow.com/q/22675723
tags question: http://stackoverflow.com/q/22755551
tags question: http://stackoverflow.com/q/22662285
tags question: http://stackoverflow.com/q/22701853
tags question: http://stackoverflow.com/q/22779135
tags question: http://stackoverflow.com/q/22716097
tags question: http://stackoverflow.com/q/22807059
tags question: http://stackoverflow.com/q/22712815
tags question: http://stackoverflow.com/q/22757455
tags question: http://stackoverflow.com/q/22730437
tags question: http://stackoverflow.com/q/22779014
tags question: http://stackoverflow.com/q/22745474
tags question: http://stackoverflow.com/q/22748750
tags question: http://stackoverflow.com/q/22797605
tags question: http://stackoverflow.com/q/22797521

http://stackoverflow.com/q/22753235
score: -2
tagged with: string
favorite count: 0
answer count: 1
has comment: http://stackoverflow.com/comment/34684800
has comment: http://stackoverflow.com/comment/34725876
upvote count: 0
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/22828078
has comment: http://stackoverflow.com/comment/34683456
has title: String Normalization in Java
has comment: http://stackoverflow.com/comment/34685707
has comment: http://stackoverflow.com/comment/34719770
has comment: http://stackoverflow.com/comment/34724662
has comment: http://stackoverflow.com/comment/34684076
tagged with: java
has body: I am trying to write a program the reads words from a text file and inserts the uniquely into an array while keeping a separate count for each word. Also I need to strip off the punctuation and move all the letters to lowercase. Can anyone please help it will be greatly appreciated. import java.util.Scanner; import java.io.*; public class text { public static void main (String [] args){ try { String currentWord,normalizedWord; String word [] = new String [1000]; int freq [] = new int [1000]; int wCnt = 0; int loc; Scanner kb = new Scanner(System.in); //get the name of the file System.out.print("Enter the name of a file:"); String filename = kb.nextLine(); //Open file File file = new File(filename); Scanner inputFile = new Scanner(file); while(inputFile.hasNext()){ currentWord = inputFile.next(); normalizedWord = normalize(currentWord); System.out.println("The normalized word is: " + normalizedWord); loc = search(word,wCnt,normalizedWord); print(word,wCnt); if(loc == -1){ insertUnique(word, freq, wCnt, normalizedWord); freq[loc]++; wCnt++; } else freq[loc]++; } } catch (FileNotFoundException e){ System.out.println(e.getMessage()); System.exit(0); } } public static void print(String[] word, int wCnt) { System.out.print("{ "); for (int i=0; i &lt; wCnt; i++) System.out.print(word[i] + " , "); System.out.print("}"); } public static int search(String[] word, int wCnt, String normalizedWord) { for (int i = 0; i &lt; wCnt; i++){ if (word[i]==normalizedWord) return i; } return -1; } public static int insertUnique(String[] word, int[] freq, int wCnt, String normalizedWord) { if(!isIn(word,wCnt,normalizedWord)){ word[wCnt] = normalizedWord; wCnt++; } return wCnt; } public static boolean isIn(String[] word, int wCnt, String normalizedWord) { for (int i = 0; i &lt; wCnt; i++){ if(word[i]== normalizedWord) return true; } return false; } public static String normalize(String wrd) { if (wrd.charAt(0) == '"' ) wrd = wrd.substring(1); int wrdLength = wrd.length(); //To remove all pu…
has comment: http://stackoverflow.com/comment/34684096
type: Question
has comment: http://stackoverflow.com/comment/34812188
tagged with: normalization
downvote count: 2

http://stackoverflow.com/comment/34553943
has text: And - as static methods are bound at compile time - final does not do anything to static methods.
comment on: http://stackoverflow.com/a/22681474
score: 0
type: AnswerComment
type: Comment

http://stackoverflow.com/comment/34539948
type: Comment
has text: The ref (or fragment) is indicated with '#' sign. The fragment is located after the query (if a query is present). Whether the OP wants to keep the ref is questionable. Example: `http://my.site.org:8080/search?query#ref`
comment on: http://stackoverflow.com/a/22672662
type: AnswerComment
score: 0

http://stackoverflow.com/comment/34599979
comment on: http://stackoverflow.com/a/22706818
type: Comment
has text: The increment() method is called from a critical thread many times, so I was trying to avoid at all costs to introduce latency by making a volatile write instead of a non-volatile write.
score: 0
type: AnswerComment

http://stackoverflow.com/comment/34611224
has text: http://stackoverflow.com/questions/3469507/how-can-i-change-the-date-format-in-java
type: Comment
comment on: http://stackoverflow.com/q/22713187
score: 0
type: QuestionComment

http://stackoverflow.com/comment/34638758
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/22728026
score: 0
has text: hey tell me how to convert time into TIMESTAMP for storing in database.thanks

http://stackoverflow.com/comment/34746261
type: AnswerComment
score: 0
type: Comment
comment on: http://stackoverflow.com/a/22761171
has text: Thanks @geoand I am often so busy that I do not have time to read the documentation, thank for reading it for me :) it works

http://stackoverflow.com/comment/34712899
type: Comment
has text: Interesting enough, I tried that and still no go. My tally array still reads from its created values [ 0 0 0 0 0 0].
comment on: http://stackoverflow.com/a/22768699
type: AnswerComment
score: 0

http://stackoverflow.com/comment/34518076
type: QuestionComment
comment on: http://stackoverflow.com/q/22661469
score: 0
has text: Why would you want to do that?
type: Comment

http://stackoverflow.com/a/22685841
accepted answer of: http://stackoverflow.com/q/22685651
has comment: http://stackoverflow.com/comment/34579083
has comment: http://stackoverflow.com/comment/34579502
type: Answer
upvote count: 3
has comment: http://stackoverflow.com/comment/34561374
has comment: http://stackoverflow.com/comment/34561487
score: 3
answers question: http://stackoverflow.com/q/22685651
has comment: http://stackoverflow.com/comment/34582791
type: AcceptedAnswer
downvote count: 0
has body: You should also import java.sql.ResultSet class in your JSP : &lt;%@ page import="java.sql.ResultSet" %&gt; make sure that you included the jdbc JAR. PS: You should learn how to organize your code , never access database through JSP,Read more about RequestDispatcher,request.setAttribute..., Google about MVC.

http://stackoverflow.com/a/22755494
has body: You can declare array of size 10,000 and init the array in away that each cell in the array will holds the value of it's index: int [] arr= new int[10000]; for (int i=0 i &lt; arr.length; i++){ arr[i] = i } Now you can shuffle the array using java Collections. and take the first 1000 items from the array and sort then using java sort.
downvote count: 0
has comment: http://stackoverflow.com/comment/34687592
type: Answer
has comment: http://stackoverflow.com/comment/34687834
answers question: http://stackoverflow.com/q/22755367
upvote count: 1
score: 1

http://stackoverflow.com/comment/34611036
score: 0
comment on: http://stackoverflow.com/q/22691804
type: Comment
type: QuestionComment
has text: Agree, this does not look like a Camel issue.

http://stackoverflow.com/a/22779379
has body: You said that multiple threads are accessing this map. This could indeed cause the NPE in the remove operation of a LinkedHashMap.Entry instance. This is the implementation of this method: private void remove() { before.after = after; after.before = before; } Here before and after refer to the linked predecessor and successor of the current entry. If another thread already changed the linking between the entries, this could of course result in an unexpected behavior, such as the NPE. The solution is - you guessed correctly - to wrap your produced map in a synchronized map. Such as: public static &lt;K, V&gt; Map&lt;K, V&gt; createLRUMap(final int maxEntries) { Map&lt;K,V&gt; result = new LinkedHashMap&lt;K, V&gt;(maxEntries*3/2, 0.7f, true) { @Override protected boolean removeEldestEntry(Map.Entry&lt;K, V&gt; eldest) { return size() &gt; maxEntries; } }; return Collections.synchronizedMap(result); } This synchronized wrapper will indeed synchronize all calls to the underlying map, so only one single thread is allowed to go through each method (such as get, put, contains, size, and so on).
upvote count: 1
answers question: http://stackoverflow.com/q/22778981
score: 1
accepted answer of: http://stackoverflow.com/q/22778981
type: AcceptedAnswer
downvote count: 0
type: Answer
has comment: http://stackoverflow.com/comment/34730545

http://stackoverflow.com/comment/109744696
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/22656615
has text: you can see the documentation of selenium and for real-time example, I would like to refer: https://asktofolks.com/603/difference-between-implicit-explicit-selenium-webdriver

http://stackoverflow.com/comment/34762616
has text: won't the best move differ depending on which player it is ?
type: AnswerComment
score: 0
comment on: http://stackoverflow.com/a/22776707
type: Comment

http://stackoverflow.com/q/22802193
type: AnsweredQuestion
tagged with: java
tagged with: eclipse
downvote count: 1
accepted answer: http://stackoverflow.com/a/27740511
type: Question
has title: The call is answered by another phone, audio file has to be played and second phone will hear the audio then audio file
has comment: http://stackoverflow.com/comment/34771417
has body: Dial a number that will given in code itself. Once the call is answered by another phone, audio file has to be played so that the second phone will hear the audio. After the audio file playing is complete, disconnect the line.
has comment: http://stackoverflow.com/comment/34819673
has comment: http://stackoverflow.com/comment/34771548
answer count: 2
upvote count: 0
favorite count: 0
score: -1
has answer: http://stackoverflow.com/a/27740511
tagged with: android
possible better answer: http://stackoverflow.com/a/22802340
has answer: http://stackoverflow.com/a/22802340

http://stackoverflow.com/a/22698282
score: 0
has body: In this line, you are declaring a "File" variable that hides java.io.File: Scanner File = new Scanner(new File(filename)); //reads filename into program,and opens it for analysis All the subsequent uses of "File" will refer to your local variable, not to java.io.File. You should use different name for you local variable. Also, the standard naming convention for Java is to name variables starting with a lower case character, so you should do that so that you do not confuse and annoy other Java programmers.
has comment: http://stackoverflow.com/comment/34584491
has comment: http://stackoverflow.com/comment/34585457
type: Answer
has comment: http://stackoverflow.com/comment/34584825
has comment: http://stackoverflow.com/comment/34585256
has comment: http://stackoverflow.com/comment/34585541
answers question: http://stackoverflow.com/q/22698102
has comment: http://stackoverflow.com/comment/34584874
has comment: http://stackoverflow.com/comment/34584895
has comment: http://stackoverflow.com/comment/34585165

http://stackoverflow.com/a/22735247
score: 5
type: AcceptedAnswer
downvote count: 0
type: Answer
has comment: http://stackoverflow.com/comment/34651303
accepted answer of: http://stackoverflow.com/q/22735090
has body: You likely need to call the has() method prior to calling getString to avoid the exception. But there's an even simpler way - just use the optString instead of getString, which will return the "fallback" string if the value does not exist. String name = location.optString("name", "No Place"); String address = location.optString("address", "No Address"); String city = location.optString("city", "No City");
upvote count: 5
answers question: http://stackoverflow.com/q/22735090

http://stackoverflow.com/a/22716120
has comment: http://stackoverflow.com/comment/34624362
type: AcceptedAnswer
type: Answer
accepted answer of: http://stackoverflow.com/q/22715833
answers question: http://stackoverflow.com/q/22715833
score: 2
downvote count: 0
has body: You should run your code in the event dispatch thread. As you can read in Oracle documentation: http://docs.oracle.com/javase/tutorial/uiswing/concurrency/dispatch.html You can use Swing classes outside EDT only if they are marked as thread safe in the documentation.
upvote count: 2

http://stackoverflow.com/comment/34587170
type: Comment
comment on: http://stackoverflow.com/a/22699382
has text: Now this answer looks good :-) I guess you should have now learnt 3 possible ways of how to implement ClickListeners ;-) @user3470343
score: 0
type: AnswerComment

http://stackoverflow.com/comment/34681415
type: AnswerComment
has text: There is a discussion of this situation in the [JPA spec] (http://jcp.org/aboutJava/communityprocess/final/jsr338/index.html). See section 2.4.1.
type: Comment
comment on: http://stackoverflow.com/a/22742220
score: 0

http://stackoverflow.com/q/22772492
score: 1
tagged with: java
has title: Struts2: issue with loading the resource file
tagged with: jboss
has body: I encountered the problem of loading resource file. I have two applications (1 ear with 1 war inside + 1 separate war). Both apps have struts.xml and both have own resource files. I use struts.custom.i18n.resources to load the resources. When I url to first app, resource file loads fine. However second app does not load its own resource file. Server (JBOSS) gets lots of warnings: The default value expression ... was evaluated and did not match a property. If I change struts.devMode to true then everything works fine. Please advise.
type: Question
downvote count: 0
tagged with: struts2
upvote count: 1
favorite count: 0
answer count: 0
type: UnansweredQuestion

http://stackoverflow.com/q/22727212
tagged with: java
has body: am studying java got stuck here please help me out also this are interview questions it-seems 1)Abstract class : i know abstract classes have empty methods and full defined methods but am not able to understand what actually empty method means. please give a example to understand the same. 2) what is the main difference between abstract class and normal class? 3) interface : interface also have empty methods, the what is the difference between interface and abstract class? please give any real time example to understand, tried lot of theory to understand but it was not clear
linked to: http://stackoverflow.com/q/1320745
has comment: http://stackoverflow.com/comment/34637144
type: Question
linked to: http://stackoverflow.com/q/1913098
score: -1
has comment: http://stackoverflow.com/comment/34637436
tagged with: class
has comment: http://stackoverflow.com/comment/34637347
tagged with: abstract
has comment: http://stackoverflow.com/comment/34637417
answer count: 1
downvote count: 1
has comment: http://stackoverflow.com/comment/34637432
favorite count: 0
has title: Abstract class ,class, interface
tagged with: interface
has answer: http://stackoverflow.com/a/22727231
accepted answer: http://stackoverflow.com/a/22727231
has comment: http://stackoverflow.com/comment/34637426
type: AnsweredQuestion
upvote count: 0
linked to: http://stackoverflow.com/q/761194

http://stackoverflow.com/a/22724056
downvote count: 0
has body: I think an easy way to do this would be to read it as an Image and then write it to the new folder using ImageIO.read(...) and ImageIO.write(...). I don't think Images have metadata. If that doesn't work, you could write it as a bmp, then reread it and write it again as a jpeg.
answers question: http://stackoverflow.com/q/22722652
type: Answer
score: 2
upvote count: 2

http://stackoverflow.com/a/22775026
answers question: http://stackoverflow.com/q/22774996
has body: use android:hint="@string/answer_hint" in your XML
score: 0
type: Answer

http://stackoverflow.com/q/22710608
score: 0
has comment: http://stackoverflow.com/comment/34610706
has comment: http://stackoverflow.com/comment/34606853
has comment: http://stackoverflow.com/comment/34607027
has comment: http://stackoverflow.com/comment/34606832
has comment: http://stackoverflow.com/comment/34608048
has comment: http://stackoverflow.com/comment/34607933
tagged with: java
has body: I have a client server architecture in Java in which I need to place a loop. I've spent some time to think about where to put this loop, but anywhere I tried it did not get the result expected. Here is my client.java : public class Client { private static Scanner scanner; public static void main(String[] args) throws IOException { scanner = new Scanner(System.in); // set up server communication Socket clientSocket = new Socket(InetAddress.getLocalHost(), 1234); BufferedReader in = new BufferedReader(new InputStreamReader(clientSocket.getInputStream())); PrintWriter out = new PrintWriter(clientSocket.getOutputStream()); System.out.println("Enter pin : "); String password = scanner.next(); // send PIN to server out.println(password); out.flush(); // get response from server String response = in.readLine(); System.out.println(response); scanner.close(); in.close(); out.close(); clientSocket.close(); } } Here is my server.java : public class Server { private static ServerSocket server; public static void main(String[] args) throws Exception { server = new ServerSocket(1234); Socket socket = server.accept(); BufferedReader in = new BufferedReader(new InputStreamReader( socket.getInputStream())); PrintWriter out = new PrintWriter(socket.getOutputStream()); // Listen for client requests: String request = in.readLine(); while (request != null) { // check PIN, send result boolean pinCorrect = checkPin(request); out.println(pinCorrect ? ":)" : ":("); out.flush(); } out.close(); in.close(); socket.close(); } } I need to repeat this process if the user does not enter exactly 4 digits, so I've been thinking of a do{}while(pinSize != 4) loop. But when I place it in the Server I always have the wrong output ":)" or ":(" instead of just "Pin must be 4 digits", then I tried to put in the Client part, but this time I always had the possibility to enter only one pin so the loop did not work that much. Actually this is some code I would put into my loop: if (pinSize != 4) { System.out.…
type: Question
has answer: http://stackoverflow.com/a/23043538
tagged with: client-server
answer count: 1
has comment: http://stackoverflow.com/comment/34606951
has title: Where to place my loop for better results in Client-Server architecture in Java?
has comment: http://stackoverflow.com/comment/34606836
has comment: http://stackoverflow.com/comment/34606775
tagged with: sockets
has comment: http://stackoverflow.com/comment/34607317
type: UnansweredQuestion

http://stackoverflow.com/a/22665634
downvote count: 0
has body: Google has developed a version of it here. This has been done using generics, you can do it too using Generics.
type: Answer
has comment: http://stackoverflow.com/comment/34565634
upvote count: 2
accepted answer of: http://stackoverflow.com/q/22665316
answers question: http://stackoverflow.com/q/22665316
score: 2
type: AcceptedAnswer

http://stackoverflow.com/q/22746985
tagged with: java
has comment: http://stackoverflow.com/comment/34672062
type: Question
has comment: http://stackoverflow.com/comment/34672841
has comment: http://stackoverflow.com/comment/34672152
has comment: http://stackoverflow.com/comment/34672109
tagged with: arrays
tagged with: sorting
possible better answer: http://stackoverflow.com/a/22750087
has title: Java Sudoku Squares 3x3 Checking Validity
has comment: http://stackoverflow.com/comment/34671994
answer count: 3
downvote count: 0
has comment: http://stackoverflow.com/comment/34672184
has comment: http://stackoverflow.com/comment/34673004
favorite count: 0
has answer: http://stackoverflow.com/a/72760356
tagged with: multidimensional-array
has comment: http://stackoverflow.com/comment/34672941
has comment: http://stackoverflow.com/comment/34673038
has body: I'm working on a Java program that checks if a sudoku puzzle is solved or not. I have finished the horizontal and vertical number check part. But when trying to check squares, I can't do anything. Here is how my check system works. This is what I want to make. Hope someone helps because I'm on a hard situation with square check. int[][] SudokuBoard = new int[9][9]; // I didn't wrote the sudoku board completely hope you understood how sudoku table looks like. public static boolean checkSquares(int[][] SquareBoard) { int retr = false; int loop = 0; int[] extraboard = new int[9]; int[] truelist ={1,2,3,4,5,6,7,8,9}; for(int i = 1; i &lt;=9 ; I++) { //here , extraboard will have the numbers in " i " numbered sudoku square.( i is like first //,second) Arrays.sort(extraboard); for(int j = 0; j &lt; 9; j++) { if(extraboard[j] == truelist[j]) loop += 1; } extraboard = new int[9]; } if(loop == 81) retr == true; return retr; }
upvote count: 1
has answer: http://stackoverflow.com/a/22750087
has comment: http://stackoverflow.com/comment/34672120
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/22747988
accepted answer: http://stackoverflow.com/a/22747988
score: 1

mysql
tags question: http://stackoverflow.com/q/22669770
tags question: http://stackoverflow.com/q/22790021
tags question: http://stackoverflow.com/q/22741446
tags question: http://stackoverflow.com/q/22785117
tags question: http://stackoverflow.com/q/22791883
tags question: http://stackoverflow.com/q/22743805
tags question: http://stackoverflow.com/q/22689012
tags question: http://stackoverflow.com/q/22671024
tags question: http://stackoverflow.com/q/22699930
tags question: http://stackoverflow.com/q/22736769
tags question: http://stackoverflow.com/q/22759223
tags question: http://stackoverflow.com/q/22800087
tags question: http://stackoverflow.com/q/22746405
tags question: http://stackoverflow.com/q/22789218
tag name: mysql
tags question: http://stackoverflow.com/q/22664284
tags question: http://stackoverflow.com/q/22743497
tags question: http://stackoverflow.com/q/22761980
tags question: http://stackoverflow.com/q/22687027
tags question: http://stackoverflow.com/q/22656237
tags question: http://stackoverflow.com/q/22768632
tags question: http://stackoverflow.com/q/22688848
tags question: http://stackoverflow.com/q/22793638
tags question: http://stackoverflow.com/q/22685382
tags question: http://stackoverflow.com/q/22648737
tags question: http://stackoverflow.com/q/22736995
tags question: http://stackoverflow.com/q/22670027
tags question: http://stackoverflow.com/q/22696902
tags question: http://stackoverflow.com/q/22735038
tags question: http://stackoverflow.com/q/22732530
tags question: http://stackoverflow.com/q/22755795
tags question: http://stackoverflow.com/q/22791911
tags question: http://stackoverflow.com/q/22765655
tags question: http://stackoverflow.com/q/22792711
tags question: http://stackoverflow.com/q/22784271
tags question: http://stackoverflow.com/q/22750141
tags question: http://stackoverflow.com/q/22779313
tags question: http://stackoverflow.com/q/22806770
tags question: http://stackoverflow.com/q/22677153
tags question: http://stackoverflow.com/q/22791446
tags question: http://stackoverflow.com/q/22684459
tags question: http://stackoverflow.com/q/22782683
tags question: http://stackoverflow.com/q/22676191
tags question: http://stackoverflow.com/q/22808507
tags question: http://stackoverflow.com/q/22663816
tags question: http://stackoverflow.com/q/22740242
tags question: http://stackoverflow.com/q/22766967
tags question: http://stackoverflow.com/q/22649228
tags question: http://stackoverflow.com/q/22767888
tags question: http://stackoverflow.com/q/22748700
tags question: http://stackoverflow.com/q/22694899
type: Tag
tags question: http://stackoverflow.com/q/22678567
tags question: http://stackoverflow.com/q/22738525
tags question: http://stackoverflow.com/q/22779520
tags question: http://stackoverflow.com/q/22785838
tags question: http://stackoverflow.com/q/22748217
tags question: http://stackoverflow.com/q/22657968
tags question: http://stackoverflow.com/q/22769559
tags question: http://stackoverflow.com/q/22713187
tags question: http://stackoverflow.com/q/22805332
tags question: http://stackoverflow.com/q/22728129
tags question: http://stackoverflow.com/q/22754212
tags question: http://stackoverflow.com/q/22752351
tags question: http://stackoverflow.com/q/22808066
tags question: http://stackoverflow.com/q/22673588
tags question: http://stackoverflow.com/q/22803317
tags question: http://stackoverflow.com/q/22665392
tags question: http://stackoverflow.com/q/22661849
tags question: http://stackoverflow.com/q/22732656
tags question: http://stackoverflow.com/q/22790050
tags question: http://stackoverflow.com/q/22742016
tags question: http://stackoverflow.com/q/22717159
tags question: http://stackoverflow.com/q/22731157
tags question: http://stackoverflow.com/q/22683933
tags question: http://stackoverflow.com/q/22675839
tags question: http://stackoverflow.com/q/22662241
tags question: http://stackoverflow.com/q/22704423
tags question: http://stackoverflow.com/q/22648799
tags question: http://stackoverflow.com/q/22797246

http://stackoverflow.com/q/22791027
downvote count: 1
type: Question
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/22791349
accepted answer: http://stackoverflow.com/a/22791349
has title: Why can't I change my actionbar text color?
score: -1
upvote count: 0
answer count: 1
favorite count: 0
tagged with: colors
tagged with: android
tagged with: android-actionbar
has body: I used this generator to create a custom theme for my app: http://jgilfelt.github.io/android-actionbarstylegenerator/ But there is one thing that i want to change, that this generator does not support: The textcolor of the actionbar. I tried doing this manually with this code: But the textcolor of my actionbar remains unchanged. Any tips? Update:
tagged with: tabs
tagged with: java

http://stackoverflow.com/q/22657468
has body: My ResultSet is fetching only 7500 rows, but I want to fetch all my rows which are available in the database table. For this I used resultset.setFetchSise(100000), even though it is fetching only 7500 rows. I would happy if any body help me in this regard.
downvote count: 0
answer count: 1
has comment: http://stackoverflow.com/comment/34515014
favorite count: 0
has comment: http://stackoverflow.com/comment/34511306
tagged with: jdbc
has comment: http://stackoverflow.com/comment/34512789
upvote count: 2
type: UnansweredQuestion
has title: My ResultSet is fetching only 7500 rows, but I want to fetch all my rows which are available in database table
has answer: http://stackoverflow.com/a/22658550
has comment: http://stackoverflow.com/comment/34511732
score: 2
tagged with: java
type: Question
has comment: http://stackoverflow.com/comment/34514803

http://stackoverflow.com/a/22807590
has comment: http://stackoverflow.com/comment/34782364
answers question: http://stackoverflow.com/q/22807527
has comment: http://stackoverflow.com/comment/34786969
has comment: http://stackoverflow.com/comment/34787015
has comment: http://stackoverflow.com/comment/34789096
has comment: http://stackoverflow.com/comment/34795586
type: Answer
upvote count: 1
has comment: http://stackoverflow.com/comment/34787681
has comment: http://stackoverflow.com/comment/34781908
has comment: http://stackoverflow.com/comment/34789143
has comment: http://stackoverflow.com/comment/34784440
has comment: http://stackoverflow.com/comment/34788303
has comment: http://stackoverflow.com/comment/34784822
score: 1
has comment: http://stackoverflow.com/comment/34785093
has comment: http://stackoverflow.com/comment/34794074
has comment: http://stackoverflow.com/comment/34782790
has comment: http://stackoverflow.com/comment/34794333
has comment: http://stackoverflow.com/comment/34785195
accepted answer of: http://stackoverflow.com/q/22807527
has comment: http://stackoverflow.com/comment/34794382
has comment: http://stackoverflow.com/comment/34782089
has comment: http://stackoverflow.com/comment/34783180
has comment: http://stackoverflow.com/comment/34793871
has comment: http://stackoverflow.com/comment/34785305
has comment: http://stackoverflow.com/comment/34794786
has comment: http://stackoverflow.com/comment/34794861
has body: Use HtmlUnit or HtmlUnitDriver by Selenium WebDriver driver = new HtmlUnitDriver(BrowserVersion.FIREFOX_17); driver.get("http://www.upmandiparishad.in/commodityWiseAll.aspx"); System.out.println(driver.getPageSource()); Thread.sleep(5000); // select barge new Select(driver.findElement(By.id("ctl00_ContentPlaceHolder1_ddl_commodity"))).selectByVisibleText("Jo"); String sDate = "12/04/2014"; //What date you want driver.findElement(By.id("ctl00_ContentPlaceHolder1_txt_rate")).sendKeys(sDate); driver.findElement(By.id("ctl00_ContentPlaceHolder1_btn_show")).click(); Thread.sleep(3000); //get only table tex WebElement findElement = driver.findElement(By.id("ctl00_ContentPlaceHolder1_GridView1")); String htmlTableText = findElement.getText(); // do whatever you want now, This is raw table values. System.out.println(htmlTableText); driver.close(); driver.quit(); To get tabular output, you can try something like this.. String arrCells[] = htmlTableText.split(" "); Boolean bIsANumber = false; for(int i = 0; i &lt; arrCells.length; i++) { try { int tmp = Integer.parseInt(arrCells[i]); bIsANumber = true; } catch(Exception ex) { bIsANumber = false; } if(bIsANumber) { System.out.print("\n"+arrCells[i]+"\t"); } else { System.out.print(arrCells[i]+"\t"); } }
type: AcceptedAnswer
downvote count: 0

http://stackoverflow.com/a/22687117
score: 0
has body: I tried following method to update the table from java end it works. StringBuilder sb = new StringBuilder(128); sb.append("update newtable set "); for(int g=0;g&lt;valAry.size();g++){ sb.append("val1 =").append(valAry.get(g)).append(", min_val1 = IF (min_val1 &lt;").append(valAry.get(g)).append(", min_val1 , ").append(valAry.get(g)).append(") , max_val1 = IF (max_val1 &gt; ").append(valAry.get(g)).append(", max_val1 , ").append(valAry.get(g)).append("),"); } sb.append("time_stamp = '").append(time_stamp).append("' where id = 1");
type: AcceptedAnswer
type: Answer
answers question: http://stackoverflow.com/q/22684459
accepted answer of: http://stackoverflow.com/q/22684459

http://stackoverflow.com/comment/34741532
type: Comment
comment on: http://stackoverflow.com/a/22779539
score: 0
type: AnswerComment
has text: Awesome! This worked. Do you know where I can find information to answer such questions? The Mule docs don't seem to cover this sort of issues.

http://stackoverflow.com/q/22678169
type: Question
has answer: http://stackoverflow.com/a/22678272
tagged with: mutators
has comment: http://stackoverflow.com/comment/34548339
has title: Issues using String data type in my constructor, application file not running properly
score: 0
has body: So i've been messing around with String data types in the constructor of my class file, and while everything compiles correctly, when I run the application file, the program doesn't give the desired result. I kept it short to see if it would work, so my class file is as follows: public class StringPractice { private String color; private String brand; public StringPractice() { String color = ""; String brand = ""; } public StringPractice(String clor, String brnd) { setColor(clor); setBrand(brnd); } public void setColor(String clor) { if (clor.equalsIgnoreCase("Red")) { color = clor; } else { System.out.println("We dont't carry that color"); } } public void setBrand(String brnd) { if (brnd.equalsIgnoreCase("Gibson")) { brand = brnd; } else { System.out.println("We do not carry that brand"); } } public String getColor() { return color; } public String getBrand() { return brand; } public void display() { System.out.println("Our brands are: " + brand + "Our colors are: " + color); } My application file is as follows: import java.util.Scanner; public class UseStringPractice { public static void main(String[] args) { String brand = ""; String color = ""; Scanner keyboard = new Scanner(System.in); StringPractice Guitar1; System.out.println("Please enter the brand you would like"); brand = keyboard.next(); System.out.println("Please enter the color you would like"); color = keyboard.next(); Guitar1 = new StringPractice(brand, color); Guitar1.display(); } } What am I doing incorrectly? Am I using the wrong methods to parse the information from scanner? Or am I using equalsIgnoreCase incorrectly? This is my first attempt at implementing these methods, so I may be wayyy off for all I know. When I run the application class, my result is that of the trailing else clause, or, "We do not carry those brands" or "We don't carry that color". Then, in my display statement, the variable names are replaced with "null". This is all for practice so any insight would be fantastic. Thanks!
answer count: 1
accepted answer: http://stackoverflow.com/a/22678272
tagged with: constructor
has comment: http://stackoverflow.com/comment/34548403
has comment: http://stackoverflow.com/comment/34548446
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/34548278
tagged with: accessor
tagged with: java
has comment: http://stackoverflow.com/comment/34548264
has comment: http://stackoverflow.com/comment/34548359

runtime
tags question: http://stackoverflow.com/q/22793892
tags question: http://stackoverflow.com/q/22762884
type: Tag
tag name: runtime
tags question: http://stackoverflow.com/q/22780786
tags question: http://stackoverflow.com/q/22664788
tags question: http://stackoverflow.com/q/22802323
tags question: http://stackoverflow.com/q/22728870

http://stackoverflow.com/a/22749561
upvote count: 3
answers question: http://stackoverflow.com/q/22749460
score: 3
has body: A private field cannot be accessed in a sub-class but is can be accessed in an inner class. So if you have int i; // in InnerClass extends Outerclass i += 10; // access the parent of this InnerClass however private int i; // in InnerClass extends Outerclass i += 10; // access the OuterClass as the parent is not accessible.
downvote count: 0
type: Answer

http://stackoverflow.com/q/22785744
tagged with: java
type: Question
tagged with: algorithm
has answer: http://stackoverflow.com/a/22785757
answer count: 2
possible better answer: http://stackoverflow.com/a/22786775
linked to: http://stackoverflow.com/q/9772348
downvote count: 0
has answer: http://stackoverflow.com/a/22786775
favorite count: 0
has title: Impose numerical limit using mathematics
accepted answer: http://stackoverflow.com/a/22785757
type: AnsweredQuestion
score: 2
has body: I want to return a number that doesn't exceed a limit I set. For example I want to do the equivalent of: if (number &gt;= limit) number = limit; return number; Is there a mathematical way of doing the equivalent of what I just described in just one line?
upvote count: 2

http://stackoverflow.com/comment/34758314
has text: @user2891462 tell me how it goes; I've never used processes.
comment on: http://stackoverflow.com/a/22789851
type: AnswerComment
score: 0
type: Comment

http://stackoverflow.com/a/22741825
has body: What you want to do is possible, but it's less performance efficient and scatters the security code all over the controllers. To see the full capabilities of Expression-Based Access Control, check out this documentation
score: 0
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/22740727
answers question: http://stackoverflow.com/q/22740727
type: Answer

http://stackoverflow.com/q/22661982
has comment: http://stackoverflow.com/comment/34553176
has comment: http://stackoverflow.com/comment/34553642
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/34520151
possible better answer: http://stackoverflow.com/a/22662184
has answer: http://stackoverflow.com/a/22662184
tagged with: java
accepted answer: http://stackoverflow.com/a/22662120
type: Question
tagged with: array-merge
has comment: http://stackoverflow.com/comment/34552848
tagged with: arrays
has comment: http://stackoverflow.com/comment/34519211
has title: Merging string-Array / arrayList without using loop
tagged with: arraylist
has body: I was trying to do something like: ArrayList&lt;String&gt; getMerged ( String host, String port, String filesToCopy ){ ArrayList&lt;String&gt; merged = new ArrayList&lt;String&gt;(); merged.add(host); merged.add(port); merged.addAll(filesToCopy.split(",")); //which is invalid return merged; } I want to know if we can add elements of filesToCopy.split(",") with out having the overhead of using a loop. Also, if the above operation can be done in a string array, say String[] merged (can pass filesToCopy also as String[] if needed), it would be even better coz in the end, I'll be converting this arrayList into an array. I'm novice in Java programming, so please don't mind if this is a silly question.
score: 0
answer count: 3
has answer: http://stackoverflow.com/a/22678910
has comment: http://stackoverflow.com/comment/34559762
has comment: http://stackoverflow.com/comment/34553159
linked to: http://stackoverflow.com/q/8526907
has comment: http://stackoverflow.com/comment/34553774
has answer: http://stackoverflow.com/a/22662120

tomcat
tags question: http://stackoverflow.com/q/22668479
tags question: http://stackoverflow.com/q/22690213
tags question: http://stackoverflow.com/q/22684482
tags question: http://stackoverflow.com/q/22697167
tags question: http://stackoverflow.com/q/22797521
tags question: http://stackoverflow.com/q/22676472
tags question: http://stackoverflow.com/q/22779823
tags question: http://stackoverflow.com/q/22678296
tags question: http://stackoverflow.com/q/22690957
tags question: http://stackoverflow.com/q/22677896
tags question: http://stackoverflow.com/q/22710823
tags question: http://stackoverflow.com/q/22782819
tags question: http://stackoverflow.com/q/22730854
tags question: http://stackoverflow.com/q/22769013
tags question: http://stackoverflow.com/q/22762512
tags question: http://stackoverflow.com/q/22771544
tags question: http://stackoverflow.com/q/22751029
tags question: http://stackoverflow.com/q/22761401
tags question: http://stackoverflow.com/q/22712410
tags question: http://stackoverflow.com/q/22721311
tags question: http://stackoverflow.com/q/22650365
tags question: http://stackoverflow.com/q/22671024
tags question: http://stackoverflow.com/q/22742527
tags question: http://stackoverflow.com/q/22652148
tags question: http://stackoverflow.com/q/22722653
tags question: http://stackoverflow.com/q/22684170
tags question: http://stackoverflow.com/q/22736688
tags question: http://stackoverflow.com/q/22655197
tags question: http://stackoverflow.com/q/22668825
tags question: http://stackoverflow.com/q/22781518
tags question: http://stackoverflow.com/q/22688139
tags question: http://stackoverflow.com/q/22770170
tags question: http://stackoverflow.com/q/22689299
tags question: http://stackoverflow.com/q/22713682
tags question: http://stackoverflow.com/q/22778293
tag name: tomcat
tags question: http://stackoverflow.com/q/22768037
tags question: http://stackoverflow.com/q/22665328
tags question: http://stackoverflow.com/q/22716862
tags question: http://stackoverflow.com/q/22723554
tags question: http://stackoverflow.com/q/22652478
tags question: http://stackoverflow.com/q/22735014
tags question: http://stackoverflow.com/q/22681388
tags question: http://stackoverflow.com/q/22665493
tags question: http://stackoverflow.com/q/22758930
tags question: http://stackoverflow.com/q/22656528
tags question: http://stackoverflow.com/q/22754372
tags question: http://stackoverflow.com/q/22778470
tags question: http://stackoverflow.com/q/22782489
tags question: http://stackoverflow.com/q/22697149
tags question: http://stackoverflow.com/q/22791718
tags question: http://stackoverflow.com/q/22683492
tags question: http://stackoverflow.com/q/22728412
tags question: http://stackoverflow.com/q/22768398
tags question: http://stackoverflow.com/q/22652794
tags question: http://stackoverflow.com/q/22650569
tags question: http://stackoverflow.com/q/22687861
tags question: http://stackoverflow.com/q/22707501
type: Tag
tags question: http://stackoverflow.com/q/22743950
tags question: http://stackoverflow.com/q/22712827
tags question: http://stackoverflow.com/q/22692858
tags question: http://stackoverflow.com/q/22762825
tags question: http://stackoverflow.com/q/22795426
tags question: http://stackoverflow.com/q/22686178
tags question: http://stackoverflow.com/q/22654850
tags question: http://stackoverflow.com/q/22732530
tags question: http://stackoverflow.com/q/22658482
tags question: http://stackoverflow.com/q/22753866
tags question: http://stackoverflow.com/q/22783879
tags question: http://stackoverflow.com/q/22716594
tags question: http://stackoverflow.com/q/22711290
tags question: http://stackoverflow.com/q/22667541
tags question: http://stackoverflow.com/q/22690905
tags question: http://stackoverflow.com/q/22698339
tags question: http://stackoverflow.com/q/22734767
tags question: http://stackoverflow.com/q/22660876
tags question: http://stackoverflow.com/q/22736103
tags question: http://stackoverflow.com/q/22778605
tags question: http://stackoverflow.com/q/22709774

http://stackoverflow.com/a/22725145
answers question: http://stackoverflow.com/q/22725032
has body: First check if the package is installed like this.. PackageManager pm = context.getPackageManager(); try { pm.getPackageInfo(packagename, PackageManager.GET_ACTIVITIES); } catch (NameNotFoundException e) { }
downvote count: 0
score: 1
type: Answer
upvote count: 1

http://stackoverflow.com/a/22791524
has comment: http://stackoverflow.com/comment/34752684
has body: Will this help? class B extends A { val v: Array[java.lang.Double] = Array(2.3D, 6.7D) override def x() = v }
answers question: http://stackoverflow.com/q/22791485
downvote count: 0
type: Answer
score: 1
upvote count: 1

http://stackoverflow.com/a/22701846
has comment: http://stackoverflow.com/comment/34591715
type: Answer
has comment: http://stackoverflow.com/comment/34591569
has body: Let's think about this piece of code, and pretend like you don't get that exception: import java.util.ArrayList; public class Marklength { void marklength4(ArrayList &lt;String&gt; themarklength){ for(String n : themarklength){ if(n.length() ==4){ themarklength.add("****"); } } System.out.println(themarklength); } } Ok, so what happens if your list just contains item. You hit the line if(n.length() ==4){, which is true because you are looking at item, so you go execute its block. Next you hit the line themarklength.add("****");. Your list now has the element **** at the end of it. The loop continues, and you get the next item in the list, which happens to be the one you just added, ****. The next line you hit is if(n.length() ==4){. This is true, so you execute its block. You go to the line themarklength.add("****");, and add **** to the end of the list. Do we see a bad pattern here? Yes, yes we do. The Java runtime environment also knows that this is bad, which is why it prevents something called Concurrent Modification. In your case, this means you cannot modify a list while you are iterating over it, which is what that for loop does. My best guess as to what you are trying to do is something like this: import java.util.ArrayList; public class Marklength { ArrayList&lt;String&gt; marklength4(ArrayList &lt;String&gt; themarklength){ ArrayList&lt;String&gt; markedStrings = new ArrayList&lt;String&gt;(themarklength.size()); for(String n : themarklength){ if(n.length() ==4){ markedStrings.add("****"); } markedStrings.add(n); } System.out.println(themarklength); return markedStrings; } } And then: import java.util.ArrayList; public class MarklengthTestDrive { public static void main(String[] args){ ArrayList &lt;String&gt; words = new ArrayList&lt;String&gt;(); words.add("Kane"); words.add("Cane"); words.add("Fame"); words.add("Dame"); words.add("Lame"); words.add("Same"); Marklength ish = new Marklength(); words = ish.marklength4(words); } }
accepted answer of: http://stackoverflow.com/q/22701694
answers question: http://stackoverflow.com/q/22701694
has comment: http://stackoverflow.com/comment/34591607
has comment: http://stackoverflow.com/comment/34591782
has comment: http://stackoverflow.com/comment/34591477
has comment: http://stackoverflow.com/comment/34591746
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/34591497
score: 8
upvote count: 8
has comment: http://stackoverflow.com/comment/34591659

http://stackoverflow.com/comment/34705686
comment on: http://stackoverflow.com/q/22765373
has text: you need to use URLEncoder
score: 1
type: Comment
type: QuestionComment

http://stackoverflow.com/a/23273898
type: AcceptedAnswer
downvote count: 0
accepted answer of: http://stackoverflow.com/q/22765387
type: Answer
upvote count: 3
answers question: http://stackoverflow.com/q/22765387
has body: You can use jxbrowser. http://www.teamdev.com/jxbrowser If your project is opensource, the jxbrowser is free too. I believe it is most mature technology that can embed web browser in java, even better than javafx
score: 3

http://stackoverflow.com/a/22736217
score: 4
has comment: http://stackoverflow.com/comment/34653001
answers question: http://stackoverflow.com/q/22736170
has comment: http://stackoverflow.com/comment/34672906
type: Answer
has comment: http://stackoverflow.com/comment/34653106
has body: Thread.sleep() will cause the current thread to sleep. If you use this in the main execution thread then your main program will pause and do nothing else. If your main thread invokes a runnable that thread will pause when it calls Thread.sleep() but your main thread, or any other threads will still be running.
upvote count: 4
downvote count: 0

http://stackoverflow.com/comment/45347030
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/22658750
has text: Also seing this but I'm not behind a proxy :/
score: 0

http://stackoverflow.com/comment/34663214
has text: To get the `href` elements you can always use `doc.body().select("a")`
type: AnswerComment
comment on: http://stackoverflow.com/a/22742148
score: 0
type: Comment

http://stackoverflow.com/comment/34570048
type: AnswerComment
has text: @user3172529: Did you see my answer?
type: Comment
comment on: http://stackoverflow.com/a/22690561
score: 0

http://stackoverflow.com/a/22747456
has comment: http://stackoverflow.com/comment/34672993
has comment: http://stackoverflow.com/comment/34683818
score: 0
has body: With a pattern like classpath:*/application-ds-context.xml // ^ this guy Spring will load any file that matches that pattern. Any meaning it might not find/load any. In this example, it will look for any file called application-ds-context.xml that is in any 1st level package. For example, it will find /classpath-root /first application-ds-context.xml but it won't find /classpath-root application-ds-context.xml or /classpath-root /first /second application-ds-context.xml If that's the behavior you are seeing, your classpath does not contain such a file. Review how you are building your test application.
type: AcceptedAnswer
answers question: http://stackoverflow.com/q/22747253
accepted answer of: http://stackoverflow.com/q/22747253
has comment: http://stackoverflow.com/comment/34673051
has comment: http://stackoverflow.com/comment/34672770
has comment: http://stackoverflow.com/comment/34673154
type: Answer

recursion
type: Tag
tags question: http://stackoverflow.com/q/22726240
tags question: http://stackoverflow.com/q/22676670
tags question: http://stackoverflow.com/q/22774673
tags question: http://stackoverflow.com/q/22750289
tags question: http://stackoverflow.com/q/22674805
tag name: recursion
tags question: http://stackoverflow.com/q/22777880
tags question: http://stackoverflow.com/q/22670242
tags question: http://stackoverflow.com/q/22744058
tags question: http://stackoverflow.com/q/22793988
tags question: http://stackoverflow.com/q/22729367
tags question: http://stackoverflow.com/q/22699798
tags question: http://stackoverflow.com/q/22772724
tags question: http://stackoverflow.com/q/22791509
tags question: http://stackoverflow.com/q/22725415
tags question: http://stackoverflow.com/q/22735975
tags question: http://stackoverflow.com/q/22697538
tags question: http://stackoverflow.com/q/22754766
tags question: http://stackoverflow.com/q/22773090
tags question: http://stackoverflow.com/q/22738894
tags question: http://stackoverflow.com/q/22751588
tags question: http://stackoverflow.com/q/22673377
tags question: http://stackoverflow.com/q/22694558
tags question: http://stackoverflow.com/q/22756781

http://stackoverflow.com/comment/34603386
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/22707978
has text: my code is an example how to do it. I use the console but you may do exactly the same for your file. Just use the proper encoding as I did in each step. Shouldn't be to hard for you now, right?
score: 0

http://stackoverflow.com/q/22731613
tagged with: java
has body: I'm eager to use Guava's RangeSets in my program. Despite the features of adding and merging of ranges, i'm also interested in the "size" of my ranges. Some remarks: no ranges i'm interested in are infinite! all ranges i'm using are of the bound-type "closedOpen" the underlying use-case is a discrete time-space (size = summed up time-ticks) This seems to be something which is not built-in (or i didn't see it) and i'm wondering if there is a clear reason against this conceptionally (which means i should not implement some getSize() function myself) or not. Let's have a look at my use-case: RangeSet&lt;Integer&gt; usageTicks = TreeRangeSet.create(); usageTicks.add(Range.closedOpen(3, 7)); usageTicks.add(Range.closedOpen(12,18)); usageTicks.add(Range.closedOpen(18, 23)); int size = usageTicks.hypotheticalGetSizeFunction(); // size = 15 Is there any reason against the following: Set&lt;Range&lt;Integer&gt;&gt; setOfRanges = usageTicks.asRanges(); int sum = 0; for(Range&lt;Integer&gt; range : setOfRanges) sum += (range.upperEndpoint() - range.lowerEndpoint());
type: Question
has answer: http://stackoverflow.com/a/22731700
accepted answer: http://stackoverflow.com/a/22731700
has comment: http://stackoverflow.com/comment/34644849
score: 4
has comment: http://stackoverflow.com/comment/34644729
answer count: 1
tagged with: intervals
downvote count: 0
favorite count: 0
has comment: http://stackoverflow.com/comment/34644917
tagged with: range
upvote count: 4
has title: No concept of "size" in Guava's RangeSet / Range?
type: AnsweredQuestion
tagged with: guava

http://stackoverflow.com/comment/34555814
type: AnswerComment
type: Comment
has text: Which is certainly the best and most straight forward approach. However, he explicitly wanted to group them together.
comment on: http://stackoverflow.com/a/22659681
score: 0

http://stackoverflow.com/q/22804561
has comment: http://stackoverflow.com/comment/34775507
has title: Recursive vs loop?
has body: Can anybody explain what is the differences between two methods ? method1 public void run(){ run(); } method2 public void run(){ while(true){ } }
has answer: http://stackoverflow.com/a/22804640
has comment: http://stackoverflow.com/comment/34775498
favorite count: 0
linked to: http://stackoverflow.com/q/660337
possible better answer: http://stackoverflow.com/a/22804723
has comment: http://stackoverflow.com/comment/34787899
has answer: http://stackoverflow.com/a/22804723
accepted answer: http://stackoverflow.com/a/22804640
answer count: 4
score: -1
has comment: http://stackoverflow.com/comment/34775414
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/22804751
has answer: http://stackoverflow.com/a/22804756
has comment: http://stackoverflow.com/comment/34775471
downvote count: 2
upvote count: 1
linked to: http://stackoverflow.com/q/12305050
type: Question
tagged with: java

http://stackoverflow.com/a/22668052
downvote count: 1
has body: Create a list of Integer representing the indexes in the array, sort the list. You can reuse the list of indexes many times for many sorts.
answers question: http://stackoverflow.com/q/22666377
type: Answer
has comment: http://stackoverflow.com/comment/90568765
has comment: http://stackoverflow.com/comment/34531235
score: 0
upvote count: 1

http://stackoverflow.com/a/22716071
score: 1
downvote count: 0
answers question: http://stackoverflow.com/q/22710607
type: Answer
upvote count: 1
has body: The correct way is to add a DocumentListener to the Document of your JTextField: public final class TextFieldListener implements DocumentListener { public static void main(final String... args) { SwingUtilities.invokeLater(() -&gt; new TextFieldListener().go()); } private final JFrame frame = new JFrame(); private final JTextField field = new JTextField(); private final JTextField field2 = new JTextField(); private TextFieldListener() { field.getDocument().addDocumentListener(this); frame.setLayout(new GridLayout(2, 0)); frame.add(field); frame.add(field2); frame.setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE); onFieldUpdated(); } private void go() { frame.pack(); frame.setLocationRelativeTo(null); frame.setVisible(true); } private void onFieldUpdated() { setField2Enabled(!field.getText().isEmpty()); } private void setField2Enabled(final boolean enabled) { field2.setEnabled(enabled); } @Override public void insertUpdate(final DocumentEvent e) { onFieldUpdated(); } @Override public void removeUpdate(final DocumentEvent e) { onFieldUpdated(); } @Override public void changedUpdate(final DocumentEvent e) {} } It is not correct to add a KeyListener to your text field if you are interested in changes to its content. Further reading: JTextComponent Document Text Component Features How to Use Text Fields How to Write a Document Listener

arraylist
tags question: http://stackoverflow.com/q/22797177
tags question: http://stackoverflow.com/q/22800950
tags question: http://stackoverflow.com/q/22733757
tags question: http://stackoverflow.com/q/22751383
tags question: http://stackoverflow.com/q/22674587
tags question: http://stackoverflow.com/q/22709632
tags question: http://stackoverflow.com/q/22665967
tags question: http://stackoverflow.com/q/22740946
tags question: http://stackoverflow.com/q/22664881
tags question: http://stackoverflow.com/q/22695559
tags question: http://stackoverflow.com/q/22696384
tags question: http://stackoverflow.com/q/22715607
tags question: http://stackoverflow.com/q/22703737
tags question: http://stackoverflow.com/q/22791097
tags question: http://stackoverflow.com/q/22774806
tags question: http://stackoverflow.com/q/22719666
tags question: http://stackoverflow.com/q/22757112
tags question: http://stackoverflow.com/q/22680877
tags question: http://stackoverflow.com/q/22687430
tags question: http://stackoverflow.com/q/22748271
tags question: http://stackoverflow.com/q/22743793
tags question: http://stackoverflow.com/q/22778180
tags question: http://stackoverflow.com/q/22734703
tags question: http://stackoverflow.com/q/22651770
tags question: http://stackoverflow.com/q/22720995
tags question: http://stackoverflow.com/q/22717218
tags question: http://stackoverflow.com/q/22649378
tags question: http://stackoverflow.com/q/22730682
tags question: http://stackoverflow.com/q/22737415
tags question: http://stackoverflow.com/q/22709474
tags question: http://stackoverflow.com/q/22654860
tags question: http://stackoverflow.com/q/22747818
tags question: http://stackoverflow.com/q/22651552
tags question: http://stackoverflow.com/q/22676080
tags question: http://stackoverflow.com/q/22727013
tags question: http://stackoverflow.com/q/22713907
tags question: http://stackoverflow.com/q/22675034
tags question: http://stackoverflow.com/q/22739196
tags question: http://stackoverflow.com/q/22706448
tags question: http://stackoverflow.com/q/22721919
tags question: http://stackoverflow.com/q/22673092
tags question: http://stackoverflow.com/q/22766116
tags question: http://stackoverflow.com/q/22728344
tags question: http://stackoverflow.com/q/22673604
tags question: http://stackoverflow.com/q/22709730
tags question: http://stackoverflow.com/q/22732633
tags question: http://stackoverflow.com/q/22789981
tags question: http://stackoverflow.com/q/22786184
tags question: http://stackoverflow.com/q/22751696
tags question: http://stackoverflow.com/q/22652953
tags question: http://stackoverflow.com/q/22800225
tags question: http://stackoverflow.com/q/22808152
tags question: http://stackoverflow.com/q/22751251
tags question: http://stackoverflow.com/q/22747528
tags question: http://stackoverflow.com/q/22783980
tags question: http://stackoverflow.com/q/22743594
tags question: http://stackoverflow.com/q/22789116
tags question: http://stackoverflow.com/q/22747748
tags question: http://stackoverflow.com/q/22738570
tags question: http://stackoverflow.com/q/22787944
tags question: http://stackoverflow.com/q/22806661
tags question: http://stackoverflow.com/q/22729676
tags question: http://stackoverflow.com/q/22794338
tags question: http://stackoverflow.com/q/22688296
tags question: http://stackoverflow.com/q/22649309
tags question: http://stackoverflow.com/q/22650694
tags question: http://stackoverflow.com/q/22792357
tags question: http://stackoverflow.com/q/22775288
tags question: http://stackoverflow.com/q/22785525
tags question: http://stackoverflow.com/q/22746198
tags question: http://stackoverflow.com/q/22654255
tags question: http://stackoverflow.com/q/22763441
tags question: http://stackoverflow.com/q/22669270
tags question: http://stackoverflow.com/q/22723465
tags question: http://stackoverflow.com/q/22735594
tags question: http://stackoverflow.com/q/22736092
tags question: http://stackoverflow.com/q/22736539
tags question: http://stackoverflow.com/q/22741687
tags question: http://stackoverflow.com/q/22674632
tags question: http://stackoverflow.com/q/22773235

http://stackoverflow.com/a/22786095
has body: Just use &lt;s:if test="isUserFullyLogged()"&gt;&lt;/s:if&gt; or `&lt;s:if test="isUserFullyLogged"&gt;&lt;/s:if&gt;` to call that method otherwise you have to set the value of this boolean result to a variable with proper getter-setter and use &lt;s:if test="%{#userFullyLogged}"&gt;&lt;/s:if&gt; Thanks, Amit Kumar Morea
type: Answer
downvote count: 1
has comment: http://stackoverflow.com/comment/34742819
upvote count: 0
score: -1
answers question: http://stackoverflow.com/q/22769224

http://stackoverflow.com/q/22782819
score: 16
has answer: http://stackoverflow.com/a/48258838
has answer: http://stackoverflow.com/a/22783494
has answer: http://stackoverflow.com/a/59624036
favorite count: 0
type: Question
has answer: http://stackoverflow.com/a/33416461
has comment: http://stackoverflow.com/comment/69232772
has comment: http://stackoverflow.com/comment/34737279
has answer: http://stackoverflow.com/a/59587254
has answer: http://stackoverflow.com/a/22783405
has answer: http://stackoverflow.com/a/43162338
has answer: http://stackoverflow.com/a/39415088
has comment: http://stackoverflow.com/comment/34737820
has answer: http://stackoverflow.com/a/61005908
downvote count: 1
has answer: http://stackoverflow.com/a/22783126
has answer: http://stackoverflow.com/a/52476913
has answer: http://stackoverflow.com/a/41257156
has comment: http://stackoverflow.com/comment/34737440
answer count: 14
tagged with: java
has comment: http://stackoverflow.com/comment/34736310
has title: My Tomcat is not running it just open and close when I click on tomcat7.exe
upvote count: 17
has answer: http://stackoverflow.com/a/57321368
has body: I am installing Tomcat 7 in my PC it works in Eclipse but when I try to open in bin/ tomcat7.exe it just open and closes, (I am stopping the server in Eclipse). Also, in Eclipse I'am trying to open admin console like URL:(localhost:1234/admin) it shows 404 error. Can anyone who knows this problem explain a solution?
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/55137721
tagged with: tomcat

http://stackoverflow.com/comment/34503710
has text: While accurate, I can't see how this is anything other than tangentially related to the question. OP _knows_ what a `for` loop is supposed to look like, they're questioning why this one _doesn't_ look like that.
comment on: http://stackoverflow.com/a/22651654
type: AnswerComment
type: Comment
score: 0

http://stackoverflow.com/q/22732121
tagged with: enums
tagged with: network-programming
upvote count: 3
tagged with: java
downvote count: 0
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/34646561
score: 3
has body: I am trying to register my classes in order to send information over a network. I need to register an Enum class that looks like this: public enum Fort{ NOFORT("No Fort", 0, 0), TOWER("Tower", 1, 1), KEEP("Keep", 2, 2), CASTLE("Castle", 3, 3), CITADEL("Citadel", 4, 4); protected int combatValue; protected int income; protected String name; private Fort(String n, int c, int i){ name = n; combatValue = c; income = i; } public int getFortIncome(){ return income; } public int getComatValue(){ return combatValue; } } I am trying to send my entire game board over a network, which is requiring me to register all of the subclasses contained inside of my Board. The main issue is that I I get stuck when trying to register my enum. This is what I am doing in my networking class: // tell Kryo what things it's going to have to send private void registerClasses(Kryo kryo) { kryo.register(Request.class); kryo.register(PacketMessage.class); kryo.register(Fort.class); kryo.register(ArrayList.class); kryo.register(Tile.class); kryo.register(Board.class); } When I try to register Fort.class I get a bunch of errors that look like this: at com.esotericsoftware.kryo.Kryo.writeObject(Kryo.java:504) at com.esotericsoftware.kryo.serializers.FieldSerializer$ObjectField.write(FieldSerializer.java:564) at com.esotericsoftware.kryo.serializers.FieldSerializer.write(FieldSerializer.java:213) at com.esotericsoftware.kryo.Kryo.writeObject(Kryo.java:504) at com.esotericsoftware.kryo.serializers.FieldSerializer$ObjectField.write(FieldSerializer.java:564) at com.esotericsoftware.kryo.serializers.FieldSerializer.write(FieldSerializer.java:213) at com.esotericsoftware.kryo.Kryo.writeObject(Kryo.java:504) Am I registering my enum incorrectly? Any ideas on how I can do this properly? Thanks!
has title: How to register an Enum class in Kryonet?
tagged with: kryonet
favorite count: 0
has comment: http://stackoverflow.com/comment/34646686
type: Question
has answer: http://stackoverflow.com/a/22737072
answer count: 1

http://stackoverflow.com/comment/34546108
comment on: http://stackoverflow.com/a/22676886
has text: Thank you for helping me. I do not follow the"[^a-zA-Z]" part. Could you please explain it to me @sunhang
score: 0
type: AnswerComment
type: Comment

http://stackoverflow.com/q/22798098
has title: Android sdk programming - R.java got deleted and doesn't come back
has answer: http://stackoverflow.com/a/22798301
has comment: http://stackoverflow.com/comment/34764658
tagged with: java
has comment: http://stackoverflow.com/comment/34764458
linked to: http://stackoverflow.com/q/7824730
tagged with: eclipse
type: Question
has comment: http://stackoverflow.com/comment/34764356
tagged with: r.java-file
score: 0
tagged with: android
answer count: 1
has body: I just worked on my current android app and created an xml-layout. But the layout was not included automatically to the R.java file. After refreshing for a while, I realized that the R.java file was deleted. I looked the file up in the project folder, but it was not there either. I googled for a while, but none of the solutions helped me. I tried cleaning, building manually, restarting eclipse etc.. I have tried to get this right for hours, but this never happened before... So now my first question: Why is the R.java file being deleted? respectively what happens to the R.java file? And my second question is: Has anyone know why the R.java file disappears?
has comment: http://stackoverflow.com/comment/34764616
linked to: http://stackoverflow.com/q/2757107
type: UnansweredQuestion

http://stackoverflow.com/comment/34649883
comment on: http://stackoverflow.com/q/22734500
has text: Is it your homework ?
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/34767703
type: Comment
comment on: http://stackoverflow.com/a/22799761
score: 0
type: AnswerComment
has text: No, not like that! What you did isn't what I meant at all; and I think it's slightly more complicated now. Umm, do you mind if I edit your answer to demonstrate what I had in mind?

http://stackoverflow.com/q/22793989
has answer: http://stackoverflow.com/a/22794655
upvote count: 3
has body: What I want to know is how to modify following regex: \".*?\" so it will ignore escaped " character (\") so it won't end matching at \". For example: parameter1 = " fsfsdfsd \" " parameter2 = " fsfsfs " I want to match: " fsfsdfsd \" " and " fsfsfs " but not " fsfsdfsd \" " parameter2 = " fsfsfs " etc...
has answer: http://stackoverflow.com/a/22794074
has comment: http://stackoverflow.com/comment/34756788
favorite count: 0
has answer: http://stackoverflow.com/a/22794109
has answer: http://stackoverflow.com/a/35934101
accepted answer: http://stackoverflow.com/a/22794109
tagged with: regex
possible better answer: http://stackoverflow.com/a/22794655
answer count: 4
type: AnsweredQuestion
downvote count: 0
linked to: http://stackoverflow.com/q/2498635
has comment: http://stackoverflow.com/comment/34756904
has comment: http://stackoverflow.com/comment/34756812
type: Question
tagged with: quotes
score: 3
has title: Regex matching quoted string but ignoring escaped quotation mark
has comment: http://stackoverflow.com/comment/34756753
tagged with: java

http://stackoverflow.com/q/22659139
score: 0
has title: Unable to find the sub menu element which disappears when mouse pointer is moved outside the menu frame
answer count: 1
has answer: http://stackoverflow.com/a/22685259
tagged with: java
tagged with: submenu
type: UnansweredQuestion
has body: My code is: driver.findElement(By.xpath(".//*[@id='fmf-name-title-cellsort-label']")).click(); // Main menu item driver.findElement(By.xpath("//*[@id='quick-filter-input']")).sendKeys("Profile1121"); // Sub menu item In above code: Sub menu item disappears when moves is moved out, and unable to find the element "@id='quick-filter-input" Error displayed: org.openqa.selenium.NoSuchElementException: Unable to locate element: {"method":"xpath","selector":"//*[@id='quick-filter-input']"} Command duration or timeout: 10.02 seconds SubMenu appears when main menu is clicked. Could some one help me out here, how to find that required subMenu element?
type: Question
tagged with: selenium-webdriver

http://stackoverflow.com/a/22685540
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/22685422
answers question: http://stackoverflow.com/q/22685422
type: Answer
has body: Is there any way to do a kind of static cast between an int[] and byte[] ? Short answer, no. But you could wrap the byte[] in a ByteBuffer and get anIntBuffer from it, or just use its getInt()/putInt() methods. In many cases, this would meet your requirements, even if not exactly what you ask for. Something like: byte[] bytes ...; ByteBuffer buffer = ByteBuffer.wrap(bytes); // No copy, changes are reflected int foo = buffer.getInt(0); // get int value from buffer foo *= 2; buffer.putInt(0, foo); // write int value to buffer // Or perhaps IntBuffer intBuffer = buffer.asIntBuffer(); // Creates an int "view" (no copy) int bar = intBuffer.get(0); intBuffer.set(0, bar); The byte order of the byte buffer when working with multi-byte values, like int can be controlled using: buffer.order(ByteOrder.BIG_ENDIAN); // Default is platform specific, I believe
score: 2
downvote count: 0
upvote count: 2

http://stackoverflow.com/comment/34678074
type: Comment
type: QuestionComment
has text: @yshavit Integer -> Object - it is widening)
comment on: http://stackoverflow.com/q/22750152
score: 0

http://stackoverflow.com/comment/34571683
type: Comment
comment on: http://stackoverflow.com/q/22684783
score: 0
has text: How? show me an example?
type: QuestionComment

http://stackoverflow.com/comment/34612513
type: AnswerComment
has text: As per the article, check the new methods added to the [`Comparator` interface](http://docs.oracle.com/javase/8/docs/api/java/util/Comparator.html) in Java 8.
score: 0
type: Comment
comment on: http://stackoverflow.com/a/22713721

http://stackoverflow.com/q/22713179
upvote count: 5
tagged with: java
has comment: http://stackoverflow.com/comment/34612377
score: 5
has answer: http://stackoverflow.com/a/22716077
downvote count: 0
answer count: 1
favorite count: 0
type: AnsweredQuestion
tagged with: apache-poi
accepted answer: http://stackoverflow.com/a/22716077
has title: Open excel-xml with apache poi
has comment: http://stackoverflow.com/comment/34611291
has body: User can save excel document as .xls or as xml-table. Result is a xml-file with fixed structure and Excel can correct work with it. It is possible open this type of excel file with apache-poi in java? Thanks in advance, Andrey.
type: Question

http://stackoverflow.com/a/22750185
answers question: http://stackoverflow.com/q/22749175
has comment: http://stackoverflow.com/comment/34691178
has comment: http://stackoverflow.com/comment/34678048
has comment: http://stackoverflow.com/comment/34678190
has comment: http://stackoverflow.com/comment/34678165
has comment: http://stackoverflow.com/comment/34677965
has comment: http://stackoverflow.com/comment/34678612
has comment: http://stackoverflow.com/comment/34678379
type: Answer
has comment: http://stackoverflow.com/comment/34692483
has comment: http://stackoverflow.com/comment/34678468
has comment: http://stackoverflow.com/comment/34678743
has comment: http://stackoverflow.com/comment/34678621
has comment: http://stackoverflow.com/comment/34678233
has comment: http://stackoverflow.com/comment/34677935
has comment: http://stackoverflow.com/comment/34678271
has comment: http://stackoverflow.com/comment/34678308
has body: Your not typing the write url, your servlet can be accessed at: http://localhost:8080/ch03/MyFirstServlet
has comment: http://stackoverflow.com/comment/34678659
score: 0

http://stackoverflow.com/q/22743053
has body: I'm trying to place a LinearLayout with a banner ad - at the bottom of a RelativeLayout. I'm trying to achieve it by: <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=".AllJokes" > <com.google.android.gms.ads.AdView android:id="@+id/adView" android:layout_width="wrap_content" android:layout_height="wrap_content" ads:adUnitId="MY_AD_UNIT_ID" ads:adSize="BANNER"/> </RelativeLayout> But it always gives me this error: error: Error parsing XML: unbound prefix I know that my formatting is completely messed up, but I can't find a way to make it valid. I just need a clue, as I'm a total beginner at android and xml. I'm missing something really small I know it.
type: Question
accepted answer: http://stackoverflow.com/a/22743083
answer count: 2
downvote count: 0
favorite count: 0
possible better answer: http://stackoverflow.com/a/22743067
tagged with: android
has answer: http://stackoverflow.com/a/22743067
has title: Can't format my layout
has answer: http://stackoverflow.com/a/22743083
tagged with: http://stackoverflow.com/tag/xml
score: 2
type: AnsweredQuestion
upvote count: 2
tagged with: java

http://stackoverflow.com/a/22731085
answers question: http://stackoverflow.com/q/22731037
has body: There are other things wrong with your code but your question was why you get the 'cannot find symbol' error. String inWord = "hello?"; String word; String punctuation = null; if (inWord.contains(","+"?"+"."+"!"+";")) { String parts[] = inWord.split("\\," + "\\?" + "\\." + "\\!" + "\\;"); word = parts[0]; punctuation = parts[1]; } else { word = inWord; } System.out.println(word); System.out.println(punctuation); The scope of a variable declaration like String word = ... is only the block (the pieces of code inside '{' and '}') that it's in. The variables word and punctuation don't exist in the scope in which you try to print them. You need to declare your variables word and punctuation in the same scope (or an enclosing scope) of where you access them in your System.out.println
score: 0
type: Answer

http://stackoverflow.com/comment/34751283
score: 3
comment on: http://stackoverflow.com/q/22791097
has text: You need to use the reference type: `Character`.
type: QuestionComment
type: Comment

http://stackoverflow.com/q/22741898
has comment: http://stackoverflow.com/comment/34663188
score: 1
tagged with: java
upvote count: 1
type: Question
has comment: http://stackoverflow.com/comment/34663122
has comment: http://stackoverflow.com/comment/34662618
has title: Sorting data in ResultSet Java
answer count: 3
has answer: http://stackoverflow.com/a/22741911
has answer: http://stackoverflow.com/a/22742004
downvote count: 0
has answer: http://stackoverflow.com/a/22741939
has body: I have obtained a ResultSet for some query, e.g: select * from students order by roll Now, is it possible to perform an equivalent of query Select * from students order by dob;` on the ResultSet?
favorite count: 0
tagged with: resultset
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/34662954
tagged with: jdbc

http://stackoverflow.com/a/22694272
has comment: http://stackoverflow.com/comment/34578282
answers question: http://stackoverflow.com/q/22688713
has body: Note the javadoc of ACCEPT_EMPTY_STRING_AS_NULL_OBJECT Feature that can be enabled to allow JSON empty String value ("") to be bound to POJOs as null. So an empty String can be used to map null to a POJO. A String is not a POJO, it is considered a JSON primitive value. You cannot use that here. ACCEPT_EMPTY_STRING_AS_NULL_OBJECT would work for something like {"name":"First Name","phone":"","unknown":"test"} Where you would make the TestBean.phone field of some POJO type like class Phone { private String number; } Then deserializing would make the phone field be null.
score: 9
upvote count: 9
type: Answer
has comment: http://stackoverflow.com/comment/34578901
downvote count: 0

http://stackoverflow.com/comment/34610743
score: 0
has text: if you want to use variable across activities then tie it to Application class or just pass variable between activities. And again you should go with ViewPager instead of doing so
comment on: http://stackoverflow.com/q/22712674
type: Comment
type: QuestionComment

http://stackoverflow.com/q/22732781
has comment: http://stackoverflow.com/comment/34646891
tagged with: rmi
tagged with: java
has answer: http://stackoverflow.com/a/22742166
type: Question
has comment: http://stackoverflow.com/comment/34646767
score: 0
has body: I need to invoke a method in rmi server and pass a serialized object to the method from client side but the class of the object is unknown to the server
answer count: 1
has title: passing serialzed object using RMI
has comment: http://stackoverflow.com/comment/34646742
type: UnansweredQuestion

http://stackoverflow.com/q/22700943
linked to: http://stackoverflow.com/q/8563970
tagged with: java
tagged with: switch-statement
duplicate of: http://stackoverflow.com/q/8563970
type: Question
has comment: http://stackoverflow.com/comment/34590269
has comment: http://stackoverflow.com/comment/34592914
has answer: http://stackoverflow.com/a/22701044
score: 4
accepted answer: http://stackoverflow.com/a/22700956
upvote count: 4
has title: Java brackets bug in SWITCH statement?
answer count: 2
has comment: http://stackoverflow.com/comment/34589767
possible better answer: http://stackoverflow.com/a/22701044
downvote count: 0
has body: This is driving me crazy! I've searched through my entire code and I can't seem to solve this problem. Here is my code: class Subtarefas { public static void resolve (int flag, int na, Aeroporto a[], int nv, Voo v[]) { switch(flag) { //------------------------------------------------------------------ case 3: {//Incompleto String mat[][] = new String [na][2]; int count=0; int bigcount=0; int indice=0; int np=0; for (int i=0; i&lt;na; i++) { if ( indexOf(np, mat, a[i].nomecidade, a[i].nomepais)== -1 ) { mat[np][0]=a[i].nomecidade; mat[np][1]=a[i].nomepais; np++; } } for (int i=0; i&lt;np; i++) { count=0; for (int j=0; j&lt;np; j++) { if (mat[i][1].equals(mat[j][1])) count++; } if (count&gt;bigcount) {bigcount=count; indice=i;} } System.out.println(mat[indice][1] + " " + bigcount); } //------------------------------------------------------------------ case 4: {//Feito String mat1[][] = new String [nv][2]; int count=0; int bigcount=0; int indice=0; for (int i=0; i&lt;nv; i++) { for (int j=0; j&lt;na; j++) { if (v[i].origem==a[j].cod) mat1[i][0]=a[j].nomepais; if (v[i].destino==a[j].cod) mat1[i][1]=a[j].nomepais; } } for (int i=0; i&lt;na; i++) { count=0; for (int j=0; j&lt;nv; j++) { if (a[i].nomepais.equals(mat1[j][0])) { if (mat1[j][0].equals(mat1[j][1])) count++; } } if (count&gt;bigcount) {bigcount=count; indice=i;} else if (count==bigcount) { int result = a[i].nomepais.compareTo(a[indice].nomepais); if (result&lt;0) {bigcount=count; indice=i;} } } System.out.println(a[indice].nomepais + " " + bigcount); } //------------------------------------------------------------------ default: break; } } So basically I can't find what is wrong here, I can't filter the type {} brackets. There is some kind of bug here, because when I use case 3 I get two outputs, and it is suppose to give me only 1 (I only have 1 System.out.println in that case). I found out when I use case 3 it also goes through case 4. That's not suppose to happen! What should I do? Another option is that the…
favorite count: 0
has comment: http://stackoverflow.com/comment/34589533
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/22700956

http://stackoverflow.com/q/22790021
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/22790683
tagged with: android-asynctask
type: Question
tagged with: android
has comment: http://stackoverflow.com/comment/34750106
has title: Correct use of AsyncTasks and handle Objects needed by a View and Activity
score: 0
tagged with: java
accepted answer: http://stackoverflow.com/a/22790683
tagged with: mysql
answer count: 1
has body: So I am currently writing an App and have a few questions about how to deal with AsyncTasks. I describe my problem as detailed as I can. I have the following classes: MainActivity - This Activity only executes setContentView(R.layout.myLayout) and creates an Object of my CustomLocationListener. The Layout contains a custom view and a ProgressBar. CustomLocationListener - This is basically just a Class which implements LocationListener and has the default LocationListener methods. In addition to that I wrote a method to check which providers are enabled to prior use the NETWORK_PROVIDER. Display - This is just an assisstant class. I use it only to get display metrics to calculate some things. MyCustomView - This class extends the View class. It also has an Attribute of the type Display (my own class). Now you should know everything important to my code. Well, my question now is, how to deal with AsyncTasks, since this are the steps the App should go through: Get the current location of the users device Execute some queries to a database server (mysql) and save them non persistent (the data consists of city names) Calculate the distance between the users location and the cities in the database Do some other calculations to figure out the positions where to draw on the screen Draw everything On top of that I would like to implement a progress bar, which should be active untill all calculations are done and the drawing phase begins. So, I'm kinda confused where to code what. I mean, both calculations (step 3. and 4.) have to know about each other. The calculation of step 4 needs the results of the calculation of step 3. And my Activity class should also know about the state of the calculations, since I have to make the ProgressBar invisible when I start to draw. I hope I was detailed enough and I appreciate your help!

osgi
tags question: http://stackoverflow.com/q/22749221
type: Tag
tags question: http://stackoverflow.com/q/22651661
tags question: http://stackoverflow.com/q/22805647
tags question: http://stackoverflow.com/q/22690260
tags question: http://stackoverflow.com/q/22771298
tag name: osgi
tags question: http://stackoverflow.com/q/22768492
tags question: http://stackoverflow.com/q/22803661
tags question: http://stackoverflow.com/q/22770953
tags question: http://stackoverflow.com/q/22661089

http://stackoverflow.com/comment/34534043
type: AnswerComment
has text: Also, many progress dialogs can be handled in the actionbar with setSupportProgressBarIndeterminateVisibility(false|true) // appcompat version | setProgressBarIndeterminateVisibility(false|true)
type: Comment
comment on: http://stackoverflow.com/a/22670163
score: 0

http://stackoverflow.com/comment/34596463
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/22704682
type: Comment
has text: Yes I understand that, but we at-least have rights to uploads our war, then definitely we have rights to upload other files, I am not willing to go to go through BLOB way.

http://stackoverflow.com/comment/34659333
has text: @HotLicks: I'm aware of that, which is why I was asking what `com.etl.core.model.fmtg.Tag#getType()` returns. "**if i do `t.getType()` i will get the name of the type**"
comment on: http://stackoverflow.com/q/22731049
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/a/23981962
upvote count: 4
answers question: http://stackoverflow.com/q/22737934
downvote count: 0
type: Answer
has body: Speaking from a purely practical point of view, it's much more concise and easy to read. I would suggest you see this for yourself, by comparing code in Java and Scla. Ther are two great examples of this: The code excerpts from the book Pro JavaFX, which are available both in native Java and in scalaFX on github (There is a link to javafx code on that page). Also, you can compare the code for JavaFX-ensemble with that of ScalaFX-ensemble. Again, you'll see it's less cluttered and easier to read. As @OJKrylow pointed out, not all of JavaFX has been ported, so it does have some weak areas. This is evident in the scalafx-ensemble, where not everything has been ported into scala. If you're planning on building your own controls, then you are better off writing them in Java and then creating a wrapper object for ScalaFX. But if you are writing a small program, as in your case, this should lower the complexity in theory. However, the lack of a standard introductory text means you basically end up resorting to the two above JavaFX resources, and looking at how they translate to ScalaFX (i.e. you can't really learn it on it's own, unfortunately). I hope this will change in the future.
score: 4

http://stackoverflow.com/a/22752339
downvote count: 0
has comment: http://stackoverflow.com/comment/78152926
has body: Choosing a modding method When creating minecraft client mods my research has found that different methods of creating mods. of the choices listed here, they have different perks: Source modding: Confusing to install mods, difficult to develop for, highest probability of breaking (especially after an update), but allows for the most features to be added. ModLoader: Easier to use, limited features, not used often, unable to find support? Minecraft Forge: Slightly more difficult to develop, more extendable, large API, easy to install mods, frequently used (FTB, Technic) Minecraft Forge is probably one of the better options as of right now (March 2014) so here is a short intro to getting started: Setting up Minecraft Forge with Eclipse (Mac & PC) Download & install Java Development Kit 7 (Also works w/ JDK 8, but not JDK 9+) Download & install eclipse (or other Java IDE such as IntelliJ, etc.) Download Src (MDK) files of Minecraft Forge for the version of Minecraft you want to develop. (I Suggest Recommended) Extract the files to a folder of your choosing (ex. /Library/Java/). Windows: Shift + Right Click into the white space of the folder and select "Open command window here" OR for Mac: open Terminal and navigate to the directory of the extracted files. Run this command. Windows: gradlew setupDecompWorkspace OR Mac: ./gradlew setupDecompWorkspace If previous command finishes successfully, run the following. Windows: gradlew eclipse OR Mac: ./gradlew eclipse (Note: You can substitute the name of another IDE. Ex. gradlew idea) Open Eclipse. If this is your first time using eclipse you will get a popup saying "Select a workspace". If this is the case, browse to the extracted files, select the "eclipse" folder and press "OK". If this is NOT your first time using eclipse, go to File > Switch Workspace > other... and select the eclipse folder inside the folder where you extracted the forge files. That's all, you should now have a forge environment ready to go to start crea…
score: 37
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/81825226
accepted answer of: http://stackoverflow.com/q/22739920
type: Answer
answers question: http://stackoverflow.com/q/22739920
upvote count: 37

javascript
tags question: http://stackoverflow.com/q/22806881
tags question: http://stackoverflow.com/q/22746822
tags question: http://stackoverflow.com/q/22769734
tags question: http://stackoverflow.com/q/22714267
tags question: http://stackoverflow.com/q/22729898
tags question: http://stackoverflow.com/q/22666056
tags question: http://stackoverflow.com/q/22789604
tags question: http://stackoverflow.com/q/22715325
tags question: http://stackoverflow.com/q/22654566
tags question: http://stackoverflow.com/q/22768413
tags question: http://stackoverflow.com/q/22704740
tags question: http://stackoverflow.com/q/22656909
tags question: http://stackoverflow.com/q/22717940
tags question: http://stackoverflow.com/q/22804085
tags question: http://stackoverflow.com/q/22784398
tags question: http://stackoverflow.com/q/22762572
tags question: http://stackoverflow.com/q/22722081
tags question: http://stackoverflow.com/q/22688743
tags question: http://stackoverflow.com/q/22702220
tags question: http://stackoverflow.com/q/22785129
tags question: http://stackoverflow.com/q/22788072
tag name: javascript
tags question: http://stackoverflow.com/q/22654521
tags question: http://stackoverflow.com/q/22796112
tags question: http://stackoverflow.com/q/22660044
tags question: http://stackoverflow.com/q/22729875
tags question: http://stackoverflow.com/q/22728502
tags question: http://stackoverflow.com/q/22785447
tags question: http://stackoverflow.com/q/22731159
tags question: http://stackoverflow.com/q/22756353
tags question: http://stackoverflow.com/q/22787103
tags question: http://stackoverflow.com/q/22790515
tags question: http://stackoverflow.com/q/22717171
tags question: http://stackoverflow.com/q/22672819
tags question: http://stackoverflow.com/q/22725960
tags question: http://stackoverflow.com/q/22687648
tags question: http://stackoverflow.com/q/22781295
tags question: http://stackoverflow.com/q/22654350
tags question: http://stackoverflow.com/q/22764299
tags question: http://stackoverflow.com/q/22704788
tags question: http://stackoverflow.com/q/22677966
type: Tag
tags question: http://stackoverflow.com/q/22698442
tags question: http://stackoverflow.com/q/22690036
tags question: http://stackoverflow.com/q/22727799
tags question: http://stackoverflow.com/q/22690006
tags question: http://stackoverflow.com/q/22715593
tags question: http://stackoverflow.com/q/22713977
tags question: http://stackoverflow.com/q/22711441
tags question: http://stackoverflow.com/q/22655351
tags question: http://stackoverflow.com/q/22703904
tags question: http://stackoverflow.com/q/22804982
tags question: http://stackoverflow.com/q/22656889
tags question: http://stackoverflow.com/q/22776355
tags question: http://stackoverflow.com/q/22755177
tags question: http://stackoverflow.com/q/22754623
tags question: http://stackoverflow.com/q/22754329
tags question: http://stackoverflow.com/q/22779912
tags question: http://stackoverflow.com/q/22648261
tags question: http://stackoverflow.com/q/22793129
tags question: http://stackoverflow.com/q/22716447
tags question: http://stackoverflow.com/q/22805586
tags question: http://stackoverflow.com/q/22804430
tags question: http://stackoverflow.com/q/22802889
tags question: http://stackoverflow.com/q/22768449

http://stackoverflow.com/q/22743380
tagged with: java
has comment: http://stackoverflow.com/comment/34669520
accepted answer: http://stackoverflow.com/a/22753825
answer count: 1
linked to: http://stackoverflow.com/q/4587397
has comment: http://stackoverflow.com/comment/34671596
tagged with: servlets
type: AnsweredQuestion
tagged with: jsp
has answer: http://stackoverflow.com/a/22753825
has comment: http://stackoverflow.com/comment/34667087
has comment: http://stackoverflow.com/comment/34673544
has comment: http://stackoverflow.com/comment/34669672
linked to: http://stackoverflow.com/q/10883251
type: Question
has body: This is a college lab. I've been stuck for 3 days now. I'm building an image viewer website with Google App Engine and Java. I've made a web page with login functionality. On the welcome page the user can register an account or log in. If I register a new account there's no problem, the user data is saved, cookies are added to the http response and the user progresses to the next page where he/she can upload and view images in the category that they selected on registering an account. However, if I try to log in as a user that already has an account the app crashes after the successful login with a NullPointerException I cannot figure out what's wrong. The process for registering and logging in is the same with the exception of saving to and reading from the database. Here's my Welcome page: <%@ page import="com.google.appengine.api.blobstore.BlobstoreServiceFactory" %> <%@ page import="com.google.appengine.api.blobstore.BlobstoreService" %> <%@ page import="com.blobtest.UserManager" %> <%@ page import="com.blobtest.UserDatastore" %> <%@ page import="com.google.appengine.api.datastore.Entity" %> <%@ page import="java.util.List" %> <% BlobstoreService blobstoreService = BlobstoreServiceFactory.getBlobstoreService(); UserManager userManager = new UserManager(); UserDatastore dataStore = new UserDatastore(); Cookie cookie = null; Cookie[] cookies = null; cookies = request.getCookies(); if(cookies != null){ System.out.println(""); System.out.println("============ From WELCOME.JSP ================="); System.out.println(""); System.out.println("Found Cookies!!"); for(int i = 0; i < cookies.length; i++){ cookie = cookies[i]; System.out.println(""); System.out.println("Name: " + cookie.getName()); System.out.println("Value: " + cookie.getValue()); System.out.println("Domain: " + cookie.getDomain()); } System.out.println(""); System.out.println("============ From WELCOME.JSP ================="); System.out.println(""); } %> Welcome Welcome to the Picture Gallery! To log in …
tagged with: google-app-engine
has title: Servlet crashes when logging in with a registered user, but not when logging in automatically after registering an account
linked to: http://stackoverflow.com/q/3177733
linked to: http://stackoverflow.com/q/2848332
score: 0

http://stackoverflow.com/comment/34850826
score: 0
type: AnswerComment
has text: Yes. I modified the code to loop over multiple results returned from query `new QueryFilter("Name", "contains", "Team")` GetTeamMembers.java is in this github repo: https://github.com/nmusaelian-rally/rally-java-rest-apps
comment on: http://stackoverflow.com/a/22814902
type: Comment

http://stackoverflow.com/q/22805700
type: Question
tagged with: tightly-coupled-code
has comment: http://stackoverflow.com/comment/34777823
score: 0
answer count: 1
tagged with: jpa
has comment: http://stackoverflow.com/comment/34777708
has title: JPA - How to avoid tight coupling and redundancy?
accepted answer: http://stackoverflow.com/a/22806160
has body: (Still studying now and then the OO principles to get a better understanding of OOP.) Three (JPA) entities have the following has-a relation: A has a collection of B and B has a field 'a' pointing to A (bidirectional relation) B has a collection of C and C has a field 'b' pointing to B (bidirectional relation) (I would say by using JPA you get tight coupling for free. Which is not so great of course.) A, B and C have a field 'nr'. Those fields together form a id divided by dots. Something like this: ####.####.#### Now I would like to ask A to build that number. What is the proper way to do that following the OO-principles? In my opinion C should not have any knowledge of B and B not of A.
type: AnsweredQuestion
tagged with: oop
tagged with: java
has answer: http://stackoverflow.com/a/22806160

http://stackoverflow.com/comment/34742561
has text: can you please explain me why it's not - O((n/(n/100))*logn)? m/(m/100) will give me 100 for every m > 100 (which is the worse case), and im looping m/(m/100) times over log2n.
type: AnswerComment
comment on: http://stackoverflow.com/a/22785960
score: 0
type: Comment

http://stackoverflow.com/q/22702701
upvote count: 1
answer count: 1
has comment: http://stackoverflow.com/comment/34593022
tagged with: boolean-logic
favorite count: 0
has comment: http://stackoverflow.com/comment/34593190
has answer: http://stackoverflow.com/a/22702795
type: UnansweredQuestion
score: -3
has comment: http://stackoverflow.com/comment/34593203
has body: how to do the next operation between the bytes byte a; byte b; byte c; byte d; byte result = (((not(a) and(b)) or(c)) xor(d); So what is the equivalent operator to not and xor in java?
type: Question
has comment: http://stackoverflow.com/comment/34593097
tagged with: java
has comment: http://stackoverflow.com/comment/34594012
has title: Boolean operation with bytes on java
downvote count: 4
has comment: http://stackoverflow.com/comment/34593041

http://stackoverflow.com/comment/34597939
comment on: http://stackoverflow.com/a/22705163
score: 0
type: Comment
has text: Ah yeah, I can see what you mean now haha, Sorry its been a long day lol. I'm getting an error from getActivity(), its apparently undefined for type Context. Also is there a way I can pass a class to CreateAlert?
type: AnswerComment

http://stackoverflow.com/comment/34685533
score: 0
type: QuestionComment
comment on: http://stackoverflow.com/q/22740716
type: Comment
has text: *"is show 0"* Rubbish! The code shown has at least two **compilation errors,** so would not do anything at run-time. Stop wasting our time by posting 'something like' the code being used.

http://stackoverflow.com/comment/34664258
has text: @NicolasCarlo: yes i'm sure that i'm in right directory.But not working command : java WhileDemo for execution.
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/22734404

http://stackoverflow.com/comment/34535192
score: 0
type: Comment
type: AnswerComment
has text: @user3183922: Can you update your question to show the Maven GAV for httpclient? For reference, jwebunit pulls in htmlunit which pulls in httpclient 4.3.2.
comment on: http://stackoverflow.com/a/22670750

http://stackoverflow.com/comment/34668567
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/22744058
has text: That's not the interesting part of the error message, but it does rather suggest infinite recursion.
score: 0

http://stackoverflow.com/q/22691477
has answer: http://stackoverflow.com/a/22691638
has title: Display different Error message after a Limit?
downvote count: 1
has comment: http://stackoverflow.com/comment/34572010
has comment: http://stackoverflow.com/comment/34571582
has comment: http://stackoverflow.com/comment/34573289
tagged with: java
has body: I need to display a error Message.I have declared a counter.Whenever the counter is 3 it has to display a different error message.So i have written the below snippet. It returns error: &lt;identifier&gt; expected on the declaration. //declaration private static attempts = 0; //operation switch (xmlRpcFault.getFaultCode()) { case 403: attempts++; if(attempts = 3) { mErrorMsgId = R.string.username_or_password_incorrect; //reinitialize counter attempts = 0; } else mErrorMsgId = R.string.username_or_password_incorrectfull; break;
type: Question
answer count: 2
upvote count: 0
has answer: http://stackoverflow.com/a/22691509
favorite count: 0
score: -1
type: UnansweredQuestion

http://stackoverflow.com/comment/34498353
score: 0
type: AnswerComment
has text: Thanks! :D It works... Which layout should i use if I want a gridView instead of a simplee_list... ? do you know? i'm closing the question after :P
comment on: http://stackoverflow.com/a/22649901
type: Comment

http://stackoverflow.com/q/22714090
type: Question
downvote count: 0
answer count: 1
favorite count: 0
has comment: http://stackoverflow.com/comment/34613116
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/34613141
upvote count: 1
tagged with: spring
has body: I was trying to run the spring web mvc application through java config. I was getting the 404 exception. Why it is not running? I put my code below. web.xml <?xml version="1.0" encoding="UTF-8"?> <web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://java.sun.com/xml/ns/javaee" xmlns:web="http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd" id="WebApp_ID" version="3.0"> spring-jpa-tutorial-one sample org.springframework.web.servlet.DispatcherServlet contextClass org.springframework.web.context.support.AnnotationConfigWebApplicationContext contextConfigLocation net.petrikainulainen.spring.datajpa.config.ApplicationContext sample / org.springframework.web.context.ContextLoaderListener ApplicationContext package net.petrikainulainen.spring.datajpa.config; import java.util.Properties; import javax.annotation.Resource; import javax.sql.DataSource; import org.hibernate.ejb.HibernatePersistence; import org.springframework.context.MessageSource; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.ComponentScan; import org.springframework.context.annotation.Configuration; import org.springframework.context.annotation.ImportResource; import org.springframework.context.annotation.PropertySource; import org.springframework.context.support.ResourceBundleMessageSource; import org.springframework.core.env.Environment; import org.springframework.orm.jpa.JpaTransactionManager; import org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean; import org.springframework.web.servlet.ViewResolver; import org.springframework.web.servlet.config.annotation.EnableWebMvc; import org.springframework.web.servlet.view.InternalResourceViewResolver; import org.springframework.web.servlet.view.JstlView; import com.jolbox.bonecp.BoneCPDataSource; @Configuration @ComponentScan(basePackages = { "net.petrikainulainen.spring.…
tagged with: spring-mvc
has answer: http://stackoverflow.com/a/22716323
score: 1
tagged with: java
has title: Issue in running Spring MVC through Java config

http://stackoverflow.com/comment/34580623
score: 0
type: Comment
comment on: http://stackoverflow.com/a/22692705
has text: HOLY moly!! Thank you SO much! It works! I've spent about 24 hours total looking online for a solution and I f- finally found it!! *Tears of joy* Thanks so much!!!!
type: AnswerComment

http://stackoverflow.com/comment/34735319
comment on: http://stackoverflow.com/a/22782021
type: AnswerComment
score: 0
type: Comment
has text: Well, I think the following: you can rely on this if you don't interrupt the thread.

http://stackoverflow.com/a/22655466
has comment: http://stackoverflow.com/comment/34512020
has comment: http://stackoverflow.com/comment/34508237
answers question: http://stackoverflow.com/q/22655351
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/22655351
type: Answer
has body: Remove the "^" character, you could use: r = new RegExp('Dave', 'i') r.test('John Dave') That will return: true
score: 0

http://stackoverflow.com/comment/34531211
has text: Yes. Your logic seems solid.
type: Comment
type: QuestionComment
score: 0
comment on: http://stackoverflow.com/q/22668417

http://stackoverflow.com/a/22731400
upvote count: 2
has comment: http://stackoverflow.com/comment/34662436
has comment: http://stackoverflow.com/comment/34647198
has comment: http://stackoverflow.com/comment/34645808
accepted answer of: http://stackoverflow.com/q/22729226
answers question: http://stackoverflow.com/q/22729226
has comment: http://stackoverflow.com/comment/34645948
type: AcceptedAnswer
downvote count: 0
has body: I've tested your code and works perfectly for me. (with groovy-all-1.6.9.jar) (edit: groovy-all-1.6.0.jar works fine too) How do you use your class DefaultImportClassLoader? I've done: public static void main(String[] args) throws InstantiationException, IllegalAccessException{ GroovyClassLoader loader = new DefaultImportClassLoader(new GroovyClassLoader()); Class groovyClass = loader.parseClass(DefaultImportClassLoader.class.getClassLoader().getResourceAsStream("so_22729226/test.groovy")); GroovyObject groovyObject = (GroovyObject) groovyClass.newInstance(); groovyObject.invokeMethod("run", null); } With this Groovy class: class so_22729226_Test { def run(){ print Test.class } } And I get the expected output: interface org.junit.Test If I use the standard loader I get: Caused by: groovy.lang.MissingPropertyException: No such property: Test for class: so_22729226_Test Which is the expected behaviour too.
has comment: http://stackoverflow.com/comment/34645788
has comment: http://stackoverflow.com/comment/34645821
has comment: http://stackoverflow.com/comment/34666375
type: Answer
has comment: http://stackoverflow.com/comment/34660025
has comment: http://stackoverflow.com/comment/34659994
has comment: http://stackoverflow.com/comment/34659977
has comment: http://stackoverflow.com/comment/34646262
score: 2

http://stackoverflow.com/comment/34558363
has text: paste some code here.
comment on: http://stackoverflow.com/q/22684188
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/a/22773962
accepted answer of: http://stackoverflow.com/q/22773809
type: Answer
has comment: http://stackoverflow.com/comment/34721174
has comment: http://stackoverflow.com/comment/34721263
answers question: http://stackoverflow.com/q/22773809
downvote count: 0
score: 1
has body: It is clear that there is another exception. Maybe "messages", inside the catch is null and it is throwing a new NullPointerException?
upvote count: 1
type: AcceptedAnswer

http://stackoverflow.com/a/22699557
score: 0
has body: Let's think this through logically: you want to loop until the user enters the correct input. So, does this mean that you will know prior to starting the loop how many times the loop should iterate? This is key. Once you know this information, the correct loop falls out, since: for loops are used when you know in advance how many times you'll loop. While loops are for when you don't know this information in advance.
type: Answer
has comment: http://stackoverflow.com/comment/34587027
answers question: http://stackoverflow.com/q/22699519
has comment: http://stackoverflow.com/comment/34587067

http://stackoverflow.com/q/22678998
has comment: http://stackoverflow.com/comment/34549691
score: 0
has title: Java Generics error: not applicable for the arguments <T>
answer count: 1
tagged with: generics
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/34549957
has comment: http://stackoverflow.com/comment/34550075
tagged with: java
has comment: http://stackoverflow.com/comment/34549684
has comment: http://stackoverflow.com/comment/34549769
has comment: http://stackoverflow.com/comment/34549734
type: Question
has body: Sorry for another "Java generic method is not applicable" question. But no answer can solve my problem: Problem code: public final class Native&lt;T&gt; { private void test1(Ref ref, Integer key) { } final class Ref { private final Native factory; private Ref(Native factory) { this.factory = factory; } public void test2() { factory.test1(this, 1); } } } Error: The method test1(Native.Ref, Integer) in the type Native is not applicable for the arguments (Native&lt;T&gt;.Ref, int) If I remove the factory like this: public void test2() { test1(this, 1); } Then it works, but I donnot know why? Thanks in advance.
has answer: http://stackoverflow.com/a/22679039
has comment: http://stackoverflow.com/comment/34551703

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

graphics
tag name: graphics
tags question: http://stackoverflow.com/q/22750216
tags question: http://stackoverflow.com/q/22781683
tags question: http://stackoverflow.com/q/22773353
tags question: http://stackoverflow.com/q/22798361
tags question: http://stackoverflow.com/q/22743099
tags question: http://stackoverflow.com/q/22736759
tags question: http://stackoverflow.com/q/22649374
tags question: http://stackoverflow.com/q/22690374
tags question: http://stackoverflow.com/q/22737931
tags question: http://stackoverflow.com/q/22795053
type: Tag
tags question: http://stackoverflow.com/q/22794993
tags question: http://stackoverflow.com/q/22722777
tags question: http://stackoverflow.com/q/22752177
tags question: http://stackoverflow.com/q/22675068
tags question: http://stackoverflow.com/q/22745313
tags question: http://stackoverflow.com/q/22777498
tags question: http://stackoverflow.com/q/22729956
tags question: http://stackoverflow.com/q/22668547
tags question: http://stackoverflow.com/q/22752240
tags question: http://stackoverflow.com/q/22702302
tags question: http://stackoverflow.com/q/22700271
tags question: http://stackoverflow.com/q/22790826
tags question: http://stackoverflow.com/q/22673374
tags question: http://stackoverflow.com/q/22683155
tags question: http://stackoverflow.com/q/22801298

http://stackoverflow.com/a/22705434
has body: while(o!=null) This isn't a valid way to read an ObjectInputStream. The readObject() method only returns a null if you wrote a null. At end of stream it throws, guess what, an EOFException, so the correct way to read the stream is to loop calling `readObject() until you catch that exception, then break and close the stream. at the end of file it is giving EOF exception That's exactly what EOFException means.
has comment: http://stackoverflow.com/comment/34597872
downvote count: 0
answers question: http://stackoverflow.com/q/22705024
has comment: http://stackoverflow.com/comment/34598833
has comment: http://stackoverflow.com/comment/34598120
upvote count: 2
has comment: http://stackoverflow.com/comment/34598229
has comment: http://stackoverflow.com/comment/34597868
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/34597814
type: Answer
has comment: http://stackoverflow.com/comment/34597588
has comment: http://stackoverflow.com/comment/34597726
has comment: http://stackoverflow.com/comment/34597679
has comment: http://stackoverflow.com/comment/34598302
accepted answer of: http://stackoverflow.com/q/22705024
score: 2

http://stackoverflow.com/a/22767071
answers question: http://stackoverflow.com/q/22747658
has comment: http://stackoverflow.com/comment/54863819
score: 0
type: Answer
has body: As @MarcoAcierno said，I forget to reload the project and idea not remind me .That is the reason. How to close it ?

http://stackoverflow.com/q/22757644
accepted answer: http://stackoverflow.com/a/22916067
favorite count: 0
has comment: http://stackoverflow.com/comment/34691651
has comment: http://stackoverflow.com/comment/34691618
tagged with: serialization
has comment: http://stackoverflow.com/comment/34692200
tagged with: singleton
has comment: http://stackoverflow.com/comment/34691499
has comment: http://stackoverflow.com/comment/34691956
upvote count: 1
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/22916067
has title: Java singleton deserialization values keep default
score: 1
tagged with: java
linked to: http://stackoverflow.com/q/17387457
tagged with: default-value
type: Question
has body: I have a simple singleton: class Test1 implements Serializable { private static Test1 instance; public String a = "a"; public String b = "b"; public String c = null; public String d = null; public String e; public String f; private Test1() { e = "e"; } public static Test1 getInstance() { if (instance == null) { instance = new Test1(); } return instance; } // http://www.journaldev.com/1377/java-singleton-design-pattern-best-practices-with-examples protected Object readResolve() { return getInstance(); } public String toString() { return String.format("Test1{ a:%s, b:%s, c:%s, d:%s, e:%s, f:%s}", a, b, c, d, e, f); } } My main(): if ((new File("t1.obj").exists() == false)) { Test1 t1 = Test1.getInstance(); t1.b = "bb"; t1.d = "dd"; t1.f = "ff"; serialize("t1.obj", t1); } else { Test1 t2 = deserialize("t1.obj"); } First run looks well Serialized hu.fehergeri13.abptc.server.Test1 object to t1.obj file. Test1{ a:a, b:bb, c:null, d:dd, e:e, f:ff} after second run: Deserialized hu.fehergeri13.abptc.server.Test1 object from t1.obj file. Test1{ a:a, b:b, c:null, d:null, e:e, f:null} My serialize/deserialize: public static void serialize(String filePath, Object o) { try { FileOutputStream fos = new FileOutputStream(filePath); ObjectOutputStream oos = new ObjectOutputStream(fos); oos.writeObject(o); System.out.println(String.format("Serialized %s object to %s file.", o.getClass().getName(), filePath)); oos.close(); fos.close(); } catch (IOException e) { e.printStackTrace(); } } public static &lt;T&gt; T deserialize(String filePath) { try { FileInputStream is = new FileInputStream(filePath); ObjectInputStream ois = new ObjectInputStream(is); T o = (T) ois.readObject(); System.out.println(String.format("Deserialized %s object from %s file.", o.getClass().getName(), filePath)); ois.close(); is.close(); return o; } catch (ClassNotFoundException e) { e.printStackTrace(); } catch (IOException e) { e.printStackTrace(); } return null; } Why are the values keep default and not bb,dd,ff…
answer count: 1
downvote count: 0

http://stackoverflow.com/comment/34580631
comment on: http://stackoverflow.com/a/22695141
has text: @Skiwi if there are null elements the filter will throw a NPE first.
type: AnswerComment
type: Comment
score: 2

http://stackoverflow.com/q/22714650
tagged with: java
upvote count: 1
tagged with: tomcat7
type: Question
has comment: http://stackoverflow.com/comment/34616878
has title: Request entity too large error
has comment: http://stackoverflow.com/comment/34614084
has answer: http://stackoverflow.com/a/39887549
linked to: http://stackoverflow.com/q/2943477
tagged with: apache
answer count: 1
downvote count: 0
favorite count: 0
tagged with: apache2
has body: Currently in my project, I am getting the following errors 1) Request entity too large error, The requested resource does not allow request Data with GET Requests, or the amount of the data provided in the request exceeds the capacity limit 2) Request entity too large error, The requested resource does not allow request Data with POST Requests, or the amount of the data provided in the request exceeds the capacity limit** I get these error while I submit my pages at different modules. I use tomcat 7 and apache in my project. I have made changes in tomcats server.xml as &lt;Connector port="8109" protocol="AJP/1.3" redirectPort="8443" maxPostSize="-1" packetSize="65536"/&gt; But I am still getting the same error. Can anyone guide me where else I need to make changes to avoid this problem?
has comment: http://stackoverflow.com/comment/34615192
linked to: http://stackoverflow.com/q/2659952
type: UnansweredQuestion
score: 1

http://stackoverflow.com/q/22660188
has answer: http://stackoverflow.com/a/22660300
possible better answer: http://stackoverflow.com/a/22660265
favorite count: 0
has body: I have an object which is a List my cast is: List&lt;Object&gt; list = (List&lt;Object&gt;)o; It seems correct but it gives me: Type safety: Unchecked cast from Object to ArrayList still...the casting seems correct to me. I don't want to use the @suppressWarning, I want to solve it.
linked to: http://stackoverflow.com/q/509076
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/22660265
downvote count: 0
tagged with: java
has comment: http://stackoverflow.com/comment/34515838
type: Question
has comment: http://stackoverflow.com/comment/34516762
score: 3
has title: Warning when I try to cast Object to List<Object>
accepted answer: http://stackoverflow.com/a/22660300
has answer: http://stackoverflow.com/a/22660242
has comment: http://stackoverflow.com/comment/34515761
upvote count: 3
answer count: 3

http://stackoverflow.com/comment/34518264
score: 0
type: Comment
type: QuestionComment
has text: @Jay - Previously,I tried run with log4j.properties and logger statements in the code, since m getting the warning related to log4j, I have removed and tried to run the code. So what I have to check in org.springframework.web.context? Its just a warning but am not able to proceed after this.
comment on: http://stackoverflow.com/q/22660876

http://stackoverflow.com/a/22721569
accepted answer of: http://stackoverflow.com/q/22721023
score: 0
type: AcceptedAnswer
has body: You expect e.getSource() to be the number entered, but what you get is the TextField which caused the event to happen. You can't compare a TextField to a number using &lt; or such. Since you register the ActionListener directly on the TextField, you don't have to check the source of the event. You know it will be the TextField. What you want to do is : In the case of an event (the actionPerformed() only gets called when an action happened in the TextField), if the key pressed was Enter, get the number from the TextField and check its value.
type: Answer
has comment: http://stackoverflow.com/comment/34627085
answers question: http://stackoverflow.com/q/22721023

http://stackoverflow.com/q/22653336
has comment: http://stackoverflow.com/comment/34504202
has comment: http://stackoverflow.com/comment/34504110
tagged with: sql-server
score: 0
answer count: 1
has answer: http://stackoverflow.com/a/22653775
has comment: http://stackoverflow.com/comment/34504126
type: UnansweredQuestion
has body: create procedure dat( @d datetime, @e datetime, @LEFT datetime, @day int) as begin set @d=(SELECT (DATEADD(WEEK, DATEDIFF(WEEK, 0,DATEADD(DAY,6-DATEPART(DAY,GETDATE()),GETDATE())), 0) +28)) set @e=( select SYSDATETIME ()) SET @LEFT=@d-@e; set @day=(select DAY(@LEFT)) select region,cast((((TOTAL*55)/100)-(CAST((SUM(EMI)/100) AS DECIMAL(2,2))+CAST((SUM([REPO ARREAR])/100) AS DECIMAL(2,2))))/@day as decimal(3,3)) DRR from DCC GROUP BY TOTAL ,CIRCLE ,REGION ORDER BY CIRCLE,REGION end This is my procedure. I am writing this procedure in SQL server 2008. try { Class.forName("com.microsoft.sqlserver.jdbc.SQLServerDriver"); con = DriverManager.getConnection("jdbc:sqlserver://localhost:1433;databaseName=Repo;user=sa;password=sam123;"); String SQL=("{call [DCR].[dbo].[dat]()}"); CallableStatement cs = con.prepareCall(SQL); rss=cs.executeQuery(); while(rss.next()) { float day=rss.getFloat(2); } } catch(Exception e){ } This is my jsp code. I don't get the value in ResultSet. Please help me.
has title: How to call procudure in jsp
tagged with: java
has comment: http://stackoverflow.com/comment/34504184
type: Question
has comment: http://stackoverflow.com/comment/34504172
tagged with: jsp

http://stackoverflow.com/q/22669278
has comment: http://stackoverflow.com/comment/34532901
type: Question
score: 3
has comment: http://stackoverflow.com/comment/49506612
has comment: http://stackoverflow.com/comment/34532803
tagged with: caching
has body: I am using Guava LoadingCache to bulk load all elements at once into my eager cache. But the implementation of the loadAll method that I'm supplying does not really need an Iterable&lt;? extends K&gt; keys argument, since my DAO does not except any parameters either - my DAO method returns generic Map&lt;K,V&gt;. Since my implementation is generic, I'm using generics to do a call on getAllIterable(&lt;? extends K&gt; keys_), but because of the type erasure, I can not instantiate K key, and pass it to getAll, since it does not expect any non null keys. Does anyone know of any workaround around this?
has comment: http://stackoverflow.com/comment/34532840
has comment: http://stackoverflow.com/comment/34532658
accepted answer: http://stackoverflow.com/a/22669430
answer count: 1
downvote count: 0
tagged with: generics
favorite count: 0
has comment: http://stackoverflow.com/comment/34533081
has comment: http://stackoverflow.com/comment/34532647
has comment: http://stackoverflow.com/comment/34532698
has title: Guava LoadingCache getAll - but without any arguments?
has comment: http://stackoverflow.com/comment/34532513
type: AnsweredQuestion
tagged with: guava
upvote count: 3
tagged with: java
has answer: http://stackoverflow.com/a/22669430

http://stackoverflow.com/comment/34666096
type: Comment
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/22743806
has text: I know to use scanner. My question is why the System.out is not working.

http://stackoverflow.com/q/22794236
accepted answer: http://stackoverflow.com/a/22794309
tagged with: jcombobox
type: AnsweredQuestion
tagged with: java
has title: Why is my program is not finding the getSelectedIndex() method that is trying to get a selection from a JComboBox?
has comment: http://stackoverflow.com/comment/34757262
type: Question
has answer: http://stackoverflow.com/a/22794309
tagged with: itemlistener
score: 0
answer count: 1
has body: My program is not finding the symbol getSelectedIndex() method. I wanted to know why it was not finding it and how to fix this. Here is the Error: Error: cannot find symbol symbol: method getSelectedIndex() location: variable roomChoice of type java.lang.String[] Here is my code: import java.awt.*; import java.awt.event.*; import javax.swing.*; public class CottageRental2 extends JFrame implements ItemListener{ // Declare all instance data (primitives and objects used) private int WIDTH = 676; private int HEIGHT = 321; Container con; private JLabel label1; private JLabel label2; private JLabel label3; JComboBox cbox1; JComboBox cbox2; String [ ] roomChoice = {"1 Bedroom: $600","2 Bedroom: $800","3 Bedroom: $1000"}; String [] activityChoice = {"Horse Back Riding: $60","Rafting: $40","Row Boat Rental: $50"}; ImageIcon icon1 = new ImageIcon("C:\\Users\\Coding\\Desktop\\cottage.jpeg"); Font f1 = new Font("Ariel", Font.BOLD, 30); //constructor public CottageRental2(){ super("Cottage Rental"); con = getContentPane(); con.setLayout(new BorderLayout()); con.setBackground(Color.GRAY); setSize(WIDTH, HEIGHT); setVisible(true); setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); } public void createGUI(){ label1 = new JLabel("Woodberry Cottage Rental", JLabel.CENTER); label1.setFont(f1); label1.setForeground(Color.WHITE); label2 = new JLabel("Rental Amount Due: ", JLabel.CENTER); label2.setFont(f1); label2.setForeground(Color.WHITE); label3 = new JLabel(icon1); cbox1 = new JComboBox(); cbox1.addItem(roomChoice); cbox2 = new JComboBox(); cbox2.addItem(activityChoice); con.add(label1, BorderLayout.NORTH); con.add(label2, BorderLayout.SOUTH); con.add(label3, BorderLayout.CENTER); con.add(cbox1, BorderLayout.WEST); con.add(cbox2, BorderLayout.EAST); } public void itemStateChanged(ItemEvent event){ Object source = event.getSource(); if(source == roomChoice){ int roomIndex = roomChoice.getSelectedIndex(); if(roomIndex == 1){ int price1 = 600; } if(roomIndex == 2){ int price1 = 800; } if…

http://stackoverflow.com/q/22651661
favorite count: 0
tagged with: osgi
has answer: http://stackoverflow.com/a/22653481
has title: How can I extend test class in different bundle in OSGi
score: 2
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/34501845
upvote count: 2
tagged with: java
type: Question
has body: Now my project is working on OSGi. I have a abstract class Parent in bundle A. And Child1,Child2,Child3 is in other bundles. As I have many functions in class Parent. So I write a PartentTest in bundle A. But in other bundle can not see the ParentTest. So I can not reuse the code in Child1Test.... This means I can not know the if the public functions is correct in Childs What shall I do?
accepted answer: http://stackoverflow.com/a/22653481
answer count: 2
possible better answer: http://stackoverflow.com/a/22680719
downvote count: 0
has answer: http://stackoverflow.com/a/22680719

http://stackoverflow.com/comment/34613365
type: QuestionComment
score: 1
has text: Did you look at this question as well? http://stackoverflow.com/questions/12194436/how-to-test-javafx-2-in-a-headless-environment
comment on: http://stackoverflow.com/q/22711557
type: Comment

http://stackoverflow.com/q/22742238
score: 0
has answer: http://stackoverflow.com/a/22742392
answer count: 3
linked to: http://stackoverflow.com/q/8616781
linked to: http://stackoverflow.com/q/238547
has body: I have searched about this. All I got was xml parsing/ Sax parser. I need a program that will download xml data. I need this for my android application development. thanks For example i have a website localhost:8080/folder/sample.html.. How do i get a .xml file from that?
linked to: http://stackoverflow.com/q/218608
has title: How to download xml data of a website?
linked to: http://stackoverflow.com/q/422970
has answer: http://stackoverflow.com/a/22742324
favorite count: 0
has comment: http://stackoverflow.com/comment/34663324
linked to: http://stackoverflow.com/q/359439
has answer: http://stackoverflow.com/a/22742365
type: UnansweredQuestion
tagged with: android
tagged with: http://stackoverflow.com/tag/xml
tagged with: java
upvote count: 1
has comment: http://stackoverflow.com/comment/34663536
downvote count: 1
type: Question
has comment: http://stackoverflow.com/comment/34663647
has comment: http://stackoverflow.com/comment/34663455

http://stackoverflow.com/a/22797169
has body: You should read the tutorial on exceptions. Here is an example of catching an exception and printing the stack trace. The following code throws an exception at line 12 UIManager.setLookAndFeel("bbbb"); public class ExceptionFinder { public static void main(String[] args) { try { UIManager.setLookAndFeel("sasa"); } catch (Exception e) { e.printStackTrace(); } } } This is a stack trace. Notice how the bottom-most line (in this case) tells where the error occurred. This what what you need to show those who try to answer your questions.
has comment: http://stackoverflow.com/comment/34763390
has comment: http://stackoverflow.com/comment/34762942
score: 0
has comment: http://stackoverflow.com/comment/34764648
has comment: http://stackoverflow.com/comment/34763576
answers question: http://stackoverflow.com/q/22795669
type: Answer
has comment: http://stackoverflow.com/comment/36473793
has comment: http://stackoverflow.com/comment/34764554
has comment: http://stackoverflow.com/comment/34763189

http://stackoverflow.com/comment/34751560
score: 0
type: Comment
comment on: http://stackoverflow.com/a/22791066
has text: yes, sorry I missed off the brackets (this is just copied and pasted from my Eclipse project). Is there a way just to create a Java String in the JSON format to pass it over?
type: AnswerComment

http://stackoverflow.com/comment/34642220
type: Comment
comment on: http://stackoverflow.com/a/22725944
score: 0
type: AnswerComment
has text: @user3000837: "But how do I wait for the next event?" -- poll the queue again. It's called a "loop" :). Use `java linkedblockingqueue example` in a search engine, as `LinkedBlockingQueue` is part of standard Java and has been around for a decade-plus. That being said, I'd be rather nervous about making one `static`, due to potential memory leaks.

http://stackoverflow.com/q/22789757
favorite count: 0
has comment: http://stackoverflow.com/comment/34748970
has comment: http://stackoverflow.com/comment/34748872
upvote count: 4
has title: Check exit status of main
type: AnsweredQuestion
downvote count: 0
tagged with: java
possible better answer: http://stackoverflow.com/a/22789897
has answer: http://stackoverflow.com/a/22789851
accepted answer: http://stackoverflow.com/a/22789851
type: Question
has body: I am invoking the main class of a .class contained in the same folder from my Java code. That main is void, and I want to check whether it was successful or not by checking its exit status: ... String[] arguments = new String[]{"a", "b"}; AnotherClass.main(arguments); ... Any idea on how, being that AnotherClass.main(arguments); does not return anything? Thank you.
answer count: 2
has answer: http://stackoverflow.com/a/22789897
score: 4

http://stackoverflow.com/q/22805909
linked to: http://stackoverflow.com/q/702415
type: Question
has answer: http://stackoverflow.com/a/22808093
has comment: http://stackoverflow.com/comment/34778725
has comment: http://stackoverflow.com/comment/34778660
answer count: 2
upvote count: 1
has body: I have a method createThreads which spawns few new threads. Each of the newly created thread does some work. If I invoke the method `createThreads' in junit, how can i ensure that all the newly spawned threads have also completed successfully. I am currently calling as below @Test public void test() { createThreads(); // Does not wait until the newly created threads also finish. } public void createThreads() { ExecutorService executorService = Executors .newFixedThreadPool(numThreads); for (int i = 0; i &lt; numThreads; i++) { executorService.execute(new Runnable() { @Override public void run() { try { Thread.sleep(100); } catch (InterruptedException e) { e.printStackTrace(); } System.out.println("I have completed execution " + Thread.currentThread().getName()); } }); } Note that I cannot modify createThreads
tagged with: junit
has title: How do I test the completion of threads created under my testmethod in JUnit
favorite count: 0
has answer: http://stackoverflow.com/a/22806938
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/34778118
has comment: http://stackoverflow.com/comment/34778765
downvote count: 0
score: 1
tagged with: java
tagged with: multithreading

http://stackoverflow.com/a/44209436
answers question: http://stackoverflow.com/q/22662687
type: Answer
score: 0
has comment: http://stackoverflow.com/comment/75502092
has body: I had a problem similar to this when developing my first android game; force-stop was the only way to kill it. START_NOT_STICKY will kill the background service when you swipe the app away from the task manager. START_STICKY is, as the name implies, "sticky", Meaning it sticks to the android system even when the app is gone. That's from my experience, anyway.

http://stackoverflow.com/a/22788533
accepted answer of: http://stackoverflow.com/q/22787203
type: AcceptedAnswer
downvote count: 0
answers question: http://stackoverflow.com/q/22787203
type: Answer
upvote count: 1
has body: To answer your original question, "how many times must this random2 method iterate to achieve the same level of randomness in array as in the first method?" The answer is: it will never achieve the same level of randomness. For any position that has been swapped, there is an equal chance of it arriving in any position, which means a 10% chance it ends up back where it started. In each iteration, 2 numbers are swapped (or zero if the number is swapped to its own position). That means there's an 80% chance for any given position to never have been swapped, after 1 iteration. After N iterations, there is still a 0.8^N chance that it was never swapped. If it was swapped, there is a 10% chance it went back where it started. So the probability that any given digit is in its starting position is 10% + 0.8^N. This is always > 10%, so you will never get a perfectly even distribution. For example, for your choice of 10 iterations, there remains a 10.7% chance for each digit that it never moved, or a total of 19.7% chance it'll be in its starting position. So ten iterations is not even close to enough.
score: 1
has comment: http://stackoverflow.com/comment/34753710

http://stackoverflow.com/q/22692858
has title: Unable to deploy Java Application on Tomcat via Netbeans 7.4
accepted answer: http://stackoverflow.com/a/22877177
has comment: http://stackoverflow.com/comment/34575609
has comment: http://stackoverflow.com/comment/34575285
type: AnsweredQuestion
tagged with: netbeans
has comment: http://stackoverflow.com/comment/34575085
has body: Every time I try to deploy a web application on netbeans, I get the following error:\ C:\Users{myname}\Documents\NetBeansProjects\WebApplication2\nbproject\build-impl.xml:1045: The module has not been deployed. See the server log for details. The problem is, there are no errors in the apache log! I have uninstalled my netbeans and installed it afresh, yet still the problem persists. I even downloaded and installed the new netbeans version 8.0, but the problem occurs there too. I have restarted my laptop countless times, but problem won't go away. My laptop runs Windows 8.1. Please, what do I do? EDIT 1: I've opened the build-impl.xml file, and here is line 1045 &lt;nbdeploy clientUrlPart="${client.urlPart}" debugmode="false" forceRedeploy="${forceRedeploy}"/&gt;
score: 0
type: Question
has comment: http://stackoverflow.com/comment/34600357
tagged with: java
has answer: http://stackoverflow.com/a/22877177
has comment: http://stackoverflow.com/comment/34575760
has comment: http://stackoverflow.com/comment/34575368
has comment: http://stackoverflow.com/comment/34575017
answer count: 1
has comment: http://stackoverflow.com/comment/34600375
has comment: http://stackoverflow.com/comment/34574301
tagged with: tomcat
has comment: http://stackoverflow.com/comment/34576134

http://stackoverflow.com/a/22747326
has comment: http://stackoverflow.com/comment/34678905
type: Answer
accepted answer of: http://stackoverflow.com/q/22743497
has comment: http://stackoverflow.com/comment/47540931
downvote count: 0
answers question: http://stackoverflow.com/q/22743497
has comment: http://stackoverflow.com/comment/47540094
score: 9
has body: Consider the following MySQL test table: CREATE TABLE `customers` ( `id` int(11) NOT NULL AUTO_INCREMENT, `name` varchar(100) NOT NULL, `email` varchar(100) NOT NULL, PRIMARY KEY (`id`), UNIQUE KEY `email` (`email`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8 AUTO_INCREMENT=1 ; with existing sample data as follows: id name email -- -------------- ---------------- 1 Loblaw, Bob bob@example.com 2 Thompson, Gord gord@example.com With the default connection setting compensateOnDuplicateKeyUpdateCounts=false (described here) the following Java code PreparedStatement ps = dbConnection.prepareStatement( "INSERT INTO customers (name, email) " + "VALUES (?, ?) " + "ON DUPLICATE KEY UPDATE " + "name = VALUES(name), " + "id = LAST_INSERT_ID(id)"); ps.setString(1, "McMack, Mike"); ps.setString(2, "mike@example.com"); int euReturnValue = ps.executeUpdate(); System.out.printf("executeUpdate returned %d%n", euReturnValue); Statement s = dbConnection.createStatement(); ResultSet rs = s.executeQuery("SELECT LAST_INSERT_ID() AS n"); rs.next(); int affectedId = rs.getInt(1); if (euReturnValue == 1) { System.out.printf(" =&gt; A new row was inserted: id=%d%n", affectedId); } else { System.out.printf(" =&gt; An existing row was updated: id=%d%n", affectedId); } produces the following console output executeUpdate returned 1 =&gt; A new row was inserted: id=3 Now run the same code again with the parameter values ps.setString(1, "Loblaw, Robert"); ps.setString(2, "bob@example.com"); and the console output is executeUpdate returned 2 =&gt; An existing row was updated: id=1 This demonstrates that .executeUpdate really can return 2 if the unique index causes an existing row to be updated. If you require further assistance with your actual test code then you should edit your question to include it. Edit Further testing reveals that .executeUpdate will return 1 if the attempted INSERT is aborted because it would result in a duplicate UNIQUE key value, and the specified ON DUPLICATE KEY UPDATE changes …
has comment: http://stackoverflow.com/comment/47540996
has comment: http://stackoverflow.com/comment/47540469
has comment: http://stackoverflow.com/comment/47539645
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/34678339
upvote count: 9

http://stackoverflow.com/comment/34563193
type: Comment
comment on: http://stackoverflow.com/a/22686885
type: AnswerComment
has text: I see you have a clonedTree, is there another tree in your window?
score: 0

http://stackoverflow.com/comment/34665073
has text: please explain a little. how will it solve the problem of excluding the nested if-else?
comment on: http://stackoverflow.com/q/22743247
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/34774311
score: 0
type: Comment
comment on: http://stackoverflow.com/a/22714347
type: AnswerComment
has text: hey man, I fixed missing brace in my answer and also I forgot to mention that you have to call `child.setClickable(false)`, please see the edit. It works for me, just checked.

http://stackoverflow.com/a/22668530
downvote count: 0
has body: The remember-me namespace element already inserts a RememberMeAuthenticationFilter so it will still take precedence over yours, since it comes before it in the filter chain. If you want to use a custom filter, you should remove the namespace element and use standard Spring beans for the related services. There's an example in the reference manual (Section 11.4.1) which shows the beans needed.
has comment: http://stackoverflow.com/comment/34550021
type: Answer
score: 2
upvote count: 2
has comment: http://stackoverflow.com/comment/34566531
has comment: http://stackoverflow.com/comment/34549803
answers question: http://stackoverflow.com/q/22663488

http://stackoverflow.com/comment/34617211
comment on: http://stackoverflow.com/a/22715686
has text: @PatriciaShanahan: None, I guess. I simply wasn't aware of the built-in function. Check my update.
type: Comment
score: 1
type: AnswerComment

http://stackoverflow.com/q/22725893
possible better answer: http://stackoverflow.com/a/22725953
downvote count: 0
has answer: http://stackoverflow.com/a/22725953
has comment: http://stackoverflow.com/comment/34658186
favorite count: 0
accepted answer: http://stackoverflow.com/a/22726333
tagged with: anonymous-inner-class
tagged with: anonymous
has comment: http://stackoverflow.com/comment/34660469
tagged with: lambda
has answer: http://stackoverflow.com/a/22739391
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/34660473
upvote count: 3
tagged with: java
linked to: http://stackoverflow.com/q/10491002
has title: Confused about anonymous classes vs anonymous inner class
type: Question
score: 3
has comment: http://stackoverflow.com/comment/34635074
has comment: http://stackoverflow.com/comment/34635017
tagged with: anonymous-class
has body: I went searching to learn how to do lambda expressions in Java, but instead a confusion came up for me. So my understanding of an anonymous class is this: public class SomeObject { public static void main(String[] args) { ArrayList list = new ArrayList(); list.add(new SomeObject()); } } I saw the term anonymous inner class before, but at that time, I didn't know what a regular anonymous class was. Lot of threads and videos I'm seeing seem to call anonymous inner classes just "anonymous classes." Are they synonymous? My understanding of anonymous inner class is: public class Rectangle { private double length; private double width; private double perimeter; public void calculatePerimeter() { perimeter = (2*length) +(2*width); } public static void main(String[] args) { Rectangle square = new Rectangle() { public void calculatePerimeter() { perimeter = 4*length; } }; } } So essentially, instead of having to write a subclass for Square, and then override the calculatePerimeter() method, I can just make a one-time square class, and override the method in their. Is this correct? So, anonymous inner classes have to do with inheritance. I'm not understanding the use of it though. Perhaps, it's because I've never used them before, or because I don't have much programming experience. Can you can give me examples or explain when it's useful? UPDATE: When I moved my code for the anonymous inner class to an IDE, I learned that there are errors; So apparently, the "square" doesn't even inherit the fields of the rectangle. Doesn't this make it even more useless? Would the equivalent be: public class Rectangle { private double length; private double width; private double perimeter; public void calculatePerimeter() { perimeter = (2*length) +(2*width); } } public class Square extends Rectangle { @Override public void calculatePerimeter() { perimeter = 4*getLength(); } public double getLength() { return length; } }
has answer: http://stackoverflow.com/a/22726333
answer count: 3

http://stackoverflow.com/comment/34734593
has text: Prakash's answer is the best starting place - but from the question it sounds like you are looking for a more granular security - what defines what students a user can see? is it as simple as a user can either see students or not (in which case basic role-based security will do) or is it that a user can only see select groups of students(e.g. a teacher can only see students they teach)? the latter would prob be easiest to solve with role based plus controller level validation/checking that the request is valid
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/22779912

http://stackoverflow.com/comment/34554568
score: 0
comment on: http://stackoverflow.com/q/22680433
type: QuestionComment
has text: Can you try setting this property to HbaseConfiguration object `hbase.zookeeper.quorum`
type: Comment

http://stackoverflow.com/a/22774782
answers question: http://stackoverflow.com/q/22774673
type: Answer
has body: I ran the code you provided with the input: h.ello and got the output hello I am seeing a fully functional method here. I presume the punctuation you are trying to remove is not part of the ASCII range you provided in the if statement. Check your ASCII values against a chart. ASCII values chart to compare with Without including the proper values the input: h[ello will return the output h[ello because the [ is ASCII value 91, which is outside the range you provided: &gt;= 32 &amp;&amp; &lt;= 46
upvote count: 4
type: AcceptedAnswer
downvote count: 0
score: 4
accepted answer of: http://stackoverflow.com/q/22774673

http://stackoverflow.com/comment/34539198
score: 0
has text: Did you really mean Java or probably JavaScript?
comment on: http://stackoverflow.com/q/22673003
type: Comment
type: QuestionComment

http://stackoverflow.com/q/22718898
has comment: http://stackoverflow.com/comment/34621982
has answer: http://stackoverflow.com/a/22719031
has comment: http://stackoverflow.com/comment/34621906
has body: My program asks the user to enter the first name, last name and age of 5 people and stores them in an array. I want to write a method that asks the user whom they want to delete from the array and then deletes that employee. I know in arrays you cannot technically delete an object from an array, just replace it. This is what I've done so far: private void deleteEmployee(){ Scanner scan = new Scanner(System.in); System.out.println("Enter the first name of the employee you want to delete from the list") String name = scan.nextLine(); for (int i = 0; i &lt; employees.length; i++) { if (employees[i].getFirstName().equals(name)){ employees[i] = employees[employees.length - 1]; break; } if (i == employees.length - 1) { System.out.println("That requested person is not employed at this firm.") } } My problem is that it does not decreases the array size by 1, it just replaces the person I want to delete with the last person in my array. My output has the last employee in the array repeated twice (in it's last index and in the index of the person I wanted to delete) How do I fix this?
accepted answer: http://stackoverflow.com/a/22718980
tagged with: arrays
downvote count: 0
favorite count: 0
has answer: http://stackoverflow.com/a/22719194
has comment: http://stackoverflow.com/comment/34622033
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/22719187
score: 1
tagged with: java
has answer: http://stackoverflow.com/a/22718997
has answer: http://stackoverflow.com/a/22719127
has answer: http://stackoverflow.com/a/22718980
upvote count: 1
has answer: http://stackoverflow.com/a/22719747
has answer: http://stackoverflow.com/a/22726027
type: Question
answer count: 8
has comment: http://stackoverflow.com/comment/34621883
has title: deleting an object from an array [java]
possible better answer: http://stackoverflow.com/a/22718997

http://stackoverflow.com/q/22785320
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/34741256
has title: C# vs. Java: generics covariance and contravariance
score: 3
answer count: 0
upvote count: 3
tagged with: java
has comment: http://stackoverflow.com/comment/34741124
type: Question
tagged with: contravariance
tagged with: c#
has comment: http://stackoverflow.com/comment/34741326
has comment: http://stackoverflow.com/comment/34742086
downvote count: 0
tagged with: covariance
tagged with: generics
has body: Both C# and java implement generics covariance and contravariance, but in a quite different manner: C# restricts co- and contra-variance to generics interfaces, Java enables it to any generics class or method. What are exactly the differences regarding to the syntax? What kind of code is possible in one language that is not possible in the other language? What are the practical limitations due to the lack of integration in their respective framework (i.e. missing implementation of default collection)? Thank you in advance!
favorite count: 0
has comment: http://stackoverflow.com/comment/34747344

linux
tags question: http://stackoverflow.com/q/22755238
tags question: http://stackoverflow.com/q/22670027
tags question: http://stackoverflow.com/q/22658461
tags question: http://stackoverflow.com/q/22674529
tags question: http://stackoverflow.com/q/22675206
tags question: http://stackoverflow.com/q/22711557
tags question: http://stackoverflow.com/q/22689847
tags question: http://stackoverflow.com/q/22663876
tags question: http://stackoverflow.com/q/22769076
type: Tag
tags question: http://stackoverflow.com/q/22704650
tags question: http://stackoverflow.com/q/22779300
tag name: linux
tags question: http://stackoverflow.com/q/22752240
tags question: http://stackoverflow.com/q/22797246
tags question: http://stackoverflow.com/q/22656336
tags question: http://stackoverflow.com/q/22712080
tags question: http://stackoverflow.com/q/22793892
tags question: http://stackoverflow.com/q/22732503
tags question: http://stackoverflow.com/q/22755100
tags question: http://stackoverflow.com/q/22705689
tags question: http://stackoverflow.com/q/22710518

http://stackoverflow.com/comment/34511871
type: AnswerComment
has text: u can use log4j or log4j2 am just providing an xml for log4j xml based appender Structure here
score: 0
type: Comment
comment on: http://stackoverflow.com/a/22657848

http://stackoverflow.com/a/22784090
has comment: http://stackoverflow.com/comment/34738824
has body: This is a new Time/Date API which is introduced in Java 8. That's why it does not compile with Java 7. toInstant() is a default method, whereas -source 1.7 doesn't support default methods (Java 8's new feature).
type: Answer
answers question: http://stackoverflow.com/q/22784030
upvote count: 12
has comment: http://stackoverflow.com/comment/34738946
accepted answer of: http://stackoverflow.com/q/22784030
score: 12
type: AcceptedAnswer
downvote count: 0

http://stackoverflow.com/comment/39570307
comment on: http://stackoverflow.com/a/22688087
type: AnswerComment
score: 0
has text: Does log4j 2 still use a properties file? I can't find any mention of that in the [log4j web site](http://logging.apache.org/log4j/2.x/manual/configuration.html)
type: Comment

http://stackoverflow.com/a/22760712
type: Answer
answers question: http://stackoverflow.com/q/22757852
has body: First, unless you computed the fundamental matrix by taking explicitly into account the inverse of the camera matrix, you are not in the calibrated case, hence the fundamental matrix you estimate is not an essential matrix. This is also quite easy to test: you just have to eigen-decompose the fundamental matrix and see whether the two non-zero eigen-values are equal (see § 9.6.1 in Hartley&amp;Zisserman's book). Second, both the fundamental matrix and the essential matrix are defined for two cameras and do not make sense if you consider only one camera. If you do have two cameras, with respective matrices K1 and K2, then you can obtain the essential matrix E12, given the fundamental matrix F12 (which maps points in I1 to lines in I2), using the following formula (see equation 9.12 in Hartley&amp;Zisserman's book): E12 = K2T . F12 . K1 In your case, you used K2 on both sides.
score: 0

http://stackoverflow.com/comment/34696047
type: Comment
type: QuestionComment
has text: I have GPS rev 16 in my app, and see the crashlog with the same exception...
score: 0
comment on: http://stackoverflow.com/q/22672846

json-rpc
tag name: json-rpc
type: Tag
tags question: http://stackoverflow.com/q/22763994
tags question: http://stackoverflow.com/q/22789635

http://stackoverflow.com/comment/34675236
score: 0
has text: @fge To be sure, if i would have some more threads and more consumers (but still not modify the original list outside OrderScheduler) then it would be better to use synchronized list ?
type: Comment
type: AnswerComment
comment on: http://stackoverflow.com/a/22747707

http://stackoverflow.com/a/22718835
upvote count: 1
score: 1
has comment: http://stackoverflow.com/comment/34622229
downvote count: 0
type: Answer
has body: I think that what you searching for is the mark method, you can read about it (and see a usage example) here: http://www.tutorialspoint.com/java/io/bufferedreader_mark.htm
answers question: http://stackoverflow.com/q/22718712

http://stackoverflow.com/comment/34663199
score: 0
has text: What's your desired outcome? print the duplicates? print the count of duplicates? How is 5 4 2 3 correct? it's neither the array without duplicates nor their count.
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/22742172

http://stackoverflow.com/a/38626592
has body: ViewCompat.setTranslation(getView, 100.f); look for https://stackoverflow.com/a/33816251/6642400
answers question: http://stackoverflow.com/q/22682790
score: 0
type: Answer

http://stackoverflow.com/comment/34671851
has text: call this code when the tab change?
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/22746846

http://stackoverflow.com/comment/34550688
score: 0
type: Comment
has text: Missing 3rd row elemets(2,5,8,..ect)please check your output once.
comment on: http://stackoverflow.com/a/22679410
type: AnswerComment

http://stackoverflow.com/comment/34799969
type: QuestionComment
has text: @Vadzim: Not sure how to debug JSPs. Tile particularly. Can you share something?
comment on: http://stackoverflow.com/q/22731864
score: 0
type: Comment

http://stackoverflow.com/comment/34639051
type: AnswerComment
comment on: http://stackoverflow.com/a/22712420
type: Comment
has text: Can you elaborate what is JIT warm up ,If I am not wrong you are doing warm up in side main method by that for loop . thanks for your detailed explanation
score: 0

http://stackoverflow.com/q/22685527
has comment: http://stackoverflow.com/comment/34561479
has comment: http://stackoverflow.com/comment/34562289
has comment: http://stackoverflow.com/comment/34562560
has title: MEKA >> Error: Could not find or load main class .\lib\Jama.jar
has comment: http://stackoverflow.com/comment/34561508
has comment: http://stackoverflow.com/comment/34562298
has answer: http://stackoverflow.com/a/22686749
has comment: http://stackoverflow.com/comment/34562157
has comment: http://stackoverflow.com/comment/34561259
has comment: http://stackoverflow.com/comment/34562652
type: AnsweredQuestion
has body: I have Windows7 OS and want to use MEKA GUI what I did is the following: downloading meka-release1.5.zip from http://sourceforge.net/projects/meka/files/meka-1.5.0/ extracting it, and type run.bat in cmd.exe But I had the following Error : Error: Could not find or load main class .\lib\Jama.jar Can any one help with clear steps how to install and use MEKA EXplorer?
tagged with: java
possible better answer: http://stackoverflow.com/a/23147657
has comment: http://stackoverflow.com/comment/34561815
has answer: http://stackoverflow.com/a/23147657
type: Question
score: 0
tagged with: weka
answer count: 2
has comment: http://stackoverflow.com/comment/34561571
has comment: http://stackoverflow.com/comment/34562486
accepted answer: http://stackoverflow.com/a/22686749
has comment: http://stackoverflow.com/comment/34561554
has comment: http://stackoverflow.com/comment/34561928

http://stackoverflow.com/a/22782623
answers question: http://stackoverflow.com/q/22782489
has comment: http://stackoverflow.com/comment/34736720
upvote count: 1
has comment: http://stackoverflow.com/comment/34736078
score: 1
has comment: http://stackoverflow.com/comment/34735904
has body: Is there any warning when you opening the project in netbeans.Right click on the project , select resolve server missing problem.Choose Glassfish server.Run once again.
downvote count: 0
type: Answer

http://stackoverflow.com/comment/34642931
score: 0
type: Comment
has text: The exception is still thrown. It doesn't matter when it executes the inserts in de DB. Whenever it tries to insert Incidencia the exception is thrown. This is the metamodel: id java.lang.Long BASIC fechaYHora java.util.Date BASIC createdBy java.lang.String BASIC lastModifiedDate org.joda.time.DateTime BASIC descripcion java.lang.String BASIC version int BASIC createdDate org.joda.time.DateTime BASIC lastModifiedBy java.lang.String BASIC usuario com.pericles.cooperativa.gestion.domain.Usuario MANY_TO_ONE proyecto com.pericles.cooperativa.gestion.domain.Proyecto MANY_TO_ONE
type: QuestionComment
comment on: http://stackoverflow.com/q/22698405

http://stackoverflow.com/comment/34496197
comment on: http://stackoverflow.com/q/22648305
has text: For ex: I am executing the jenkins CI build. In every build we can see the execution logs, those logs displayed with few delay. I need those logs to be generate in new window without any delay (real time logs) The live and actual logs from the every single line of execution should be logged in console. Whenever the user triggering a build, Each and every action should monitor and produce the log.
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/q/22731225
tagged with: spring
answer count: 1
upvote count: 6
tagged with: spring-mvc
tagged with: spring-boot
has body: I tried to make a simple Spring Boot web application: POM: org.springframework.boot spring-boot-starter-parent 1.0.0.BUILD-SNAPSHOT org.springframework.boot spring-boot-starter-actuator org.springframework.boot spring-boot-starter-web org.springframework.boot spring-boot-starter-test test Main class: @ComponentScan(basePackages={"controller"}) @Import(MvcConfig.class) @EnableAutoConfiguration public class Application { public static void main(String[] args) { SpringApplication.run(Application.class, args); } } the controller: @Controller @RequestMapping("/home") public class HomeController { @RequestMapping("/hello") @ResponseBody public String hello(){ return "hello"; } @RequestMapping("/helloView") public String helloView(){ return "homeView"; } } Also under src/main i got src -main -resources applicaion.properties -webapp -WEB-INF -jsp -homeView.jsp In application.properties I got: spring.view.prefix: /WEB-INF/jsp/ spring.view.suffix: .jsp The rest endpoint /home/hello works, but the other one can't open the jsp. In the log i got Looking up handler method for path /WEB-INF/jsp/homeView.jsp Did not find handler method for [/WEB-INF/jsp/homeView.jsp] Where should I put the views so the app can find them?
tagged with: java
has comment: http://stackoverflow.com/comment/34667161
has answer: http://stackoverflow.com/a/22731516
downvote count: 0
score: 6
has title: Spring Boot Web starter views location
type: AnsweredQuestion
favorite count: 0
accepted answer: http://stackoverflow.com/a/22731516
type: Question

http://stackoverflow.com/q/22653683
upvote count: 1
has comment: http://stackoverflow.com/comment/34771914
downvote count: 1
favorite count: 0
has comment: http://stackoverflow.com/comment/34519221
has comment: http://stackoverflow.com/comment/34775497
has comment: http://stackoverflow.com/comment/34516940
has answer: http://stackoverflow.com/a/22653785
has body: When you go through android Hello world app, open the jar file that contains android.view package and look at AbsSavedState.Class you can see that it is a super class. How can I display all its sub classes (inner classes) using java reflection?
has comment: http://stackoverflow.com/comment/34504685
has title: how to get list of subclass with in super class using java reflection in android project
has comment: http://stackoverflow.com/comment/34548999
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/34554425
has comment: http://stackoverflow.com/comment/34556459
tagged with: reflection
tagged with: java
has comment: http://stackoverflow.com/comment/34773451
has answer: http://stackoverflow.com/a/22653849
accepted answer: http://stackoverflow.com/a/22653849
has comment: http://stackoverflow.com/comment/34551349
has comment: http://stackoverflow.com/comment/34774429
type: Question
possible better answer: http://stackoverflow.com/a/22653785
has comment: http://stackoverflow.com/comment/34773917
has comment: http://stackoverflow.com/comment/34771552
score: 0
answer count: 2
has comment: http://stackoverflow.com/comment/34553825

http://stackoverflow.com/q/22676443
has body: I was wondering how can anyone make graphics such as this one https://play.google.com/store/apps/details?id=com.surpax.ledflashlight.panel in android. By graphics iam referring to the interface. Did he use the eclipse or another tool? Thanks in advance.
has title: Making a graphical flashlight in android
tagged with: java
tagged with: eclipse
type: Question
upvote count: 0
answer count: 1
has comment: http://stackoverflow.com/comment/34545817
tagged with: android
score: -2
favorite count: 0
type: UnansweredQuestion
downvote count: 2
has answer: http://stackoverflow.com/a/22676669

http://stackoverflow.com/comment/34667308
has text: Learning the API's more comprehensively is exactly why I am reading the books. However, everything seems to be written on Lucene 3.x, not 4.x :S
type: QuestionComment
comment on: http://stackoverflow.com/q/22744277
type: Comment
score: 0

http://stackoverflow.com/a/22695719
upvote count: 2
score: 2
has comment: http://stackoverflow.com/comment/34581487
has comment: http://stackoverflow.com/comment/34581800
answers question: http://stackoverflow.com/q/22695507
type: AcceptedAnswer
downvote count: 0
accepted answer of: http://stackoverflow.com/q/22695507
has comment: http://stackoverflow.com/comment/34581828
has body: You can use an index parameter to know where in the array you are checking. public static int EvenNum(int[] arr, int index) { if (index == arr.length) return 0; // Stop recursion //return (arr[index] % 2 == 0 ? 1 : 0) + EvenNum(arr, index + 1); // or.... int result; if ((arr[index] % 2) == 0) { // Is even result = 1; } else { // Is odd result = 0; } return result + EvenNum(arr, index + 1); } public static void main(final String... args) { // Start with index = 0 System.out.println(EvenNum(new int[]{1,2,3,4,5}, 0)); }
type: Answer

http://stackoverflow.com/a/27558790
answers question: http://stackoverflow.com/q/22707501
score: 0
has body: I know that topic is about Tomcat, but I had the same problem with Glassfish, maybe it could be helpful - I've changed java version for Glassfich to java 1.8 (after install it :) )
type: Answer

http://stackoverflow.com/comment/34501248
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/22651480
has text: @Soham - Yeah, you have to be careful about those leading zeros; they mean more to us humans than they do to the Java compiler :)
score: 1

http://stackoverflow.com/comment/34754951
comment on: http://stackoverflow.com/q/22792842
has text: Possibly related to this bug? http://bugs.java.com/view_bug.do?bug_id=8023130 Although it's going to be pretty hard to help you without knowing what fff.exe actually does. You might want to try to put together a simpler example that uses a basic command instead.
score: 0
type: QuestionComment
type: Comment

http://stackoverflow.com/q/22785501
has title: Boostrap Data On Start-Up , Spring MVC, Hibernate
has body: I'am working on J2EE spring Mvc Based App with hibernate And Spring Security, And I want to bootstrap some data on Start-up ( one and only one time during the app life Cycle ), I'm Using hbm2ddl to create tables after launching the application, but they are empty, so I need to add instances to the database ( Username , password ... ) So I can test my App on development mode. Thanks
tagged with: java
tagged with: hibernate
has answer: http://stackoverflow.com/a/22785928
type: Question
accepted answer: http://stackoverflow.com/a/22785928
answer count: 1
downvote count: 0
tagged with: spring-security
favorite count: 0
upvote count: 2
tagged with: spring
tagged with: spring-mvc
score: 2
type: AnsweredQuestion

http://stackoverflow.com/comment/48010926
type: Comment
has text: Works perfect on Windows, tested it in my current project.
type: AnswerComment
score: 0
comment on: http://stackoverflow.com/a/29942660

http://stackoverflow.com/comment/38169973
type: Comment
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/22692491
has text: now what if i want to post data using POST? cause GET is not safe

http://stackoverflow.com/comment/34597451
has text: Read http://stackoverflow.com/questions/12480724/how-to-get-the-date-taken-and-display-it
type: Comment
type: QuestionComment
score: 0
comment on: http://stackoverflow.com/q/22705332

http://stackoverflow.com/q/22793616
accepted answer: http://stackoverflow.com/a/22793997
favorite count: 0
has answer: http://stackoverflow.com/a/66646998
answer count: 5
linked to: http://stackoverflow.com/q/12370544
tagged with: integer
tagged with: immutability
has answer: http://stackoverflow.com/a/22795521
linked to: http://stackoverflow.com/q/16903637
linked to: http://stackoverflow.com/q/5560176
has answer: http://stackoverflow.com/a/22793997
type: AnsweredQuestion
tagged with: java
possible better answer: http://stackoverflow.com/a/22793630
has title: Why are Integers immutable in Java?
has answer: http://stackoverflow.com/a/22793630
type: Question
score: 12
upvote count: 12
has body: I know Integers are immutable in Java. But why it is designed this way? I went through other answers before asking this question: Is Integer Immutable i++ still working for immutable Integer in Java? Why are Java wrapper classes immutable? But I couldn't find the use case which mandates the Integer to be immutable. Are there any technical reasons like there are for String? String is used as parameter in network connection, database URLs etc. It could easily be compromised if it was mutable. To support StringPool facility. To support class loading mechanism in which Strings are used as arguments. String being mutable results in a wrong class being loaded. I understand there are wrappers like AtomicInteger for mutable. UPDATE: From the conversation, there is no universal reason that could mandate the Integers being immutable. However by doing immutable it provides some bonus as mentioned in the answers. Such as this quote from Andrey possibility to cache. Others are reducing global state easier multithreading
has comment: http://stackoverflow.com/comment/70189699
has answer: http://stackoverflow.com/a/29562154
downvote count: 0

http://stackoverflow.com/comment/34547966
type: QuestionComment
comment on: http://stackoverflow.com/q/22677957
has text: I assume it runs fine on the emulator?
score: 0
type: Comment

http://stackoverflow.com/a/22649748
has body: This Class runs fine for me, issue is there must be some other Customer class in your package or application which doesnt have constructor public Customer(String name, double debt) . Try clicking Ctrl + Shift + R and search Customer or Press Ctrl + H, search Customer in all java files
answers question: http://stackoverflow.com/q/22649610
downvote count: 0
has comment: http://stackoverflow.com/comment/109429547
score: 4
type: Answer
upvote count: 4

http://stackoverflow.com/comment/34537757
type: QuestionComment
has text: @SanJacinto That is what I was assuming as well haha. Do you know of some sort of standard of which to read in bytes. (By this I mean how many bytes should I read into one block at a time? Is there a standard amount?)
comment on: http://stackoverflow.com/q/22672103
score: 0
type: Comment

http://stackoverflow.com/comment/34653927
score: 0
type: Comment
has text: This could "choke" the system; assumes the op needs to use Swing (or AWR) to monitor for key strokes, sch was unclear from he question and just as easily be achieved with a Swing Timer
comment on: http://stackoverflow.com/a/22736110
type: AnswerComment

http://stackoverflow.com/comment/34710717
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/22768373
has text: Your second point and one missing point can be combined and generalized as `sign(a.compareTo(b)) = -sign(b.compareTo(a))` - remember, `a.compareTo(b)` must give the opposite ordering of `b.compareTo(a)` if `a!=b`; this is one of the most common implementation mistakes.
type: Comment

http://stackoverflow.com/comment/34629300
score: 0
type: Comment
comment on: http://stackoverflow.com/q/22698439
has text: Well,I looked through the RapidMiner forums, did some modifications... But the following error still exists: 'Cannot resolve relative repository location 'lsvmword'. Process is not associated with a repository.' Any idea how to resolve this?
type: QuestionComment

http://stackoverflow.com/comment/34686647
type: Comment
score: 1
has text: The short answer is right. The one-liners proposed will succeed in simple cases but fail in the general case.
comment on: http://stackoverflow.com/a/22753957
type: AnswerComment

http://stackoverflow.com/q/22693714
score: 0
has body: I have no idea why this is not working. In a different project it works without problem with more complicated objects (that even have nested objects). Do i miss something painfully obvious? How my json looks in file: { "masterPort": 5000, "errorLog": "aaaa" } Part of function where i load the json: File configFile = new File(pathToConfig); try { BufferedReader br = new BufferedReader(new FileReader(configFile)); Configuration a = gson.fromJson(br, Configuration.class); // &lt;---- here it fails :( } catch ( catch blocks ) { /*error handling*/ } And my configuration class: public class Configuration { int masterPort = 5000; String errorLog = "xvdsaf"; } Stack trace this is the whole thing and it baffles me: java.lang.NullPointerException at config.MasterConfiguration.load(MasterConfiguration.java:37) at config.MasterConfiguration.load(MasterConfiguration.java:30) at bs.Manager.loadConfiguration(Manager.java:43) at bs.Manager.main(Manager.java:22)
has comment: http://stackoverflow.com/comment/34575886
has comment: http://stackoverflow.com/comment/34575952
answer count: 1
has answer: http://stackoverflow.com/a/22693776
has title: Gson object deserialization - null pointer failure
has comment: http://stackoverflow.com/comment/34575924
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/34575894
type: Question
has comment: http://stackoverflow.com/comment/34586902
tagged with: java
tagged with: http://stackoverflow.com/tag/json
tagged with: gson
accepted answer: http://stackoverflow.com/a/22693776
has comment: http://stackoverflow.com/comment/34575794

http://stackoverflow.com/comment/34684474
has text: It fix the error but I have more then that in the file. It only give me model.Game@77011e14
comment on: http://stackoverflow.com/a/22753447
type: AnswerComment
score: 0
type: Comment

stax
tags question: http://stackoverflow.com/q/22726061
type: Tag
tags question: http://stackoverflow.com/q/22701467
tags question: http://stackoverflow.com/q/22781292
tag name: stax

http://stackoverflow.com/a/47881501
score: 0
has body: You need to diagnosis the jvm usages like how many process is running and what about heap allocation. there exists a lot of ways to do that for example you can use java jcmd to check number of object, size of memory (for linux you can use for example "/usr/jdk1.8.0_25/bin/jcmd 19628 GC.class_histogram > /tmp/19628_ClassHistogram_1.txt", here 19628 is the running application process id). You can easily check if any strong reference exists in your code or else.
type: Answer
answers question: http://stackoverflow.com/q/22805552

http://stackoverflow.com/comment/34573085
type: Comment
type: QuestionComment
score: 1
comment on: http://stackoverflow.com/q/22692197
has text: Have you changed nextInt() to next or nextLine()?

http://stackoverflow.com/comment/34737460
comment on: http://stackoverflow.com/q/22783153
has text: @user3357221: So read up on collections (that's the API side) and the differences of their implementations (eg. ArrayList vs LinkedList) and summarize all this with potential use cases and advantages/drawbacks. If you want to sound cool, you can even say a few things about the newly introduced streams (Java 8).
type: Comment
type: QuestionComment
score: 0

http://stackoverflow.com/comment/34749003
comment on: http://stackoverflow.com/q/22789073
type: QuestionComment
type: Comment
has text: @Yuval yea that would be great. But i am working on a 5 year old laptop with 1 screen only :P
score: 0

http://stackoverflow.com/comment/83937013
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/31032380
type: Comment
has text: @user1870400 Yes, it does, if those objects follow some simplified JavaBeans conventions: no-arg constructor; public setter and getters for each property, or the property is of a type supported by a `Config.getXXX()` method. This means the declared type of the property must be the concrete type to be instantiated.

http://stackoverflow.com/q/22673629
type: Question
has title: Shifting bits for clearing the canvas, need the explanation for a short code
has answer: http://stackoverflow.com/a/22673731
answer count: 2
downvote count: 0
has body: I would just need an explanation for this little chunk of code, since I'm having problems by looking in Java documentation. The code: public void clear(int color) { canvas.drawRGB((color &amp; 0xff0000) &gt;&gt; 16, (color &amp; 0xff00) &gt;&gt; 8, (color &amp; 0xff)); } This is from the book Beginning Android Games and the explanation below the code says: The clear() method extracts the red, green, and blue components of the specified 32-bit ARGB color parameter and calls the Canvas.drawRGB() method, which clears our artificial framebuffer with that color. This method ignores any alpha value of the specified color, so we don’t have to extract it. I understand the point but not really the implementation, can someone help? Thank you.
favorite count: 0
accepted answer: http://stackoverflow.com/a/22673731
has answer: http://stackoverflow.com/a/22673712
tagged with: android
upvote count: 1
type: AnsweredQuestion
possible better answer: http://stackoverflow.com/a/22673712
score: 1
tagged with: java
tagged with: bitwise-operators

http://stackoverflow.com/a/22731598
downvote count: 0
answers question: http://stackoverflow.com/q/22714223
type: Answer
score: 1
upvote count: 1
accepted answer of: http://stackoverflow.com/q/22714223
has body: There isn't a nice way and it doesn't seem to be a good idea to do this. Your frontend should call your backend not the other way. So the easiest way to do this would be to store the errors inside your service and have your page get these. class MyService { private String error; public void doBackEndThing(){ try { backEndService.doRemoteCall(); } catch (BackendException e) { error ="Backend is currently not available"; } } } and class MyPage extends WebPage { private MySerivce service; public void doSomethingFrontendy() { error = service.getError(); } } or you could return an error from your backend method or throw an Exception and handle this in your WebPage or use IRequestCycleListener#onException() like @svenmeier pointed out.
type: AcceptedAnswer

http://stackoverflow.com/comment/34535517
score: 0
type: Comment
has text: Thanks, this helps. I have one question: Why are you iterating through the entire list [for(int i=0;i<students.size();i+=2)]?
comment on: http://stackoverflow.com/a/22670972
type: AnswerComment

http://stackoverflow.com/a/26044698
answers question: http://stackoverflow.com/q/22718954
downvote count: 0
score: 1
upvote count: 1
has body: Not sure if this answers the question exactly, but here's a bit of code I found to read files from the sd card. If you're downloading the files to external storage, this should work for you: SLchar path[] = "/sdcard/audio/my_audio.mp3" ; SLDataLocator_URI loc_uri = {SL_DATALOCATOR_URI, path}; SLDataFormat_MIME format_mime = {SL_DATAFORMAT_MIME, NULL, SL_CONTAINERTYPE_UNSPECIFIED}; SLDataSource audioSrc = {&amp;loc_uri, &amp;format_mime};
type: Answer

http://stackoverflow.com/comment/34800554
type: QuestionComment
score: 0
has text: *Shall I delete this post?* - well, instead of deleting it you could answer it yourself, posting your new `renderSubscriptionNew` code and a short explanation.
type: Comment
comment on: http://stackoverflow.com/q/22774668

http://stackoverflow.com/q/22687375
linked to: http://stackoverflow.com/q/429114
favorite count: 0
has comment: http://stackoverflow.com/comment/34563903
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/22687555
score: -1
has body: I have a subclass that extends a superclass, and the method that I have written in the subclass (Get Insurance Cost) is not being recognised by the superclass. When the button is pressed to Calculate the insurance cost, nothing happens, and in the superclass, the words getinsurance are underlined in red - meaning that it cannot locate the method. if (arg.equals("Calculate Insurance")) { String valueStr = insurancevaluetextField.getText(); value = Double.parseDouble(valueStr); add (insuranceDisplayArea); insuranceDisplayArea.setText("The insurance charge for your package is: $" + df.format(getInsurancecost()) + "\n"); }
has comment: http://stackoverflow.com/comment/34563925
has answer: http://stackoverflow.com/a/22687466
downvote count: 1
type: Question
has title: Java - how to get subclass method to superclass
has comment: http://stackoverflow.com/comment/34564046
tagged with: java
answer count: 3
upvote count: 0
has answer: http://stackoverflow.com/a/22687576

http://stackoverflow.com/comment/34632242
has text: yes my own stack class
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/22724282

http://stackoverflow.com/q/22667237
has comment: http://stackoverflow.com/comment/34528990
type: Question
has body: I wrote a code in Windows using Eclipse. The code used JUnit. I converted it to a .jar file Ubuntu. However, when I try to open the .jar file in Windows in Eclipse, the code does not open. Instead of code, I see some random characters in Eclipse.
upvote count: 0
score: -2
answer count: 1
tagged with: jar
has comment: http://stackoverflow.com/comment/34529028
tagged with: ubuntu
has comment: http://stackoverflow.com/comment/34528776
has comment: http://stackoverflow.com/comment/34528699
favorite count: 0
has answer: http://stackoverflow.com/a/22667795
tagged with: junit
has comment: http://stackoverflow.com/comment/34528903
has comment: http://stackoverflow.com/comment/34529073
type: UnansweredQuestion
downvote count: 2
has comment: http://stackoverflow.com/comment/34528891
has comment: http://stackoverflow.com/comment/34528828
has title: jar file made in ubuntu does not work in windows
tagged with: java

http://stackoverflow.com/comment/34554353
has text: yes. I didn't need -1. After my new changes, program shows all 10 elements, but of course then it prints null and starts to print craps. I abandoned idea of constructor of third list and simple added method addAll(Lista lista) to Lista class. I assume now my only problem is head.previous. The method looks like that:
type: AnswerComment
score: 0
type: Comment
comment on: http://stackoverflow.com/a/22673800

http://stackoverflow.com/a/47881152
answers question: http://stackoverflow.com/q/22805552
upvote count: 4
has body: If you are using Virtual Machine (VM), allocate more RAM to your VM and your problem will be solved.
score: 4
downvote count: 0
type: Answer

http://stackoverflow.com/a/22654094
type: Answer
has body: Use FileInputStream(new File("files/storetime.txt")); don't use /file -> it will check for /file partition in linux as /root
score: 1
answers question: http://stackoverflow.com/q/22654041
upvote count: 1
downvote count: 0

http://stackoverflow.com/q/22675242
has comment: http://stackoverflow.com/comment/34544295
has comment: http://stackoverflow.com/comment/34543783
downvote count: 0
has comment: http://stackoverflow.com/comment/34543626
tagged with: icons
possible better answer: http://stackoverflow.com/a/22675507
has answer: http://stackoverflow.com/a/22676426
has comment: http://stackoverflow.com/comment/34544277
has comment: http://stackoverflow.com/comment/34544204
favorite count: 0
tagged with: jlabel
has comment: http://stackoverflow.com/comment/34543467
upvote count: 1
tagged with: swing
accepted answer: http://stackoverflow.com/a/22676426
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/34543349
has body: I have been trying for a couple days now to get this image called star1.png to show up. I am trying to "shoot" it out from my stick man but I can't even get the image to show up. Any help would be greatly appreciated. Thanks package my.testing1; import java.awt.*; import javax.swing.*; import java.awt.event.*; /** * * @author Jamie */ public class GUI extends javax.swing.JFrame { JLabel label = new JLabel(new ImageIcon("C:\\Users\\Jamie\\Desktop\\Java\\stickman.png")); JLabel cords = new JLabel(); JLabel bg = new JLabel(new ImageIcon("C:\\Users\\Jamie\\Desktop\\Java\\background.png")); JLabel star = new JLabel(new ImageIcon("C:\\Users\\Jamie\\Desktop\\Java\\star1.png")); int locx = 0; int locy = 0; int i = 0; int x = label.getX(); int y = label.getY(); String cor= Integer.toString(x) +" "+ Integer.toString(y); boolean ph = true; boolean left = true; boolean Sph = true; public GUI() { this.setSize(800,600); this.cords.setText(cor); label.setBounds(x,y,120,120); cords.setBounds(20,170,50,50); bg.setBounds(0,0,800,600); //star.setBounds(x,y,50,50); cor= Integer.toString(x) + " "+ Integer.toString(y); label.addKeyListener(new KeyAdapter() { @Override public void keyPressed(KeyEvent ke) { if (ke.getKeyCode() == KeyEvent.VK_S) { //locx=label.getX(); //locy=label.getY(); ImageIcon newIcon = new ImageIcon("C:\\Users\\Jamie\\Desktop\\Java\\star1.png"); star.setIcon(newIcon); star.setLocation(300,300); } if(ke.getKeyCode() == KeyEvent.VK_DOWN) { if (y&gt;0 | y==0) { y=y+10; } if (y&gt;440) { y=y-10; } label.setLocation(x,y); if(ph == false) { if(left == true) { ImageIcon newIcon = new ImageIcon("C:\\Users\\Jamie\\Desktop\\Java\\stickman2Left.png"); //newIcon.getImage().flush(); label.setIcon(newIcon); } else { ImageIcon newIcon = new ImageIcon("C:\\Users\\Jamie\\Desktop\\Java\\stickman2.png"); label.setIcon(newIcon); } ph = true; } else { if(left == true) { ImageIcon newIcon = new ImageIcon("C:\\Users\\Jamie\\Desktop\\Java\\stickmanLeft.png"); //newIcon.getImage().flush(); la…
score: 1
has comment: http://stackoverflow.com/comment/34543919
tagged with: java
has comment: http://stackoverflow.com/comment/34543731
has comment: http://stackoverflow.com/comment/34543577
tagged with: image
has comment: http://stackoverflow.com/comment/34544120
type: Question
has answer: http://stackoverflow.com/a/22675507
has title: Can't get Icon image to show
answer count: 2
has comment: http://stackoverflow.com/comment/34544005

http://stackoverflow.com/q/22695507
upvote count: 1
has comment: http://stackoverflow.com/comment/34579172
linked to: http://stackoverflow.com/q/392932
type: Question
has comment: http://stackoverflow.com/comment/34579194
score: -2
possible better answer: http://stackoverflow.com/a/22695709
has answer: http://stackoverflow.com/a/22695709
has comment: http://stackoverflow.com/comment/34581468
accepted answer: http://stackoverflow.com/a/22695719
answer count: 2
has body: I want to find the number of even numbers in an array of integers. so far i wrote this code public static int EvenNum(int[] arr) { int index = 0; if (arr[index] % 2 == 1) { return 0; } else if (arr[index] % 2 == 0) { return 1; } index++; return index + EvenNum(arr); } please help me make this code run
has comment: http://stackoverflow.com/comment/34581419
tagged with: arrays
has comment: http://stackoverflow.com/comment/34579467
has comment: http://stackoverflow.com/comment/34579139
favorite count: 0
has comment: http://stackoverflow.com/comment/34581333
has comment: http://stackoverflow.com/comment/34582216
has title: counting the even numbers in an array of integers using recursion
has comment: http://stackoverflow.com/comment/34580782
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/22695719
tagged with: java
downvote count: 3

http://stackoverflow.com/comment/34571706
type: AnswerComment
comment on: http://stackoverflow.com/a/22673350
has text: This is exactly what I was looking for. And, yes the TrustAllTrustManager was just for testing purposes. I appreciate your time, thank you!
type: Comment
score: 0

http://stackoverflow.com/comment/54276347
comment on: http://stackoverflow.com/a/22817208
type: Comment
has text: Unfortunately for me not :-(. Adding the listener to layout causes link failure.
score: 0
type: AnswerComment

http://stackoverflow.com/comment/34570513
type: Comment
comment on: http://stackoverflow.com/q/22690761
score: 0
type: QuestionComment
has text: Are you trying to collection unique categories (strings) in the list?

http://stackoverflow.com/q/22776981
type: UnansweredQuestion
tagged with: soap
tagged with: web-services
has answer: http://stackoverflow.com/a/22779007
score: 1
tagged with: java
upvote count: 1
tagged with: content-type
type: Question
has body: I am writing a Java client to call a SOAP web service.It accepts a file as an attachment so in java, I need to declare the content type as multipart.I am using apache http library to write Java client. I specified it i Java as below httppost.setHeader( "Content-Type", "multipart/related" ); but I got the below error Couldn't create SOAP message due to exception: javax.xml.ws.WebServiceException: MIME boundary parameter not foundmultipart/related Please let me know how to resolve this error. What should be the content type to be specified in Java. When I specified it as httppost.setHeader( "Content-Type", "text/xml; charset=utf-8" ); Again, i got the below exception Caused by: com.sun.xml.ws.streaming.XMLStreamReaderException: XML reader error: com.ctc.wstx.exc.WstxUnexpectedCharException: Unexpected character '-' (code 45) in prolog; expected '&lt;' Which one should i go ahead with and how to resolve the respective exception?
downvote count: 0
tagged with: mime
answer count: 1
favorite count: 0
has title: Content type for multi-part request in soap web services

http://stackoverflow.com/comment/34731516
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/22779823
has text: i want db connection type help your reference is very simple thanx for sharing
score: 0

sql
tags question: http://stackoverflow.com/q/22648737
tags question: http://stackoverflow.com/q/22693020
tags question: http://stackoverflow.com/q/22679128
tags question: http://stackoverflow.com/q/22736995
tags question: http://stackoverflow.com/q/22793368
tags question: http://stackoverflow.com/q/22744728
tags question: http://stackoverflow.com/q/22683284
tags question: http://stackoverflow.com/q/22729855
tags question: http://stackoverflow.com/q/22765655
tags question: http://stackoverflow.com/q/22790052
tags question: http://stackoverflow.com/q/22792711
tags question: http://stackoverflow.com/q/22713356
tags question: http://stackoverflow.com/q/22806770
tags question: http://stackoverflow.com/q/22751071
tags question: http://stackoverflow.com/q/22791446
tags question: http://stackoverflow.com/q/22782683
tags question: http://stackoverflow.com/q/22745021
tags question: http://stackoverflow.com/q/22787153
tags question: http://stackoverflow.com/q/22760643
tags question: http://stackoverflow.com/q/22700410
tag name: sql
type: Tag
tags question: http://stackoverflow.com/q/22766911
tags question: http://stackoverflow.com/q/22782706
tags question: http://stackoverflow.com/q/22725395
tags question: http://stackoverflow.com/q/22789667
tags question: http://stackoverflow.com/q/22791911
tags question: http://stackoverflow.com/q/22677637
tags question: http://stackoverflow.com/q/22730015
tags question: http://stackoverflow.com/q/22797980
tags question: http://stackoverflow.com/q/22769559
tags question: http://stackoverflow.com/q/22728986
tags question: http://stackoverflow.com/q/22696134
tags question: http://stackoverflow.com/q/22790663
tags question: http://stackoverflow.com/q/22673588
tags question: http://stackoverflow.com/q/22676191
tags question: http://stackoverflow.com/q/22717005
tags question: http://stackoverflow.com/q/22802323
tags question: http://stackoverflow.com/q/22740242
tags question: http://stackoverflow.com/q/22714854
tags question: http://stackoverflow.com/q/22649228
tags question: http://stackoverflow.com/q/22680149
tags question: http://stackoverflow.com/q/22721031
tags question: http://stackoverflow.com/q/22665948
tags question: http://stackoverflow.com/q/22749530
tags question: http://stackoverflow.com/q/22732118
tags question: http://stackoverflow.com/q/22731157
tags question: http://stackoverflow.com/q/22673633
tags question: http://stackoverflow.com/q/22743273
tags question: http://stackoverflow.com/q/22785838
tags question: http://stackoverflow.com/q/22805489
tags question: http://stackoverflow.com/q/22708320
tags question: http://stackoverflow.com/q/22802532
tags question: http://stackoverflow.com/q/22743688
tags question: http://stackoverflow.com/q/22782521
tags question: http://stackoverflow.com/q/22797246
tags question: http://stackoverflow.com/q/22790123
tags question: http://stackoverflow.com/q/22710733
tags question: http://stackoverflow.com/q/22791883
tags question: http://stackoverflow.com/q/22792139
tags question: http://stackoverflow.com/q/22665942
tags question: http://stackoverflow.com/q/22761042
tags question: http://stackoverflow.com/q/22752940
tags question: http://stackoverflow.com/q/22771529
tags question: http://stackoverflow.com/q/22743497
tags question: http://stackoverflow.com/q/22719327
tags question: http://stackoverflow.com/q/22722561
tags question: http://stackoverflow.com/q/22662833

http://stackoverflow.com/a/22705342
answers question: http://stackoverflow.com/q/22705045
has body: I will suggest Selenium. More widely used and supported. You can use WebDriver in Selenium. For more details check http://docs.seleniumhq.org/projects/webdriver/
score: 0
type: Answer

http://stackoverflow.com/comment/34664834
score: 2
comment on: http://stackoverflow.com/a/22736414
has text: While it is true that split uses regex and in regex some characters are special and need to be escaped, `<` is not one of them so `split("<")` is perfectly fine in this case.
type: AnswerComment
type: Comment

http://stackoverflow.com/comment/34665863
score: 6
type: AnswerComment
type: Comment
has text: @KnucklestheEchidna Suppose you have a cache, and you don't care if some thread sees a stale value for some time. What you care about is that it should see correct values (stale or not). Unsafely publishing the cached object will work fine if its fields are final. It won't if its fields are not final: a thread might see some new values and some old ones.
comment on: http://stackoverflow.com/a/22743641

http://stackoverflow.com/a/22750462
score: 7
has body: If you check the transcript to which you have quoted the code https://bitbucket.org/controlsfx/controlsfx/pull-request/196/auto-complete-support-see-127/diff (early feb) and the release date of controlsfx 8.05 dated 4 march http://fxexperience.com/controlsfx/ , likely explanation is that the code is likely not working because what you have quoted is just experimental API that yet to be finalized then. The final version is the one currently working in the final 8.05 as in TextFields.bindAutoCompletion( textField, "Hey", "Hello", "Hello World", "Apple", "Cool", "Costa", "Cola", "Coca Cola"); and other API you can check using autocomplete from your IDE I recommend checking out controlfx 8.05 samples to look at the source code and that will help a lot :}
upvote count: 7
answers question: http://stackoverflow.com/q/22749621
type: Answer
downvote count: 0

http://stackoverflow.com/q/22759412
answer count: 4
has answer: http://stackoverflow.com/a/22759494
has body: trying to verify range of long in java.. why is this program not working? it gives infinite loop (probably). i'm not getting output at the command line and the cursor keeps blinking. class range { public static void main(String [] args) { long i; for(i=0;;i++) { long c= (long)(i+1); if(i&gt;c) //upper_limit+1=lower_limit break; // hence, at i=upper_limit c(=i+1) &lt; i } System.out.println("upper ="+i); for(i=-1;;i--) { long c=(long)(i-1); if(i&lt;c) //lowerlimit-1=upperlimit break; //hence at i=lowerlimit c(=i-1)&gt;i } System.out.println("lower ="+i); } }
type: UnansweredQuestion
upvote count: 1
type: Question
has answer: http://stackoverflow.com/a/22759443
has comment: http://stackoverflow.com/comment/34694498
score: 1
tagged with: java
downvote count: 0
favorite count: 0
has comment: http://stackoverflow.com/comment/34694509
has comment: http://stackoverflow.com/comment/34694481
has answer: http://stackoverflow.com/a/22759481
has answer: http://stackoverflow.com/a/22759476
has title: trying to find range of long data type in java

http://stackoverflow.com/comment/34570348
type: Comment
has text: May be you can use this method - http://docs.oracle.com/javase/7/docs/api/java/util/ArrayList.html#contains(java.lang.Object).
comment on: http://stackoverflow.com/q/22690761
type: QuestionComment
score: 0

http://stackoverflow.com/comment/34619702
score: 0
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/22717539
has text: Did you try converting to java.sql.Clob?

http://stackoverflow.com/q/22732039
tagged with: javadoc
upvote count: 1
type: Question
accepted answer: http://stackoverflow.com/a/22732122
has comment: http://stackoverflow.com/comment/34645430
has comment: http://stackoverflow.com/comment/34645582
has title: Exception parameter of uni-catch may be effectively final?
answer count: 1
downvote count: 0
score: 1
favorite count: 0
has answer: http://stackoverflow.com/a/22732122
tagged with: java-8
has body: A statement from The Java® Language Specification: An exception parameter of a uni-catch clause is never implicitly declared final, but may be effectively final. What does may be implies here. Please explain with example.
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/34645501
tagged with: java

http://stackoverflow.com/comment/34642245
type: AnswerComment
score: 0
comment on: http://stackoverflow.com/a/22721280
type: Comment
has text: when i change the place the application are running good but the jtable are not showing any where

http://stackoverflow.com/comment/34538614
type: Comment
has text: I want to show the borders, but om my screen no borders.
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/22670624

http://stackoverflow.com/q/22735524
has answer: http://stackoverflow.com/a/22735727
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/22735991
score: 1
tagged with: java
tagged with: eclipse
type: Question
answer count: 2
tagged with: jar
downvote count: 0
linked to: http://stackoverflow.com/q/22711396
favorite count: 0
has title: How to load a resource in both IDE and .jar using the same String
has body: I am confused about how java load's it's files. public static File loadFile(String file) throws IOException { URL url = ClassLoader.getSystemClassLoader().getResource(file); if(url == null){ throw new IOException("Cannot find: " + file); } File ret; try { ret = new File(url.toURI()); return ret; } catch (URISyntaxException e) { System.err.println("URISyntaxException in Utility.loadFile(): Tried to load: "+ file); throw new IOException("Cannot load: " + file); } } Here is an (edited) image of the project stucture in Eclipse, where loading the resource works just fine ... When loading the resouce, I call the above method like this: char sep = File.seperatorChar; File file = Utility.loadFile(sep + "res" + sep + "shader" + sep + "some_shader.glsl"); Though - here is what the .jar looks like (also edited) As soon as I run the jar with java -jar prog.jar , I get: java.io.IOException: Cannot find: \res\shader\some_shader.glsl I do not want to use any "relative" path to any kind of class, I always want to use the "absolute" path to the resource from the root of my project's structure (from .../src/... or from ... .jar!/...)
has answer: http://stackoverflow.com/a/22735991
tagged with: classloader
tagged with: file
possible better answer: http://stackoverflow.com/a/22735727
upvote count: 1

http://stackoverflow.com/q/22792711
accepted answer: http://stackoverflow.com/a/22794289
type: Question
has comment: http://stackoverflow.com/comment/34754587
score: 0
tagged with: sql
has title: How to populate jComboBox using select statement and join table in Java
linked to: http://stackoverflow.com/q/419021
answer count: 1
has answer: http://stackoverflow.com/a/22794289
type: AnsweredQuestion
tagged with: join
tagged with: java
has comment: http://stackoverflow.com/comment/34754460
tagged with: select
tagged with: mysql
has body: everyone. I've got a little task to do but I'm a bit stuck, basically I have two tables in mySQL one called 'muscleGroup' and 'muscleExercise'. The first table is essentially a list of categories for different exercises containing two columns 'group_id' and 'groupName'. Than I'm having the exercise table, and as a foreign key I'm using the 'group_id' column from the 'muscleGroup' table. What I'm trying do now is to have a 'muscleGroupComboBox' which contains the values of 'groupName' column, and than based on what you have selected I need to populate another comboBox with the exercises that belongs to this specific group of muscles. Here is my method to populate the muscleGroup comboBox. private void populateMuscleGroupComboBox() { String comboBoxQuery = "SELECT groupName FROM musclegroup"; ResultSet rs; PreparedStatement statement; try { statement = con.prepareStatement(comboBoxQuery); rs = statement.executeQuery(); while (rs.next()) { String groupName = rs.getString("groupName"); groupComboBox1.addItem(groupName); groupComboBox2.addItem(groupName); groupComboBox3.addItem(groupName); groupComboBox4.addItem(groupName); groupComboBox5.addItem(groupName); groupComboBox6.addItem(groupName); } } catch (SQLException ex) { System.out.println(ex.toString()); } } This is my second method to populate the exercise ComboBox. private void populateExerciseComboBox(String group) { String comboBoxQuery = "SELECT muscleGroup.group_id, muscleGroup.groupName, muscleExercise.exerciseName FROM muscleGroup,muscleExercise WHERE muscleGroup.groupName =\"" + group + "\""; ResultSet rs; PreparedStatement statement; try { statement = con.prepareStatement(comboBoxQuery); rs = statement.executeQuery(); while (rs.next()) { String exerciseName = rs.getString("muscleExercise.exerciseName"); jComboBox7.addItem(exerciseName); } } catch (SQLException ex) { System.out.println(ex.toString()); } } Here I call the methods populateMuscleGroupComboBox(); populateExerciseComboBox(groupComboBox1.getSelected…

http://stackoverflow.com/comment/34734890
type: Comment
has text: Thanks it works but why it needs to cast Pair.class to (Class<?>) first?
comment on: http://stackoverflow.com/a/22781234
type: AnswerComment
score: 0

http://stackoverflow.com/q/22785267
has title: MS SQL formulating aggregation and time stamp query
tagged with: sql-server
has answer: http://stackoverflow.com/a/22786449
score: 0
answer count: 1
type: UnansweredQuestion
has body: time stamp meter name parameter name value 2014-02-18 18:58:00 1$SGP A 415.7806091308594 2014-02-18 18:58:00 1$SGP B 240.3373565673828 2014-02-18 18:58:01 2$SGP A 393.191162109375 2014-02-18 18:58:02 2$SGP B 50.10090637207031 2014-02-18 18:58:00 3$SGP A 3484841472 2014-02-18 18:05:01 1$SGP A 0 2014-02-18 17:58:01 1$SGP A 0 2014-02-18 17:58:01 2$SGP A 290 2014-02-18 17:58:01 2$SGP D 0 2014-02-18 17:58:01 3$SGP A 3061691904 2014-02-18 17:57:01 3$SGP A 0 2014-02-18 17:57:02 3$SGP B 0 find the difference in time stamps of two consecutive time stamp and the difference in their value for each individual meter for a particular parameter. Expected Output: for 18:58 01:00 1$SGP 415.7806091308594-0 01:00 2$SGP 393.191162109375-290 01:00 3$SGP 3484841472-3061691904 At, 18:58 1$SGP,2$SGP and 3$SGP throwing values for parameter A. At 17:58 1$SGP,2$SGP and 3$SGP throwing values for parameter A. Rest either all meters are not present together for a time stamp as in 18:05 Seconds can be ignored in the time stamp. So, 01:00 1$SGP 415.7806091308594-0 01:00 2$SGP 393.191162109375-290 01:00 3$SGP 3484841472-3061691904 Facing problem in coming up with the query in MS SQL. I am also not familiar with the convert method for ignoring the second which in mysql can be dealth with date_format().
tagged with: java
tagged with: mssql-jdbc
type: Question

http://stackoverflow.com/comment/34680201
has text: thanks to your answer, I'm a step further now. question updated in this regard.
score: 0
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/22741127

http://stackoverflow.com/q/22691424
tagged with: processing
has comment: http://stackoverflow.com/comment/34572477
has title: Multiple keyboard responses/functions
tagged with: keylistener
score: 0
answer count: 1
has body: I am currently developing an app that is responsive to the viewer pressing keys on the keyboard. There are 36 different keys that will be pressed (a-z &amp;0-9) when each key is pressed a specific colour will appear on screen, more than one key can be pressed at one time. What is the code so that when you press the keys it triggers this?
has answer: http://stackoverflow.com/a/22692891
has comment: http://stackoverflow.com/comment/34572445
has comment: http://stackoverflow.com/comment/34571799
linked to: http://stackoverflow.com/q/10876491
type: UnansweredQuestion
tagged with: java
type: Question

http://stackoverflow.com/q/22661978
type: Question
answer count: 2
tagged with: maven
linked to: http://stackoverflow.com/q/17265002
has comment: http://stackoverflow.com/comment/34519483
upvote count: 2
tagged with: java
possible better answer: http://stackoverflow.com/a/30170730
has answer: http://stackoverflow.com/a/22686406
has answer: http://stackoverflow.com/a/30170730
has comment: http://stackoverflow.com/comment/34525042
has comment: http://stackoverflow.com/comment/34519898
tagged with: mapreduce
tagged with: hadoop
score: 2
has comment: http://stackoverflow.com/comment/34519953
has title: Hadoop MapReduce job starts but can not find Map class?
type: AnsweredQuestion
downvote count: 0
accepted answer: http://stackoverflow.com/a/22686406
favorite count: 0
linked to: http://stackoverflow.com/q/11041253
has body: My MapReduce app counts usage of field values in a Hive table. I managed to build and run it from Eclipse after including all jars from /usr/lib/hadood, /usr/lib/hive and /usr/lib/hcatalog directories. It works. After many frustrations I have also managed to compile and run it as Maven project: 4.0.0 com.bigdata.hadoop FieldCounts jar FieldCounts 0.0.1-SNAPSHOT http://maven.apache.org <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> junit junit 3.8.1 test org.apache.hadoop hadoop-client 2.3.0 org.apache.hcatalog hcatalog-core 0.11.0 To run the job from command line the following script has to be used : #!/bin/sh export LIBJARS=/usr/lib/hcatalog/share/hcatalog/hcatalog-core.jar,/usr/lib/hive/lib/hive-exec-0.12.0.2.0.6.1-101.jar,/usr/lib/hive/lib/hive-metastore-0.12.0.2.0.6.1-101.jar,/usr/lib/hive/lib/libfb303-0.9.0.jar,/usr/lib/hive/lib/jdo-api-3.0.1.jar,/usr/lib/hive/lib/antlr-runtime-3.4.jar,/usr/lib/hive/lib/datanucleus-api-jdo-3.2.1.jar,/usr/lib/hive/lib/datanucleus-core-3.2.2.jar export HADOOP_CLASSPATH=${HADOOP_CLASSPATH}:.:/usr/lib/hcatalog/share/hcatalog/hcatalog-core.jar:/usr/lib/hive/lib/hive-exec-0.12.0.2.0.6.1-101.jar:/usr/lib/hive/lib/hive-metastore-0.12.0.2.0.6.1-101.jar:/usr/lib/hive/lib/libfb303-0.9.0.jar:/usr/lib/hive/lib/jdo-api-3.0.1.jar:/usr/lib/hive/lib/antlr-runtime-3.4.jar:/usr/lib/hive/lib/datanucleus-api-jdo-3.2.1.jar:/usr/lib/hive/lib/datanucleus-core-3.2.2.jar hadoop jar FieldCounts-0.0.1-SNAPSHOT.jar com.bigdata.hadoop.FieldCounts -libjars ${LIBJARS} simple simpout Now Hadoop creates and starts the job that next fails because Hadoop can not find Map class: 14/03/26 16:25:58 INFO mapreduce.Job: Running job: job_1395407010870_0007 14/03/26 16:26:07 INFO mapreduce.Job: Job job_1395407010870_0007 running in uber mode : false 14/03/26 16:26:07 INFO mapreduce.Job: map 0% reduce 0% 14/03/26 16:26:13 INFO mapreduce.Job: Task Id : attempt_1395407010870_0007_m_000000_0, Status : FAILED Error: java.lang.RuntimeException: java.lang.C…

http://stackoverflow.com/comment/34708855
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/22752215
score: 0
has text: Do you have a conflicting objectify.jar on the classpath? Perhaps it's loading the wrong ObjectifyService.

http://stackoverflow.com/q/22660268
downvote count: 0
favorite count: 0
has answer: http://stackoverflow.com/a/22660603
type: UnansweredQuestion
has title: I use Guava's immutable collections (compiled for Java 6) and a Java 8 JRE, can I use the new stream interface?
upvote count: 7
tagged with: collections
tagged with: java-8
has body: I use Guava and in particular their immutable collections (ImmutableList, ImmutableSet). But Guava is compiled for Java 6. If I use Java 8, can I use .stream() with them?
tagged with: guava
has answer: http://stackoverflow.com/a/22660274
score: 7
tagged with: java
linked to: http://stackoverflow.com/q/22561614
type: Question
answer count: 2

http://stackoverflow.com/comment/34890557
type: QuestionComment
has text: Cool, how about the other things like adding it to the classpath? We'll need more than just the errors to see what's missing.
type: Comment
comment on: http://stackoverflow.com/q/22785842
score: 0

http://stackoverflow.com/a/22658441
has comment: http://stackoverflow.com/comment/34514986
score: 5
has comment: http://stackoverflow.com/comment/34513323
upvote count: 5
has comment: http://stackoverflow.com/comment/34515477
downvote count: 0
has comment: http://stackoverflow.com/comment/34514036
has comment: http://stackoverflow.com/comment/34515221
has comment: http://stackoverflow.com/comment/39441152
type: Answer
has comment: http://stackoverflow.com/comment/34514687
has comment: http://stackoverflow.com/comment/34515924
answers question: http://stackoverflow.com/q/22657812
has comment: http://stackoverflow.com/comment/34516177
has body: Don't use a KeyListener. What you can do instead is use a JTextField for the TableCellEditor and just add a DocumentFilter to the JTextField that allows only numbers. Here's a running example import javax.swing.DefaultCellEditor; import javax.swing.JFrame; import javax.swing.JScrollPane; import javax.swing.JTable; import javax.swing.JTextField; import javax.swing.SwingUtilities; import javax.swing.table.TableCellEditor; import javax.swing.text.AbstractDocument; import javax.swing.text.AttributeSet; import javax.swing.text.BadLocationException; import javax.swing.text.DocumentFilter; import javax.swing.text.DocumentFilter.FilterBypass; public class JTableNumberColumn { public JTableNumberColumn() { JFrame frame = new JFrame(); JTextField field = createTextField(); frame.add(new JScrollPane(createTable(field))); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); frame.pack(); frame.setLocationRelativeTo(null); frame.setVisible(true); } private JTextField createTextField() { JTextField field = new JTextField(); ((AbstractDocument) field.getDocument()).setDocumentFilter(new DocumentFilter() { @Override public void insertString(FilterBypass fb, int off, String str, AttributeSet attr) throws BadLocationException { fb.insertString(off, str.replaceAll("\\D++", ""), attr); // remove non-digits } @Override public void replace(FilterBypass fb, int off, int len, String str, AttributeSet attr) throws BadLocationException { fb.replace(off, len, str.replaceAll("\\D++", ""), attr); // remove non-digits } }); return field; } private JTable createTable(final JTextField field) { String[] cols = {"Only Numbers", "Col 2", "Col 3"}; String[][] data = {{null, null, null}, {null, null, null}, {null, null, null}}; final TableCellEditor editor = new DefaultCellEditor(field); JTable table = new JTable(data, cols) { @Override public TableCellEditor getCellEditor(int row, int column) { int modelColumn = convertColumnIndexToModel(column); if (modelColumn == 0) { return editor; } else { return…

http://stackoverflow.com/comment/34552037
has text: When the form design is open, there should be an explorer window which shows all the components that are currently on the selected form. Select the node that represents the component you want to name, press `F2` and type in a new name...
type: AnswerComment
comment on: http://stackoverflow.com/a/22680312
score: 0
type: Comment

http://stackoverflow.com/q/22708055
favorite count: 0
tagged with: aem
upvote count: 6
tagged with: java
has answer: http://stackoverflow.com/a/22715274
score: 6
accepted answer: http://stackoverflow.com/a/22715274
type: Question
type: AnsweredQuestion
tagged with: sling
has body: I have page with name tst in content whose sling:resourceType = news-portal/pages/test page structure (under the /apps): test has sling:resourceSuperType = news-portal/pages/news-repo-main-page in browser I type following URL: http://localhost:4502/cf#/content/tst.selector.pdf.html after this request I see content of selector.jsp But I expected to see content of selector.pdf.jsp because it has more suitable much according my opinion. Can you explain how it works? Is there URL which can show content of selector.pdf.jsp ? Does the choice of content affects if test had sling:resourceType instead of sling:resourceSuperType or together? (I try to test but don't see affection) P.S. I know that answer somewhere here: But I have problems with understanding P.S. log resolving: 0 (2014-03-28 13:18:31) TIMER_START{Request Processing} 0 (2014-03-28 13:18:31) COMMENT timer_end format is {&lt;elapsed msec&gt;,&lt;timer name&gt;} &lt;optional message&gt; 0 (2014-03-28 13:18:31) LOG Method=GET, PathInfo=/content/tst.selector.pdf.html 0 (2014-03-28 13:18:31) TIMER_START{ResourceResolution} 0 (2014-03-28 13:18:31) TIMER_END{0,ResourceResolution} URI=/content/tst.selector.pdf.html resolves to Resource=JcrNodeResource, type=cq:Page, superType=null, path=/content/tst 0 (2014-03-28 13:18:31) LOG Resource Path Info: SlingRequestPathInfo: path='/content/tst', selectorString='selector.pdf', extension='html', suffix='null' 0 (2014-03-28 13:18:31) TIMER_START{ServletResolution} 0 (2014-03-28 13:18:31) TIMER_START{resolveServlet(JcrNodeResource, type=cq:Page, superType=null, path=/content/tst)} 0 (2014-03-28 13:18:31) TIMER_END{0,resolveServlet(JcrNodeResource, type=cq:Page, superType=null, path=/content/tst)} Using servlet /libs/foundation/components/primary/cq/Page/Page.jsp 0 (2014-03-28 13:18:31) TIMER_END{0,ServletResolution} URI=/content/tst.selector.pdf.html handled by Servlet=/libs/foundation/components/primary/cq/Page/Page.jsp 0 (2014-03-28 13:18:31) LOG Applying Requestfilters 0 (2014…
has title: How does Apache Sling script resolving rules work?
answer count: 1
downvote count: 0

http://stackoverflow.com/comment/34518044
type: QuestionComment
has text: ya,but i cant accept the answer but surely i will upvote it @InnocentKiller ,because my objective of question is how to connect facebook xmpp chat
score: 0
comment on: http://stackoverflow.com/q/22660397
type: Comment

http://stackoverflow.com/comment/34746714
comment on: http://stackoverflow.com/q/22757878
score: 0
has text: Sorry, I quantified if but it was not very visible in the paragraph where I describe my deployment environment. "Super slow" is around 80 seconds. (I edited my original message to make the timing more visible)
type: QuestionComment
type: Comment

http://stackoverflow.com/comment/34557225
type: Comment
score: 0
type: AnswerComment
has text: I think I didn't make my intentions clear. Is there a way for the browser(chrome) prompt a certificate selection for the client to authenticate?
comment on: http://stackoverflow.com/a/22683001

http://stackoverflow.com/comment/34499392
score: 1
comment on: http://stackoverflow.com/q/22650465
has text: @user2763361 I can think of exactly one use case for this, but I honestly want to ask if you can, because I'm really skeptical you need this design to begin with.
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/34729322
type: QuestionComment
comment on: http://stackoverflow.com/q/22778480
has text: Posting links to code is not allowed: http://meta.stackexchange.com/questions/125997/something-in-my-web-site-or-project-doesnt-work-can-i-just-paste-a-link-to-it
score: 0
type: Comment

http://stackoverflow.com/comment/34692020
has text: @immibis : I edited my code, can you check ?
comment on: http://stackoverflow.com/q/22757897
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/34592568
comment on: http://stackoverflow.com/a/22700144
has text: So if I have min = 2, `maxIdleTime` = an hour, and 2 connections, one of which has gone unused for an hour, it will be killed because it's idle, then immediately replaced to maintain the minimum?
type: AnswerComment
score: 0
type: Comment

http://stackoverflow.com/a/22752290
has body: I think you have an infinite loop. the condition in your while loop is always true because a and b values are never incremented. And the reason why you're seeing black screen is that this infinite loop is blocking the Main UI Thread.
score: 0
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/22752250
answers question: http://stackoverflow.com/q/22752250
type: Answer

http://stackoverflow.com/comment/34883893
type: AnswerComment
has text: @ajb I finally did a performance test on this. You were right. Your version is an order of magnitude faster than having the `synchronized` block getting entered each time.
type: Comment
comment on: http://stackoverflow.com/a/22723703
score: 0

http://stackoverflow.com/comment/34706974
type: AnswerComment
has text: The error is `Cannot find or load main class net.minecraft.client.main.Main`. The command result will come later, I wait for my friend to do it and answer me ^^
type: Comment
comment on: http://stackoverflow.com/a/22747395
score: 0

http://stackoverflow.com/q/22808565
upvote count: 1
downvote count: 0
has answer: http://stackoverflow.com/a/22808689
favorite count: 0
has comment: http://stackoverflow.com/comment/34782798
accepted answer: http://stackoverflow.com/a/22808664
has answer: http://stackoverflow.com/a/45088154
type: AnsweredQuestion
tagged with: cookies
score: 1
tagged with: java
possible better answer: http://stackoverflow.com/a/22808689
has answer: http://stackoverflow.com/a/22808664
has body: on my Java servlet I've initialized a cookie as below, String timeStamp = new SimpleDateFormat("dd:MM:yyyy_HH:mm:ss:SSS").format(Calendar.getInstance().getTime()); timeStamp = timeStamp + ":" + System.nanoTime(); String loc = "/u/poolla/workspace/FirstServlet/WebContent/WEB-INF/"+timeStamp; Cookie thecookie = new Cookie("thecookie", loc); thecookie.setMaxAge(60*60*24); response.addCookie(thecookie); and in cookie comments I've added some data as below, thecookie.setComment(fileTxt); Now on my jsp page when I try to access this comment it returned a null, &lt;% Cookie my = null; my.getComment();%&gt; How do I get the comment value set in java to my jsp page??
type: Question
has title: Get cookie value in jsp
has comment: http://stackoverflow.com/comment/34783622
answer count: 3

http://stackoverflow.com/comment/91396359
type: AnswerComment
comment on: http://stackoverflow.com/a/22771813
has text: No I hadn't. Just added "@Push" above my MainView class and it now works!
type: Comment
score: 0

http://stackoverflow.com/comment/34702109
comment on: http://stackoverflow.com/q/22762598
score: 0
type: Comment
type: QuestionComment
has text: sorry, nope the Accept is not printed. I've edited the question

http://stackoverflow.com/comment/34662644
type: Comment
type: QuestionComment
has text: why not to use a LinearLayout ?
comment on: http://stackoverflow.com/q/22741752
score: 0

http://stackoverflow.com/a/22663914
type: Answer
has body: Use entrySet(). Specification says that The set is backed by the map, so changes to the map are reflected in the set, and vice-versa. So, you can edit set with entries instead of map and that is easier. HashMap&lt;Object, Object&gt; map = new HashMap(); System.out.println("before"); map.put(1, 2); map.put(2, null); map.put(3, null); for (Map.Entry&lt;Object, Object&gt; e : map.entrySet()) { System.out.println(e.getKey() + "=" + e.getValue()); } for (Iterator&lt;Map.Entry&lt;Object, Object&gt;&gt; i = map.entrySet().iterator(); i.hasNext();) { if (i.next().getValue() == null) { i.remove(); } } System.out.println("\nafter"); for (Map.Entry&lt;Object, Object&gt; e : map.entrySet()) { System.out.println(e.getKey() + "=" + e.getValue()); } Output: before 1=2 2=null 3=null after 1=2
score: 0
answers question: http://stackoverflow.com/q/22663078

http://stackoverflow.com/comment/34713562
score: 0
has text: There was a comment (already deleted), where somebody advised me to use this regex match: `line.matches("^\\[.\\][\n\r]")` because of newline characters on each line. But that doesn't help since `readline()` strips the newline character...
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/22769443

http://stackoverflow.com/comment/34742909
has text: Might be related to this: [LINK](https://groups.google.com/forum/#!topic/google-appengine-java/UFBFktmPvP0)
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/22786215

http://stackoverflow.com/comment/34819812
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/22788967
type: Comment
has text: yes,but here i am passing only 2 blobKey values therefore its not causing any problem but if i pass more than 2 values then it causes problem.

http://stackoverflow.com/a/22767380
has body: Couple of suggestions here: 1 - Make GUI extend JFrame and implement KeyListener. You have to override KeyListener methods (keyPressed, keyReleased, and keyTyped) and you should override repaint() from JFrame. The repaint method should call super.repaint() at the end to update frames. 2 - Have the fields of GUI store data about the things that need to be drawn. You probably should store the grid, or what's in the grid as fields. 3 - The constructor should initialize, not render. Rendering should be done in repaint(). The constructor should do something like this: super(); JPanel frame = new JPanel(); add(frame); pack(); addKeyListener(this); repaint(); This answer is kinda unfinished but I'll look more into it and update this. Particularly, the JPanel is an element in the JFrame. UPDATE: Here is a small working example. Use WASD to move the rectangle around the screen. This is the JFrame. import java.awt.event.KeyEvent; import java.awt.event.KeyListener; import javax.swing.JFrame; public class MyJFrame extends JFrame implements KeyListener { private MyJPanel frame; public MyJFrame() { super(); frame = new MyJPanel(); add(frame); pack(); addKeyListener(this); repaint(); } public static void main(String[] args) { MyJFrame window = new MyJFrame(); window.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); window.setVisible(true); window.setTitle("Test"); } @Override public void repaint() { super.repaint(); } @Override public void keyPressed(KeyEvent e) { frame.keyPressed(e); repaint(); } @Override public void keyTyped(KeyEvent e) { } @Override public void keyReleased(KeyEvent e) { } } This is the JPanel. import java.awt.Color; import java.awt.Dimension; import java.awt.Graphics; import java.awt.event.KeyEvent; import javax.swing.JPanel; public class MyJPanel extends JPanel { private int x = 0; private int y = 0; public MyJPanel() { setPreferredSize(new Dimension(200,200)); } @Override public void update(Graphics g) { paint(g); } @Override public void paint(Graphics g) { g.…
has comment: http://stackoverflow.com/comment/34747491
type: Answer
has comment: http://stackoverflow.com/comment/34754280
has comment: http://stackoverflow.com/comment/34758350
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/22766209
has comment: http://stackoverflow.com/comment/34758797
score: 0
answers question: http://stackoverflow.com/q/22766209

http://stackoverflow.com/q/22713412
has answer: http://stackoverflow.com/a/22713929
tagged with: random
has answer: http://stackoverflow.com/a/22713945
has answer: http://stackoverflow.com/a/22713956
type: Question
tagged with: android
has body: I can't really explain what I'm trying to say through the title, but I'll expand here. Anyway, I'm still learning how to code so pardon my misuse of a few terms. I made a simple app that displays an array of strings. It features just two visual parts- a TextView element and a Button element. Pressing the button displays a random fruit from the String Array. Thing is, when I change orientations, the displayed fruit changes. I know that this happens because the activity is 'remade' whenever the orientation is changed. And I do have an understanding on how to use onSaveInstanceState and its counterpart. But I have no idea how to save and restore the currently-displayed value in the Display because I'm using Random instead of int. Because of this, I don't think I can rely on using putInt and getInt. TextView Display; Button randomize; String[] fruitArray; Random counter = new Random(); Random rand = new Random(); int launchCounter = 0; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); initializeButtons(); checkAndroidVersion(); changeFont(); fruitArray= getResources().getStringArray(R.array.fruits); launchCounter = rand.nextInt(10) + 1; Display.setText(fruitArray[launchCounter]); randomize.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View arg0) { int maxIndex = jokeArray.length; int generatedIndex = counter.nextInt(maxIndex); Display.setText(fruitArray[generatedIndex]); } });
tagged with: java
score: 0
has title: How do I save the random position of a String Array when changing screen orientations?
answer count: 4
has answer: http://stackoverflow.com/a/22715503
tagged with: arrays
type: UnansweredQuestion
linked to: http://stackoverflow.com/q/4096169

http://stackoverflow.com/q/22765820
has comment: http://stackoverflow.com/comment/34706384
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/22766021
tagged with: java
tagged with: methods
type: Question
has answer: http://stackoverflow.com/a/22765926
has answer: http://stackoverflow.com/a/22766042
tagged with: arrays
has comment: http://stackoverflow.com/comment/34706229
score: 0
answer count: 3
tagged with: string
has body: How does my program know what String and array to use? This is my code from my intro to comp sci. We are focusing only on Java. I am having the user enter a sentence and then running that sentence through the method that I created to remove certain char from the sentence and then return it. The user fills String sentence using the scanner kbd, and ch1, ch2, ch3 get filled from scanner. When I write the method public static String deletePun(String s, char... arr) how does it know that sentence = s, and the ch1, ch2, ch3 go in char... arr package multidimarrayproject; import java.util.*; public class multidemo { public static void main(String[] args) { Scanner kbd = new Scanner(System.in); String sentence = ""; char ch1, ch2, ch3; System.out.println("Enter a sentence"); sentence = kbd.nextLine(); System.out.println("Enter 3 characters to be removed"); ch1 = kbd.next().charAt(0); ch2 = kbd.next().charAt(0); ch3 = kbd.next().charAt(0); sentence = deletePun(sentence, ch1, ch2, ch3); System.out.println(sentence); public static String deletePun(String s, char... arr){ //goes through an removes //removes chars entered for(int i = 0; i &lt; arr.length; i++) //by the user { int location = s.indexOf(arr[i]); while (location &gt;= 0) { s = s.substring(0, location) + s.substring(location+1, s.length()); location = s.indexOf(arr[i]); } } return s; }
has title: How does the method know what variable I'm using? [Java newb]

http://stackoverflow.com/comment/34751435
score: 0
comment on: http://stackoverflow.com/q/22750241
type: Comment
type: QuestionComment
has text: You should specify an interface as a dependency in SecurityConfig and let spring container autowire an implementation - change CustomUserDetailsService to UserDetailsService. Also, you don't need jdbc authentication if you intend to use your custom UserDetailsService to perform authentication and authorisation (e.g. throw UsernameNotFoundException for your UserDetailsService if user doesn't exist).

http://stackoverflow.com/a/22743998
downvote count: 0
has comment: http://stackoverflow.com/comment/34666760
score: 5
has body: Somewhere in your code you have committed some response to the response object. You have to dispatch to your jsp page before you commit any output to the response object. From the Documentation forward should be called before the response has been committed to the client (before response body output has been flushed). If the response already has been committed, this method throws an IllegalStateException. Uncommitted output in the response buffer is automatically cleared before the forward. The problem is that you are forwarding to the admin.jsp page when you should be redirecting in the Utils.CheckSession method request.getRequestDispatcher("Admin.jsp").forward(request, response); Should be response.sendRedirect("Admin.jsp"); return false; // in the doGet method if (!Utils.CheckSession(request,response)) { return; } Redirects do not happen immediately, the servlet will continue execution and when it hits the next RequestDispatcher.forward call the exception is raised. The server needs to send the http: redirect status code in the http response, the browser then receives the response and requests resource specified by the redirect url.
has comment: http://stackoverflow.com/comment/34666893
answers question: http://stackoverflow.com/q/22743803
has comment: http://stackoverflow.com/comment/34666749
accepted answer of: http://stackoverflow.com/q/22743803
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/34666913
has comment: http://stackoverflow.com/comment/34666701
has comment: http://stackoverflow.com/comment/34666951
has comment: http://stackoverflow.com/comment/34666813
upvote count: 5
has comment: http://stackoverflow.com/comment/34666673
type: Answer

http://stackoverflow.com/comment/34526243
has text: yes File.isDirectory() method tells you that and this should help you in creating recursive method.
score: 0
comment on: http://stackoverflow.com/a/22662809
type: AnswerComment
type: Comment

http://stackoverflow.com/comment/34595142
comment on: http://stackoverflow.com/q/22703560
type: QuestionComment
has text: @jyomin can you please check whether my code is correct and have I got the values of radiobutton and spinner properly.
score: 0
type: Comment

http://stackoverflow.com/a/22725625
has body: In the else-part: System.out.println("parameter 2: " + array[b + 1]); requires for a valid index: b + 1 &lt; array.length b &lt; array.length - 1 But the if-else merely guarantees: b &lt;= array.length b &lt; array.length + 1 Hence it should be if (b &gt;= array.length - 1) { ... } else { ... } Amd then there is probably an error in the logic if you intended: sum of lower + (lower + 1) + (lower + 2) + ... + upper These are (upper - lower + 1) terms of average (upper + lower)/2: int sum = (upper - lower + 1) * (upper + lower) / 2; Either one of the factors is even as they differ by 2*lower+1, so integer calculation is okay: integer division by does not loose anything. Example sum(7, 9) = (9 - 7 + 1) * (9 + 7) = 3 * 16 = 48
type: Answer
has comment: http://stackoverflow.com/comment/34634452
answers question: http://stackoverflow.com/q/22725415
score: 0

http://stackoverflow.com/comment/34541654
type: Comment
type: QuestionComment
has text: Instead of just creating objects in an ArrayList I'll just make a big Bullet[] array and store objects in that and iterate when the array is full. And no body even bothered to ask question 2 which doesn't need any code as far as I know.
score: 0
comment on: http://stackoverflow.com/q/22673695

http://stackoverflow.com/a/22725081
type: Answer
score: 1
has body: It shouldn't be your solution, in any case the @component annotation over @repository is useless. Either you insert @repository (better for exception translation) or @component.
answers question: http://stackoverflow.com/q/22712827
upvote count: 1
downvote count: 0

http://stackoverflow.com/comment/34691158
type: AnswerComment
type: Comment
has text: Make sure you escape the `\\` first, then.
comment on: http://stackoverflow.com/a/22757475
score: 0

http://stackoverflow.com/a/22660680
score: 1
upvote count: 1
answers question: http://stackoverflow.com/q/22659193
downvote count: 0
has body: To make sure that you really understand this, try rewriting the methods using the idiom synchronized(Object){ enter code here } This acquires the intrinsic lock on the (Object). See if you can replicate the behaviour of deadlock in this idiom. Then rewrite it so that it works. Doing this will teach you two things: Calling a synchronized method acquires a lock on the object which the method is attached to. So in this case zarah.bow(Khan) acquires a lock on zarah, but not on Khan. If you have a synchronized method which calls other synchronized methods, you must make absolutely sure that it will always acquire all the locks. On (2), you could, for example, make the code in the bow method: synchronized(bower){ System.out.format("%s: %s"+" bowed to me.%n",bower.getName(),name); bower.bowBack(this); } which will probably work at least some of the time. This sets up a so called race condition. It will avoid deadlock most of the time since System.out.format is quite a slow method to execute, whereas acquiring a lock is fast. Since it shrinks the gap between acquiring the two locks, it reduces the possibility of deadlock, since the chance for context switching is lessened. This is, of course, a terrible way to solve the problem. A solution which works here is to create an object, and instead of calling a synchronized method use the synchronized(lock) to acquire the lock on that new object. Then the code will run because the new object's intrinsic lock acts as a proxy for acquiring both locks at once. Create a new empty class: static class proxyLock(){}; then rewrite the method bow as: private void bow(proxyLock lock, Friend bower){ synchronized(lock){ System.out.format("%s: %s"+" bowed to me.%n",bower.getName(),name); bower.bowBack(this); } } The main method gets one new proxy lock that is passed to both threads, and insures that only one thread runs the method at once, as the other thread is blocked until the lock on proxylock is released, which effectively means that the …
type: Answer

http://stackoverflow.com/q/22651690
score: 2
downvote count: 0
tagged with: ftp-client
has comment: http://stackoverflow.com/comment/34504954
type: Question
has body: I am trying to write a file to AS400 FTP via camel endpoint as below ftp://user@host:21/QSYS.LIB/XINFT.LIB?password=password&amp;passiveMode=true ftp://user@host:21/QSYS.LIB/XINFT.LIB?password=password But the write operation fails with the following exception Cannot change directory to: QSYS.LIB. Code: 550. Processed by failure processor: FatalFallbackErrorHandler[Pipeline[[Channel[Wrap[com.privasia.edi.core.routing.exception.CustErrorHandler@2003b7bd] -&gt; com.privasia.edi.core.routing.exception.CustErrorHandler@2003b7bd], Channel[Log(ypn-cusres-containerData-outbound)[Error in YPN CUSRES Container Schedular call.]]]]] org.apache.camel.component.file.GenericFileOperationFailedException: File operation failed: 550-Specified library does not exist or cannot be accessed. 550 Current library not changed. Cannot change directory to: QSYS.LIB. Code: 550 at org.apache.camel.component.file.remote.FtpOperations.doChangeDirectory(FtpOperations.java:705)[218:org.apache.camel.camel-ftp:2.10.7] at org.apache.camel.component.file.remote.FtpOperations.changeCurrentDirectory(FtpOperations.java:683)[218:org.apache.camel.camel-ftp:2.10.7] at org.apache.camel.component.file.remote.FtpOperations.storeFile(FtpOperations.java:469)[218:org.apache.camel.camel-ftp:2.10.7] at org.apache.camel.component.file.GenericFileProducer.writeFile(GenericFileProducer.java:249)[100:org.apache.camel.camel-core:2.10.7] at org.apache.camel.component.file.GenericFileProducer.processExchange(GenericFileProducer.java:151)[100:org.apache.camel.camel-core:2.10.7] at org.apache.camel.component.file.remote.RemoteFileProducer.process(RemoteFileProducer.java:49)[218:org.apache.camel.camel-ftp:2.10.7] at org.apache.camel.util.AsyncProcessorConverterHelper$ProcessorToAsyncProcessorBridge.process(AsyncProcessorConverterHelper.java:61)[100:org.apache.camel.camel-core:2.10.7] at org.apache.camel.util.AsyncProcessorHelper.process(AsyncProcessorHelper.java:73)[100:org.apache.camel.camel-core:2.10.7] at org.apache.camel…
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/34505029
tagged with: java
tagged with: apache-camel
tagged with: ibm-midrange
upvote count: 2
has answer: http://stackoverflow.com/a/22653740
accepted answer: http://stackoverflow.com/a/22653740
answer count: 1
favorite count: 0
has title: Apache Camel endpoint to write a file AS400 FTP :
tagged with: ftp

http://stackoverflow.com/q/22743179
has comment: http://stackoverflow.com/comment/34673615
has comment: http://stackoverflow.com/comment/34673567
tagged with: java
has comment: http://stackoverflow.com/comment/34664949
score: 0
has body: I would like to extend TextView to implement a stopwatch function. The problem I got was a runtimeException concerning the inflating process. 03-30 12:57:28.749: E/AndroidRuntime(5700): java.lang.RuntimeException: Unable to start activity ComponentInfo{de.lipsksoft.apps.anwendung.t6student/de.lipsksoft.apps.anwendung.t6student.opsActivity}: android.view.InflateException: Binary XML file line #29: Error inflating class de.lipsksoft.apps.anwendung.t6student.TimerView.t6student.TimerView I did some changes because of the hints in here. My new code: public class Timer 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; Timer(Context context){ super(context); } Timer (Context context, AttributeSet attrs) { super(context, attrs); } Timer(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 updateTimer (float time){ secs = (long)(time/1000); mins = (long)((time/1000)/60); hrs = (long)(((time/1000)/60)/60); /* Convert the seconds to String * and format to ensure it has * a leading zero when required */ secs = secs % 60; seconds=String.valueOf(secs); if(secs == 0){ seconds = "00"; } if(secs &lt;10 &amp;&amp; secs &gt; 0){ seconds = "0"+seconds; } /* Convert the minutes to String and format the String */ mins = mins % 60; minutes=String.valueOf(mins); if(m…
answer count: 1
has answer: http://stackoverflow.com/a/22743268
accepted answer: http://stackoverflow.com/a/22743268
has comment: http://stackoverflow.com/comment/34665078
tagged with: android
has comment: http://stackoverflow.com/comment/34664999
has comment: http://stackoverflow.com/comment/34664993
type: AnsweredQuestion
tagged with: view
has title: custom TextView fires RuntimeException "Error inflating"
tagged with: multithreading
has comment: http://stackoverflow.com/comment/34665058
linked to: http://stackoverflow.com/q/2884501
type: Question
has comment: http://stackoverflow.com/comment/34673517

http://stackoverflow.com/comment/34701702
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/22763029
has text: I was just writing an answer to this question to help you. I wrote code that did exactly what you needed and then the rest of my answer was explaining why it is a bad idea. Now that I know this is a homework assignment, the rationale behind this approach is irrelevant and I don't want to just give you an answer to a homework assignment. Since others have already done so, I will go ahead and share mine. Next time, please be upfront about these situations so people can give an appropriate answer.
score: 0

http://stackoverflow.com/comment/34532078
comment on: http://stackoverflow.com/a/22668913
type: AnswerComment
score: 0
type: Comment
has text: Yea, I had to go check substring definition myself to see if I was missing something because it looked odd

http://stackoverflow.com/comment/34609381
type: Comment
has text: Could you verify that the ArrayList countries is not empty?
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/22709914

http://stackoverflow.com/comment/34788766
comment on: http://stackoverflow.com/a/22807758
has text: Did this answer your question or do you need some further explanation?
type: Comment
score: 0
type: AnswerComment

http://stackoverflow.com/comment/34575194
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/22693003
has text: Thanks for all the answers,ended up going with the concatenation. Cheers!
type: Comment

http://stackoverflow.com/comment/34663179
comment on: http://stackoverflow.com/a/22742148
has text: So do you need the body text or the elements text?
type: Comment
score: 0
type: AnswerComment

http://stackoverflow.com/comment/34552099
type: QuestionComment
comment on: http://stackoverflow.com/q/22680264
has text: @pskink: Just now, yes. Question edited.
score: 0
type: Comment

http://stackoverflow.com/comment/34559046
comment on: http://stackoverflow.com/q/22684339
score: 0
has text: I need to retrieve the value corresponding to the pattern as key and use it for further logic processing.. ex:IPVAR,IPVARD00,IPVARE
type: QuestionComment
type: Comment

http://stackoverflow.com/q/22722682
upvote count: 3
answer count: 2
has comment: http://stackoverflow.com/comment/34628900
favorite count: 0
possible better answer: http://stackoverflow.com/a/22722737
has title: Java delete node from linked list by reference
has body: How do I efficiently remove a node from java's LinkedList by reference to an object, or to a specific node? using remove(object) uses a traversal over the whole list, as evidenced by the documentation: "removes the first element e such that (o==null ? e==null : o.equals(e))". Can I remove by specific reference to a node? I don't mind storing the reference to the node in the object itself. I can't use the index of the list, as it may change. If not, is there another data structure which would allow me to do this?
type: AnsweredQuestion
score: 3
tagged with: linked-list
downvote count: 0
tagged with: java
type: Question
has answer: http://stackoverflow.com/a/22722737
has answer: http://stackoverflow.com/a/22722861
accepted answer: http://stackoverflow.com/a/22722861
tagged with: data-structures
has comment: http://stackoverflow.com/comment/34628919

http://stackoverflow.com/q/22786893
has answer: http://stackoverflow.com/a/22803979
score: 0
answer count: 1
tagged with: arrays
tagged with: android
accepted answer: http://stackoverflow.com/a/22803979
tagged with: matlab
tagged with: text
tagged with: java
has title: text file limitation in Android?
type: Question
type: AnsweredQuestion
has body: I am trying to read a wav file into an array and then write it on a text file using android application. To validate that the values on the text file are correct, I compare it with Matlab. I used the same code in Android and Java, and in both cases the results are different, by different I mean that Android saves only 5946 readings out of 20000 readings. On the other hand, when I run the Java code, I get the full 20000 readings ! I have no idea why I get 5946 readings when I run the Android application, while I get 20000 readings when I run the java code. Is there any limitation on the text file size? Following is the code I wrote (plz note that I use a library for wav file reading): protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); ///////////////////// Done = (TextView) findViewById(R.id.textView1); Done.setText("processing"); double[] buffer; int len; ///Reading the wav file into buffer///// filePath = "mnt/sdcard"; File filein = new File(filePath, "audio.wav"); try { // Open the wav file specified as the first argument WavFile wavFile = WavFile.openWavFile(filein); // Display information about the wav file wavFile.display(); // Get the number of audio channels in the wav file int numChannels = wavFile.getNumChannels(); // Create a buffer of 100 frames buffer = new double[20000 * numChannels]; int framesRead; double min = Double.MAX_VALUE; double max = Double.MIN_VALUE; do { // Read frames into buffer framesRead = wavFile.readFrames(buffer, 20000); // Loop through frames and look for minimum and maximum value for (int s=0 ; s&lt;framesRead * numChannels ; s++) { if (buffer[s] &gt; max) max = buffer[s]; if (buffer[s] &lt; min) min = buffer[s]; } len=buffer.length; } while (framesRead != 0); // Close the wavFile wavFile.close(); // Output the minimum and maximum value System.out.printf("Min: %f, Max: %f\n", min, max); //////////////Saving the array (buffer) into a text file (before.txt)/…

http://stackoverflow.com/q/22743099
tagged with: bufferedimage
type: Question
has title: How to make gradient border of an image using java?
tagged with: graphics
has body: How can I make an image border as gradient. I googled a lot, but didn't find correct suggestion. Any one can help me... Any suggestion please...
answer count: 2
score: 5
favorite count: 0
upvote count: 5
possible better answer: http://stackoverflow.com/a/22743608
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/22744303
accepted answer: http://stackoverflow.com/a/22744303
downvote count: 0
tagged with: java
tagged with: gradient
has answer: http://stackoverflow.com/a/22743608
tagged with: image-processing

http://stackoverflow.com/comment/34538397
has text: Thank you much! I'm glad it was so simple. Now on to the hard stuff.
type: Comment
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/22672434

http://stackoverflow.com/comment/34757010
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/22793892
has text: I'm sure garbage collection has something to do with it. It's going to be hard to know for sure unless you profile your code with an actual tool (such as `jvisualvm` or `jconsole`).
score: 0

http://stackoverflow.com/comment/34499845
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/22650682
has text: possible duplicate of [Send Email Programmatically in Android](http://stackoverflow.com/questions/7274949/send-email-programmatically-in-android)

http://stackoverflow.com/a/22686406
accepted answer of: http://stackoverflow.com/q/22661978
downvote count: 0
upvote count: 2
answers question: http://stackoverflow.com/q/22661978
type: Answer
score: 2
has body: As I found out the problem was in directory permissions where MapReduce jar was located. This jar was built in a home directory of a regular, not hdfs user. As long as this MRD job outputs results of its work directly into Hive table, it should be run under hdfs user. In case such a job is run under regular user it has no permission to write data into Hive table! On the other hand a home directory of a regular user in CentOS has 700 permissions. So when you run hadoop jar ... command under user different from the user owning this home directory access to MRD jar gets denied somewhere in the process of loading classes by Hadoop. That's why under hdfs user this job results in java.lang.RuntimeException: java.lang.ClassNotFoundException: Class com.bigdata.hadoop.MyMap not found. Recursively changing permission of home directory from 700 to 755 where MRD jar was built solves this problem. Yet a more important problem remains: How to run a job under regular user so it has permission to write data into a Hive table?
type: AcceptedAnswer

http://stackoverflow.com/comment/34699133
has text: I have two more java files which uses the oracle driver, could that be the reason?. should i try deleting those?
type: AnswerComment
score: 0
type: Comment
comment on: http://stackoverflow.com/a/22761675

http://stackoverflow.com/comment/34636840
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/22725547
has text: @takteek - I have edited Question section with the definition of TmpClass and Hibernate mapping.
score: 0

http://stackoverflow.com/q/22765052
has body: I am trying to program my first binary tree but when I was programming a method to return true if the given target is in the binary tree (recursive helper) I got an error. Here is the code: public class IABinaryTrees { private Node root; private static class Node { Node left; Node right; int data; Node(int newData) { left = null; right = null; data = newData; } } public void Binarytree() { root = null; } public boolean lookup(int data) { return(lookup(root, data)); //The fail is in this line } public static void main(String[] args) { } }
score: -2
has comment: http://stackoverflow.com/comment/34704937
has comment: http://stackoverflow.com/comment/34704972
favorite count: 0
tagged with: binary-tree
answer count: 1
has comment: http://stackoverflow.com/comment/34704969
upvote count: 0
has comment: http://stackoverflow.com/comment/34705237
type: AnsweredQuestion
tagged with: java
has title: Lookup fail while programming a tree in Java
has comment: http://stackoverflow.com/comment/34705010
type: Question
has answer: http://stackoverflow.com/a/22765458
accepted answer: http://stackoverflow.com/a/22765458
downvote count: 2

http://stackoverflow.com/q/22678833
has answer: http://stackoverflow.com/a/22679385
has answer: http://stackoverflow.com/a/22678849
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/22678989
score: 0
tagged with: java
has body: String filter = phoneNumber eq '763436' and carrier eq 'AT and T Mobility' and site startswith '256' the split should give me the following: String 1 = phoneNumber eq 763436 String 2 = carrier eq 'AT and T Mobility' String 3 = site startswith 256 Further more String 1 2 and 3 should split into String operator = phoneNumer String operator = eq String operand =763436 String operator = carrier String operator = eq String operand =AT and T Mobility String operator = site String operator = startswith String operand =256 I can use string.split("and") and split(" ") for outer and inner respectively, but my string too contains whitespace and and also (example AT and T Mobility). One help is that extra and and white space will be present in operator only within quotes. Any Help how to split in java?
type: Question
tagged with: split
has comment: http://stackoverflow.com/comment/34550035
has title: Splitting of string for `whitespace` & `and`
answer count: 3
has answer: http://stackoverflow.com/a/22678989
tagged with: string
possible better answer: http://stackoverflow.com/a/22678849

http://stackoverflow.com/q/22681831
has comment: http://stackoverflow.com/comment/34554815
has comment: http://stackoverflow.com/comment/34554470
has comment: http://stackoverflow.com/comment/34554612
has comment: http://stackoverflow.com/comment/34554583
tagged with: heap-memory
has comment: http://stackoverflow.com/comment/34554528
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/34554579
tagged with: java
has answer: http://stackoverflow.com/a/22682143
type: Question
has comment: http://stackoverflow.com/comment/34555142
answer count: 2
has comment: http://stackoverflow.com/comment/34554739
has comment: http://stackoverflow.com/comment/34554775
has comment: http://stackoverflow.com/comment/34554751
has comment: http://stackoverflow.com/comment/34554666
linked to: http://stackoverflow.com/q/1565388
has title: Increasing Heap Size upto 6GB
has body: I was looking at the following article: Increase heap size in Java Now I have a program that needs about 5GB memory and while doing what was told in the article (that is increasing heap size by using -Xmx5g in the arguments field), I am still getting Exception in thread "main" java.lang.OutOfMemoryError: Java heap space My system is Windows 7 (64 bit) with 8GB RAM. Am I doing something wrong? If yes, how shall I proceed to get 5GB of heap memory or it is just not feasible for my system to handle? Note: I have to do calculations with a 2D matrix that is of 25K*25K size having all non-zero values. Hence I cannot use sparse matrix as well.
has answer: http://stackoverflow.com/a/22682015
score: 0
has comment: http://stackoverflow.com/comment/34554563

http://stackoverflow.com/a/22718383
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/34622064
has comment: http://stackoverflow.com/comment/34650960
has comment: http://stackoverflow.com/comment/34747598
has comment: http://stackoverflow.com/comment/34621793
type: Answer
accepted answer of: http://stackoverflow.com/q/22718038
score: 2
answers question: http://stackoverflow.com/q/22718038
downvote count: 0
has comment: http://stackoverflow.com/comment/34701296
has body: Android does a two-pass layout. The first one defines things, the 2nd actually does the height/width etc. If you're trying to get the height of a view from with your onCreate() or onCreateView(0 methods, they won't see it as the two passes have not completed while these methods are running. Instead you'll need to do a runnable with a .post on the view like this: // use post - runnable to get height of view before it's actually shown level3Frame.post( new Runnable() { @Override public void run() { final int halfMargin = level3Frame.getHeight()/2; &lt;snip&gt; } }); level3Frame is a view I needed the height of. Creating a runnable on the view's .post after all the layout has occurred means you can get the height or whatever else you might need from the now fully rendered view.
upvote count: 2

http://stackoverflow.com/a/22791997
type: AcceptedAnswer
downvote count: 0
has body: Try this. It should be what you need. insert into some_table (metric_id, employee_id, quota) select 2, employee_id, quota * 0.5 from some_table where metric_id = 1
type: Answer
answers question: http://stackoverflow.com/q/22791911
score: 2
upvote count: 2
accepted answer of: http://stackoverflow.com/q/22791911

http://stackoverflow.com/a/22677323
type: AcceptedAnswer
has body: The base case is the list being empty, nothing left to print. So that's what we check for first. If base case is met, we return without printing anything. Otherwise the list has elements remaining, so we take the last element from the list (since we are printing in reverse) and pop it off the list. The remove method returns the removed element so that should do the trick. Now we recurse with our modified list (minus the last element). Eventually the list will be empty and all elements will have been printed in reverse. public static &lt;E&gt; void printReverse(final SinglyLinkedList&lt;E&gt; list) { if(list.getLength() &gt; 0) { System.out.println(list.remove(list.getLength()-1)); printReverse(list); } }
type: Answer
accepted answer of: http://stackoverflow.com/q/22677123
score: 0
answers question: http://stackoverflow.com/q/22677123

http://stackoverflow.com/a/79431943
answers question: http://stackoverflow.com/q/22673776
type: Answer
has body: The time complexity of the String.toCharArray() method in Java is O(n), where n is the length of the string. Here's a detailed breakdown: Underlying Implementation: A Java String internally stores characters in a char[] array. However, this array is private and immutable. When you call toCharArray(), the method creates a new array and copies the characters from the String's internal array to this new array. This ensures the String's immutability is preserved. Java Source Code: The actual implementation (from OpenJDK) is: public char[] toCharArray() { char[] result = new char[value.length]; System.arraycopy(value, 0, result, 0, value.length); return result; } new char[value.length] allocates a new array of size n. System.arraycopy(...) copies all n characters from the String's internal array to the new array. This is an O(n) operation. If Java returned the internal array directly (without copying), it would expose mutable access to the String's data, violating its immutability. For example: String s = "hello"; char[] arr = s.toCharArray(); arr[0] = 'x'; // This should NOT modify the original string. A copy is required to prevent this. Example For a string "hello" (length 5): A new char[5] is allocated. All 5 characters ('h', 'e', 'l', 'l', 'o') are copied into the new array. The copy operation takes O(n) time (linear with respect to the string's length). So in Summary: Time Complexity: O(n) (linear time). Reason: The method creates a new array and copies all n characters from the String's internal storage to this array. There’s no way to bypass this copying step in Java.
score: 0

http://stackoverflow.com/comment/34767372
type: QuestionComment
has text: This code is pretty messy. I would refactor it (maybe add some methods in place of loops, etc) before you work on functionality. That'll make it **easier to read** and thus **easier to debug**
score: 1
comment on: http://stackoverflow.com/q/22799661
type: Comment

http://stackoverflow.com/a/22807967
answers question: http://stackoverflow.com/q/22807778
score: 0
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/36721929
type: Answer
has body: I just changed SurfaceLayer surf to ImageLayer imglay, removed all the code from paint() and replaced code in init() to this: imglay = g.createImageLayer(); imglay.setImage(circle); g.rootLayer().add(imglay); It works, but is it how it should be done?
accepted answer of: http://stackoverflow.com/q/22807778

http://stackoverflow.com/comment/34697515
type: QuestionComment
has text: AFAIK there is no built-in component for that but you may use a seam interceptor for that.
score: 0
comment on: http://stackoverflow.com/q/22761048
type: Comment

http://stackoverflow.com/a/22711152
has comment: http://stackoverflow.com/comment/34608066
answers question: http://stackoverflow.com/q/22710921
downvote count: 0
type: Answer
score: 1
upvote count: 1
has body: heres my attempt: boolean leapyear(int year) { if (year % 4 == 0) { if (year % 100 == 0) { return (year % 400 == 0); } else { return true } } return false; } or use this: return Java.util.GregorianCalendar.getInstance().isLeapYear(year)
has comment: http://stackoverflow.com/comment/34608407

http://stackoverflow.com/comment/34587602
has text: @stevebot In that case I would append "IfChanged" - though I'd consider replacing the existing call, unless there's some reason that you'd want to update a row with the same data the row already has in it.
score: 0
type: Comment
comment on: http://stackoverflow.com/q/22698938
type: QuestionComment

http://stackoverflow.com/q/22797521
tagged with: java
has comment: http://stackoverflow.com/comment/34764551
has answer: http://stackoverflow.com/a/22800072
has answer: http://stackoverflow.com/a/22799130
tagged with: eclipse
type: Question
answer count: 2
has comment: http://stackoverflow.com/comment/34765355
has body: I am getting Error 404 when trying to run my application. Tomcat server, start and synchronized. Dynamic module version is 2.5. Previously I used dynamic module version 3.o but it didn't work. I read in one of the posts that better is to use 2.5. so I created new project and still get this 4044 error. It is technical error I think.
linked to: http://stackoverflow.com/q/1163493
downvote count: 0
tagged with: jsp
has title: HTTP Status 404 Eclipse Tomcat 7
tagged with: tomcat
favorite count: 0
has comment: http://stackoverflow.com/comment/34764682
has comment: http://stackoverflow.com/comment/34763652
has comment: http://stackoverflow.com/comment/34764133
upvote count: 3
possible better answer: http://stackoverflow.com/a/22800072
has comment: http://stackoverflow.com/comment/34763710
has comment: http://stackoverflow.com/comment/34764115
has comment: http://stackoverflow.com/comment/34763586
accepted answer: http://stackoverflow.com/a/22799130
has comment: http://stackoverflow.com/comment/34765107
type: AnsweredQuestion
score: 3
has comment: http://stackoverflow.com/comment/34763435

http://stackoverflow.com/q/22766709
tagged with: java
has comment: http://stackoverflow.com/comment/34707947
has title: Non static members in Singleton class
tagged with: methods
has comment: http://stackoverflow.com/comment/34708094
has comment: http://stackoverflow.com/comment/34707951
type: Question
downvote count: 0
possible better answer: http://stackoverflow.com/a/22771424
favorite count: 0
answer count: 3
has answer: http://stackoverflow.com/a/22766846
tagged with: singleton
accepted answer: http://stackoverflow.com/a/22766751
has comment: http://stackoverflow.com/comment/34712065
tagged with: static
upvote count: 2
has comment: http://stackoverflow.com/comment/34707991
tagged with: multithreading
has answer: http://stackoverflow.com/a/22766751
has comment: http://stackoverflow.com/comment/34708030
has answer: http://stackoverflow.com/a/22771424
has comment: http://stackoverflow.com/comment/34707974
score: 2
type: AnsweredQuestion
has body: I´m doing a singleton class as follows. public class SingletonTest { private static SingletonTest instance; private Integer result; private SingletonTest() { } public synchronized static SingletonTest getInstance(){ if(instance == null){ instance = new SingletonTest(); } return instance; } public Integer calculateResult(int value1, int value2) { result = value1 + value2; return result; } } But a problem occurs when I call non-static members from multiple threads (with JMeter). By example: Thread 1: SingletonTest.getInstance().calculateResult(1,2) -> return 3 Thread 2: SingletonTest.getInstance().calculateResult(3,2) -> return 3 I think this happen because 2 threads are accessing in the same time at method and override de property called result.

http://stackoverflow.com/comment/34591727
type: Comment
comment on: http://stackoverflow.com/a/22701950
type: AnswerComment
has text: right now I just get the new activity open blank web view but I'm not exactly sure what you mean on passing the string. thats exactly what im missing but i dont get how to put it in thanks
score: 0

http://stackoverflow.com/comment/34597300
type: Comment
score: 0
type: AnswerComment
has text: I have it set up like this and it's saying I'm not using onPost Execute? Sorry not sure how to format the comment! @wqrahd `public class myAsyn extends AsyncTask<Void,Void,Void> { @Override protected Void doInBackground(Void... params) { data = pullSchedule(); return null; } protected void onPostExecute(String result) { upDateUI(data,arrayPosition); } }`
comment on: http://stackoverflow.com/a/22703958

http://stackoverflow.com/comment/34605422
type: Comment
has text: In the run method, I've added it to the main post
score: 0
comment on: http://stackoverflow.com/q/22709661
type: QuestionComment

http://stackoverflow.com/comment/34678259
has text: what are the dimensions of the array?
type: Comment
type: QuestionComment
score: 0
comment on: http://stackoverflow.com/q/22750349

http://stackoverflow.com/comment/34682624
comment on: http://stackoverflow.com/a/22752061
has text: Hi James, Thanks. I went with the first one. For the second solution, how would it know that CONTROL is pressed? All it says SHORTCUT_DOWN.
score: 0
type: AnswerComment
type: Comment

http://stackoverflow.com/comment/41107867
type: Comment
has text: Can you elaborate why this is working? How is the targeted runtime and a missing http-servlet connected? I'd be very interested in what's going on behind the curtains.
comment on: http://stackoverflow.com/a/25266076
score: 9
type: AnswerComment

http://stackoverflow.com/q/22740675
type: AnsweredQuestion
tagged with: design-patterns
type: Question
has answer: http://stackoverflow.com/a/22740763
tagged with: java
has answer: http://stackoverflow.com/a/22740996
possible better answer: http://stackoverflow.com/a/22740763
score: 0
accepted answer: http://stackoverflow.com/a/22740919
has title: What design pattern to use for a method implementation which is repeated in all classes implementing same interface?
has answer: http://stackoverflow.com/a/22740919
answer count: 5
has body: I was trying to make an objected oriented examples out of "union find". so I have an interface called UF, public interface UF { boolean connected(int p,int q); void printArray(); void union(int p,int q); } and the following classes implement it quickFindUF,quickUnionUF,quickWeightedUnionUF but all of them share a function which is identical in implementation, (the function printArray()) what is the best pattern to use to avoid printArray() code to be repeated ? do I create a class call ArrayPrinter and pass the array to it in the printArray() in all of those classes which implement UF ? Is there any pattern that I can do this without doing abstract inheritance and just use interfaces. because inheritance limits my design, if I inherit a class I wont be able to inherit anything else, I don't make that limitation just for a printArray() method ...
has answer: http://stackoverflow.com/a/22740904
has answer: http://stackoverflow.com/a/22741006

http://stackoverflow.com/comment/34590565
type: QuestionComment
type: Comment
has text: What is it meant to do? A two-dimensional array slice can be specified with 5 parameters, such as array reference, starting row, starting column, ending row, ending column.
score: 1
comment on: http://stackoverflow.com/q/22701375

http://stackoverflow.com/q/22788031
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/22788148
tagged with: java
has comment: http://stackoverflow.com/comment/34745741
has title: Why first enumeration of encrypting data takes so long
upvote count: 1
type: Question
tagged with: performance
possible better answer: http://stackoverflow.com/a/22789416
has answer: http://stackoverflow.com/a/22789416
has comment: http://stackoverflow.com/comment/34745795
answer count: 2
downvote count: 0
has answer: http://stackoverflow.com/a/22788148
score: 1
has comment: http://stackoverflow.com/comment/34746496
favorite count: 0
tagged with: encryption
has body: I want to create performance test where I am encrypting data using AES with PKCPadding5/7 depends on provider(IBM or BouncyCastle) on aix system. My question is why first enumeration is so slow and other so fast ? When I run test with parameters: Padding: AES/CBC/PKCS7Padding Provider: BC version 1.47 Number of iteration: 1000 results is: Time: 392080057 ns Time: 174662 ns Time: 160906 ns Time: 169938 ns Time: 154344 ns Time: 155125 ns Time: 157344 ns Time: 157203 ns Time: 157611 ns Time: 158123 ns Parameters Padding: AES/CBC/PKCS5Padding Provider: IBMJCE version 1.7 Number of iteration: 1000 results is: Time: 13410344 ns Time: 185007 ns Time: 182562 ns Time: 170687 ns Time: 203156 ns Time: 189980 ns Time: 182608 ns Time: 174670 ns Time: 176842 ns Time: 174463 ns Code: for (int j = 0; j &lt; pocetIteraci; j++) { String text = randomString(46); long time = System.currentTimeMillis(); sifruj(padding, provider, generateVectot(),text); time = System.currentTimeMillis() - time; System.out.println("Time: " + time + " ms"); } public static byte[] sifruj(String padding, Provider provider, IvParameterSpec finalniInicializacniVektor,String text) throws Exception { return zpracuj(padding, provider, text.getBytes("UTF-8"), finalniInicializacniVektor, Cipher.ENCRYPT_MODE); } public static byte[] zpracuj(String padding, Provider provider, byte[] data, IvParameterSpec finalniInicializacniVektor, int mode) throws Exception { final SecretKeySpec klicSpec = new SecretKeySpec(klic, ALGORITHM_AES); final Cipher sifra = Cipher.getInstance(padding, provider); sifra.init(mode, klicSpec, finalniInicializacniVektor); return sifra.doFinal(data); } UPDATED: The most different (As I expected) is when creating first instance of cipher: long timeTemp = System.nanoTime(); final Cipher sifra = Cipher.getInstance(padding, provider); timeTemp = System.nanoTime() - timeTemp; System.out.println("XXXXXXXXXXXXXXXXX " + timeTemp + " ns"); Why?

http://stackoverflow.com/a/22805242
answers question: http://stackoverflow.com/q/22805092
has comment: http://stackoverflow.com/comment/34780176
downvote count: 0
type: Answer
score: 1
upvote count: 1
has body: Your loop ended the very next line of declaration and also u were printing only method name at at final index value after the loop completion. Try using braces, that will solve the problem. Check following code public static void main() throws Exception{ Log.i("Ramu","I am here displayM "); Class o =Class.forName("android.view.AbsSavedState"); Method M[]=o.getMethods(); for( i=0;i&lt;M.length;i++){ methodname = M[i].getName(); Listview.your_array_list.add(methodname); Listview.your_array_list.add(methodname); Log.i("Ramu","methode name "+ M[i].getName()); } //System.out.println(M[i].getName()); }

http://stackoverflow.com/comment/34803835
comment on: http://stackoverflow.com/a/22810447
type: AnswerComment
score: 0
type: Comment
has text: Ok, thank you so much for your explaination stephen.

jpa
tags question: http://stackoverflow.com/q/22670189
tags question: http://stackoverflow.com/q/22714277
tags question: http://stackoverflow.com/q/22687027
tags question: http://stackoverflow.com/q/22782734
tags question: http://stackoverflow.com/q/22760205
tags question: http://stackoverflow.com/q/22681154
tags question: http://stackoverflow.com/q/22653771
tags question: http://stackoverflow.com/q/22745637
tags question: http://stackoverflow.com/q/22703161
tags question: http://stackoverflow.com/q/22750312
tags question: http://stackoverflow.com/q/22751385
tags question: http://stackoverflow.com/q/22793445
tags question: http://stackoverflow.com/q/22730426
tags question: http://stackoverflow.com/q/22712863
tags question: http://stackoverflow.com/q/22676105
tags question: http://stackoverflow.com/q/22758179
tags question: http://stackoverflow.com/q/22760554
tags question: http://stackoverflow.com/q/22790052
tags question: http://stackoverflow.com/q/22726451
tags question: http://stackoverflow.com/q/22749222
tags question: http://stackoverflow.com/q/22668350
tags question: http://stackoverflow.com/q/22651520
tags question: http://stackoverflow.com/q/22792343
tags question: http://stackoverflow.com/q/22663603
tags question: http://stackoverflow.com/q/22687322
tags question: http://stackoverflow.com/q/22782683
tags question: http://stackoverflow.com/q/22676191
tags question: http://stackoverflow.com/q/22785287
tags question: http://stackoverflow.com/q/22787153
tags question: http://stackoverflow.com/q/22777230
tags question: http://stackoverflow.com/q/22706178
tags question: http://stackoverflow.com/q/22664681
tags question: http://stackoverflow.com/q/22699781
tags question: http://stackoverflow.com/q/22678567
type: Tag
tags question: http://stackoverflow.com/q/22771837
tags question: http://stackoverflow.com/q/22675723
tags question: http://stackoverflow.com/q/22758820
tags question: http://stackoverflow.com/q/22688402
tags question: http://stackoverflow.com/q/22698405
tags question: http://stackoverflow.com/q/22769559
tags question: http://stackoverflow.com/q/22657895
tags question: http://stackoverflow.com/q/22786493
tags question: http://stackoverflow.com/q/22713481
tags question: http://stackoverflow.com/q/22665392
tags question: http://stackoverflow.com/q/22695663
tags question: http://stackoverflow.com/q/22719221
tags question: http://stackoverflow.com/q/22806131
tags question: http://stackoverflow.com/q/22761581
tags question: http://stackoverflow.com/q/22732416
tags question: http://stackoverflow.com/q/22662453
tags question: http://stackoverflow.com/q/22702851
tags question: http://stackoverflow.com/q/22782493
tags question: http://stackoverflow.com/q/22735266
tags question: http://stackoverflow.com/q/22723727
tags question: http://stackoverflow.com/q/22705912
tags question: http://stackoverflow.com/q/22783891
tag name: jpa
tags question: http://stackoverflow.com/q/22731941
tags question: http://stackoverflow.com/q/22757186
tags question: http://stackoverflow.com/q/22662833
tags question: http://stackoverflow.com/q/22735543
tags question: http://stackoverflow.com/q/22746126
tags question: http://stackoverflow.com/q/22740745
tags question: http://stackoverflow.com/q/22662939
tags question: http://stackoverflow.com/q/22700224
tags question: http://stackoverflow.com/q/22722160
tags question: http://stackoverflow.com/q/22686846
tags question: http://stackoverflow.com/q/22802536
tags question: http://stackoverflow.com/q/22663502
tags question: http://stackoverflow.com/q/22795531
tags question: http://stackoverflow.com/q/22757028
tags question: http://stackoverflow.com/q/22745719
tags question: http://stackoverflow.com/q/22805700
tags question: http://stackoverflow.com/q/22780638
tags question: http://stackoverflow.com/q/22736769
tags question: http://stackoverflow.com/q/22754534
tags question: http://stackoverflow.com/q/22758327
tags question: http://stackoverflow.com/q/22743447
tags question: http://stackoverflow.com/q/22762375

http://stackoverflow.com/a/22772728
answers question: http://stackoverflow.com/q/22772664
type: Answer
score: 2
upvote count: 2
has body: Your regex is too greedy. Make it non-greedy. String rgx = "frank.*? ([0-9]+) frank";
downvote count: 0

http://stackoverflow.com/q/22793257
answer count: 1
tagged with: repository
linked to: http://stackoverflow.com/q/9051516
has title: Clojure dependency jars
accepted answer: http://stackoverflow.com/a/22833098
tagged with: clojure
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/34758979
has comment: http://stackoverflow.com/comment/34757518
score: 0
tagged with: java
type: Question
has comment: http://stackoverflow.com/comment/34755855
has body: I have project on my git repo and one of the jars that it uses, is actually inside the git repository. Here is the structure project /lib/mylib.jar /clojure_project/project.clj I need to add mylib.jar as dependecy but not to have any maven repos just local or git or some kind of straightforward way like in java/android... I am not experienced with clojure. I have tried many options: Use maven local repo as suggested here: https://www.pgrs.net/2011/10/30/using-local-jars-with-leiningen/ Problem is each time somebody clones the project they have to readd the maven repo plus download a bunch of maven staff. Then there is the git approach here: clojure and leiningen - using a git repository as dependency but it didn't work for me also I don't want to install any progins. Is there another way to add jars to clojure project?
has answer: http://stackoverflow.com/a/22833098

http://stackoverflow.com/a/22654966
type: Answer
score: 0
has body: put below code in your manifest file: &lt;activity android:name=".View.ViewRegistration" android:configChanges="keyboardHidden" android:windowSoftInputMode="stateHidden" /&gt; I hope its useful to you.and you can call below method in every activity onresume() and onPause(). public static void hideKeyboard(final Activity activity) { InputMethodManager inputManager = (InputMethodManager) activity .getSystemService(Context.INPUT_METHOD_SERVICE); if (activity.getCurrentFocus() != null) { inputManager.hideSoftInputFromWindow(activity.getCurrentFocus() .getWindowToken(), InputMethodManager.HIDE_NOT_ALWAYS); } }
answers question: http://stackoverflow.com/q/22654937

http://stackoverflow.com/comment/34756219
comment on: http://stackoverflow.com/q/22793594
type: Comment
type: QuestionComment
has text: The issue is in line 236 of TestSeizureDetected, which is calling the constructor for HjorthClass: Code like `new HjorthClass(argument, argument, null argument, argument)` The null argument is being dealt with badly and causing the constructor to fail.
score: 0

http://stackoverflow.com/comment/34768058
comment on: http://stackoverflow.com/q/22800055
score: 0
type: Comment
type: QuestionComment
has text: @Jason Sorry, Edited!

http://stackoverflow.com/a/22729566
upvote count: 1
downvote count: 0
type: Answer
has body: The Javadoc for the WebSphere MQ JMS classes can be found here. What you want to do is to create an instance of the com.ibm.mq.jms.MQConnectionFactory, com.ibm.mq.jms.MQQueueConnectionFactory or com.ibm.mq.jms.MQTopicConnectionFactory. Once you have an instance you can configure it using the various setters and then call one of the createConnection methods. A simple example would be: MQConnectionFactory factory = new MQConnectionFactory(); factory.setQueueManager("myQmgr"); factory.setTransportType(WMQConstants.WMQ_CM_BINDINGS); Connection conn = factory.createConnection(); Session session = conn.createSession(false, Session.AUTO_ACKNOWLEDGE); Queue q = session.createQueue("myQ"); TextMessage msg = session.createTextMessage(); msg.setText("My message body"); MessageProducer sender = session.createProducer(q);
score: 1
answers question: http://stackoverflow.com/q/22724474

http://stackoverflow.com/q/22696463
has comment: http://stackoverflow.com/comment/34581829
has comment: http://stackoverflow.com/comment/34582450
score: 0
tagged with: java
has comment: http://stackoverflow.com/comment/34585239
has comment: http://stackoverflow.com/comment/34581227
has comment: http://stackoverflow.com/comment/34581677
tagged with: eclipse
has comment: http://stackoverflow.com/comment/34581258
has comment: http://stackoverflow.com/comment/34581570
type: Question
has title: Eclipse IDE errors in every line of code
has comment: http://stackoverflow.com/comment/34581432
has comment: http://stackoverflow.com/comment/34581347
has comment: http://stackoverflow.com/comment/34580891
has comment: http://stackoverflow.com/comment/34582322
has comment: http://stackoverflow.com/comment/34582626
has answer: http://stackoverflow.com/a/22696984
has comment: http://stackoverflow.com/comment/34581935
has comment: http://stackoverflow.com/comment/34581635
has comment: http://stackoverflow.com/comment/34582118
has comment: http://stackoverflow.com/comment/34580912
has comment: http://stackoverflow.com/comment/34581734
has comment: http://stackoverflow.com/comment/34580922
has comment: http://stackoverflow.com/comment/34581826
answer count: 1
has comment: http://stackoverflow.com/comment/34581693
linked to: http://stackoverflow.com/q/15826202
has comment: http://stackoverflow.com/comment/34583023
has comment: http://stackoverflow.com/comment/34586216
has comment: http://stackoverflow.com/comment/34586002
has comment: http://stackoverflow.com/comment/34584323
has comment: http://stackoverflow.com/comment/34582578
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/34582021
has comment: http://stackoverflow.com/comment/34581464
has comment: http://stackoverflow.com/comment/34582619
has comment: http://stackoverflow.com/comment/34581159
has body: I am learning to code in java, and using Eclipse, the android IDE as my code writing program. Whenever I create a new project, there is always a red exclamation mark on the icon for the main folder of my project in the project explorer section on the left side of the screen. Also, whenever I create a new class file, some of the code has an error in it, even when it shouldn't. One example of this is when I add the main method, with this code: public static void main(String[] args) I get the error "String cannot be resolved to a type". There is also an automatically generated line of code at the beginning of the class which has an error in it: public class Class is giving me the error: "Implicit super constructor Object() is undefined for default constructor. Must define an explicit constructor" there is a red dotted line under the word "Class" in the code, so I assume its trying to tell me that's where the error is. I am also getting an error in the code System.out.println();saying "System cannot be resolved". I was able to create an integer without getting an error using this code: int number = 3; I was able to use all this code mentioned above without getting an error before, I don't know what's wrong... Could I have changed some settings or something? screenshot of eclipse

program-entry-point
tags question: http://stackoverflow.com/q/22799317
tags question: http://stackoverflow.com/q/22787063
tag name: program-entry-point
type: Tag
tags question: http://stackoverflow.com/q/22733614

http://stackoverflow.com/a/22805305
type: Answer
has body: Yes you can..No need to cast.. Simply you can do like you said, t = t + " " + i + " " + d;
answers question: http://stackoverflow.com/q/22805257
score: 3
upvote count: 3
accepted answer of: http://stackoverflow.com/q/22805257
type: AcceptedAnswer
downvote count: 0

http://stackoverflow.com/q/22691820
tagged with: java
has comment: http://stackoverflow.com/comment/34596545
type: Question
has answer: http://stackoverflow.com/a/22692705
accepted answer: http://stackoverflow.com/a/22692705
has body: Okay, this is likely to be flagged as a repeated question, but please hear me out first. I have looked all over the internet and have tried various ways to show an image in a JFrame, but nothing has worked for me. Is there any simple, foolproof! way to show an image in JFrame? Because if it's not foolproof, I'm sure to mess it up :/
answer count: 1
tagged with: image
linked to: http://stackoverflow.com/q/18027833
score: 0
has comment: http://stackoverflow.com/comment/34572415
favorite count: 0
tagged with: jframe
upvote count: 1
tagged with: swing
has comment: http://stackoverflow.com/comment/34581805
downvote count: 1
has title: How to show image in JFrame
type: AnsweredQuestion
linked to: http://stackoverflow.com/q/9417356

http://stackoverflow.com/q/22726656
has title: How to work with .sql file in Java
linked to: http://stackoverflow.com/q/2907141
score: 0
answer count: 2
has comment: http://stackoverflow.com/comment/34636253
has answer: http://stackoverflow.com/a/22726710
has body: I have collected a source code of a java project from internet where there is a file with .sql extension. I am new to java and don,t know how to work with and get access to .sql file. How can I import the file in Netbeans and how to get access to that database. For your kind information, The project is on inventory management system and I have to get access to that database with a username and password contained inside it. What will I do now? Do I have to install any additional software or something else? Please give a step by step procedure to do that. Thanks in advance
type: UnansweredQuestion
linked to: http://stackoverflow.com/q/1044194
has comment: http://stackoverflow.com/comment/34636474
tagged with: java
has answer: http://stackoverflow.com/a/22726747
type: Question
has comment: http://stackoverflow.com/comment/34636283

http://stackoverflow.com/comment/47358055
comment on: http://stackoverflow.com/q/22769799
has text: Take care that `-XXdumpSize:none` is the JRockit specific option you may quickly find when googling about this question. Hotspot JVM is not JRockit.
type: QuestionComment
type: Comment
score: 2

http://stackoverflow.com/a/22750481
score: 2
downvote count: 0
has comment: http://stackoverflow.com/comment/34678626
has comment: http://stackoverflow.com/comment/34679733
has body: The problems are in your public void registerIconsRegister(IIconRegister reg) method: Firstly, the method you're supposed to be overriding is defined as: public void registerIcons(net.minecraft.client.renderer.texture.IconRegister register) So that method isn't being called, and even if it were, all of your equal checks will fail: if(this == halo.TitaniumHelmet) As neither ItemArmor nor Item override Object.equals(Object obj), Java will perform memory reference checks which will all fail. Regardless, the registerIcons method should register all item icons, regardless of what metadata based sub-Items exist, so just remove the if statements entirely.
accepted answer of: http://stackoverflow.com/q/22749861
upvote count: 2
has comment: http://stackoverflow.com/comment/34678587
answers question: http://stackoverflow.com/q/22749861
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/34680386
has comment: http://stackoverflow.com/comment/34679176
type: Answer

http://stackoverflow.com/comment/89517252
comment on: http://stackoverflow.com/a/22708357
type: Comment
has text: This solution is only for mins and maxes that are integers.
score: 0
type: AnswerComment

http://stackoverflow.com/q/22704034
tagged with: c#
has answer: http://stackoverflow.com/a/22704106
score: 0
answer count: 2
has title: How to convert char[] to UTF-8 byte[] in C#?
possible better answer: http://stackoverflow.com/a/22704113
tagged with: .net
has answer: http://stackoverflow.com/a/22704113
accepted answer: http://stackoverflow.com/a/22704106
has body: I'm porting a Java function as below codes to C#, it converts a char array to UTF-8 format, and then convert to byte array, how can do this in .Net platform via C#? Java code: public static byte[] GetBytes(char[] chars) { Charset cs = Charset.forName("UTF-8"); CharBuffer cb = CharBuffer.allocate(chars.length); cb.put(chars); cb.flip(); ByteBuffer bb = cs.encode(cb); byte[] array = bb.array(); return array }
type: AnsweredQuestion
tagged with: java
type: Question

http://stackoverflow.com/q/22711489
tagged with: http://stackoverflow.com/tag/c
has comment: http://stackoverflow.com/comment/34608584
type: Question
has body: I have 2 files that i would like to join on the first column : file 1 contains 46395029 lines and file 2 contains 86510559. file1.txt &gt;ID sequence CJP75M1:393:C2T21ACXX:8:1101:2069:1997 1:N:0:_45 TAGTATTACGACG CJP75M1:393:C2T21ACXX:8:1101:2711:1992 1:N:0:_65 TCCGAGGCCCTGTAATTGGAATGAGTAC CJP75M1:393:C2T21ACXX:8:1101:3822:1989 1:N:0:_115 CCGGAGAGGGAGCCTGAGAAACGGCTACCAC file2.txt &gt;ID Barcode CJP75M1:393:C2T21ACXX:8:1101:2069:1997 1:N:0:_45 CTCG CJP75M1:393:C2T21ACXX:8:1101:2711:1992 1:N:0:_65 CTAG CJP75M1:393:C2T21ACXX:8:1101:3822:1989 1:N:0:_115 CTGG I would like to merge these two files on the first colum to have : &gt;TAGTATTACGACG CTCG TCCGAGGCCCTGTAATTGGAATGAGTAC CTAG CCGGAGAGGGAGCCTGAGAAACGGCTACCAC CTGG In only want lines in file1 so result file should contain "only" 46395029 lines. I did it with awk : awk 'BEGIN {FS= "\t"; OFS="\t"} { while (getline &lt; "file1.txt") { f[$1] = $2} {print $2, f[$1] }}' "file2.txt" | sed '1d' &gt; result.txt But it's really long (2 days it is running). I have a linux debian (stable) server of 64bit / 16Go of RAM Any ideas ? Thanks
tagged with: awk
has answer: http://stackoverflow.com/a/22712263
score: 0
answer count: 3
tagged with: merge
has answer: http://stackoverflow.com/a/22711844
has comment: http://stackoverflow.com/comment/34608614
has answer: http://stackoverflow.com/a/22713320
has comment: http://stackoverflow.com/comment/34608593
type: UnansweredQuestion
has title: Merge/join two big files
has comment: http://stackoverflow.com/comment/34608196
tagged with: join
tagged with: java

http://stackoverflow.com/q/22785096
possible better answer: http://stackoverflow.com/a/22785586
has comment: http://stackoverflow.com/comment/34740714
has answer: http://stackoverflow.com/a/22785586
favorite count: 0
accepted answer: http://stackoverflow.com/a/22785371
has comment: http://stackoverflow.com/comment/34740542
has comment: http://stackoverflow.com/comment/34740813
has comment: http://stackoverflow.com/comment/34741390
type: AnsweredQuestion
tagged with: dynamic
upvote count: 2
score: 1
tagged with: java
has comment: http://stackoverflow.com/comment/34740632
has comment: http://stackoverflow.com/comment/34785115
downvote count: 1
type: Question
has comment: http://stackoverflow.com/comment/34741001
tagged with: casting
has answer: http://stackoverflow.com/a/22785371
has body: Or is it even possible? I'm writing a REST client at the time. There is the URLConnection class in java which is extended by HttpURLConnection and HttpsURLConnection. What I'd like is declare a type (HttpURLConnection or HttpsURLConnection) and cast this URLConnection object based on a boolean value to that declared type. F.e: Class&lt;? extends URLConnection&gt; theClass = _SSL ? HttpsURLConnection.class : HttpURLConnection.class; then ((theClass) HttpConnection).setRequestMethod("POST"); or something similar. Thanks in advance!
has title: How to cast dynamically in java with the usual brackets?
has comment: http://stackoverflow.com/comment/34740899
has comment: http://stackoverflow.com/comment/34740534
answer count: 2

http://stackoverflow.com/comment/34625557
score: 0
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/22720725
has text: `Map<String,List<RandomInfo>>`

http://stackoverflow.com/q/22701070
accepted answer: http://stackoverflow.com/a/22701453
has comment: http://stackoverflow.com/comment/34590812
has answer: http://stackoverflow.com/a/22701388
tagged with: class
tagged with: api-design
has comment: http://stackoverflow.com/comment/34590384
downvote count: 0
has comment: http://stackoverflow.com/comment/34590054
favorite count: 0
has comment: http://stackoverflow.com/comment/34589925
has body: I tried googling and searching for this question but somehow couldn't find anything relevant about it. I'm wondering if there is a bbest-practise guide on when to use attributes in a class and when not, but rather use parameters to the single methods. Many cases are clear to me, e.g. public class Dog { private name; public setName(...) {....} } But sometimes it's not clear to me what's better to use. E.g. the following, either use: public class calculation XYZ bla; public calculation(XYZ something) { this.bla = something; } public void calc1() { // some calculations with this.bla } public void calc1() { // some more calculations with this.bla } public XYZ getBla() { return this.bla; } } or maybe do: public class calculation public calculation() {} public static XYZ calc1(XYZ bla) // maybe static, if not dependant on other attributes/instance-variables etc { // some calculations with bla return bla; } public static XYZ calc1() // maybe static, if not dependant on other attributes/instance-variables etc { // some more calculations with bla return bla; } } I mean you can argue for both cases. I see advantages and maybe disadvantages for both different styles, but somehow I prefer the second one as far as long as there are not too many arguments/parameters needed. Sure, if I need many many more attributes etc., then the first one will be better, simpler etc. because I dont need to pass so many parameters to the method... Just a question of personal style? Or how to decide for one approach? Thanks EDIT: A better example: I'm curently doing much image processing and the question would be wether to store the image internally in the state of the object or not. I'm currently NOT doing it because I'm using static methods, and psasing the image itself I to each method: public class ImageProcessing { /** * */ public static Mat cannyEdges(Mat I, int low, int high) { // ... return I; } public static Mat cannyEdges(Mat I) { return ImageProcessing.cannyEdges(I, ContourDetection.CAN…
has answer: http://stackoverflow.com/a/22701453
has answer: http://stackoverflow.com/a/22701879
answer count: 4
type: AnsweredQuestion
tagged with: oop
tagged with: java
possible better answer: http://stackoverflow.com/a/22701478
has title: Java: When to use attributes, when to use method parameters?
has answer: http://stackoverflow.com/a/22701478
type: Question
score: 5
has comment: http://stackoverflow.com/comment/34589864
upvote count: 5

http://stackoverflow.com/comment/34694180
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/22757869
has text: It uses an `Iterator` internally. This is called an *enhanced for loop*.
score: 0

tostring
tags question: http://stackoverflow.com/q/22747104
tags question: http://stackoverflow.com/q/22748076
tags question: http://stackoverflow.com/q/22775288
tag name: tostring
tags question: http://stackoverflow.com/q/22696976
type: Tag
tags question: http://stackoverflow.com/q/22739807
tags question: http://stackoverflow.com/q/22727013
tags question: http://stackoverflow.com/q/22672690

http://stackoverflow.com/a/22684172
has comment: http://stackoverflow.com/comment/37364990
has body: Assuming you have SqlMapConfig.xml inside the Jar, for example in the position: /res/ibatis/SqlMapConfig.xml You should reference it in the spring.xml file as the following: <property name="configLocation" value="classpath:/res/ibatis/SqlMapConfig.xml"/> <property name="dataSource" ref="yourDataSource"/> (note the classpath: marker)
downvote count: 0
type: Answer
answers question: http://stackoverflow.com/q/22682108
has comment: http://stackoverflow.com/comment/37356265
upvote count: 1
has comment: http://stackoverflow.com/comment/34598427
has comment: http://stackoverflow.com/comment/34599585
score: 1

http://stackoverflow.com/q/22779823
has title: Apache Tomcat HTTP Status 405 - HTTP method GET is not supported by this URL
type: UnansweredQuestion
tagged with: http
type: Question
has comment: http://stackoverflow.com/comment/34731331
has comment: http://stackoverflow.com/comment/34731553
tagged with: java
has comment: http://stackoverflow.com/comment/34731516
answer count: 1
has answer: http://stackoverflow.com/a/22780188
has body: When i run the program at first stage index.jsp page appear with two field of login and password and providing correct username password when i press submit button my Tomcat show such type of error HTTP Status 405 - HTTP method GET is not supported by this URL but i also try GET method but same error. Please some one help me thanx a lot.
tagged with: tomcat
linked to: http://stackoverflow.com/q/5370633
has comment: http://stackoverflow.com/comment/34731447
score: 0
duplicate of: http://stackoverflow.com/q/5370633
has comment: http://stackoverflow.com/comment/34731354

http://stackoverflow.com/comment/34638078
has text: @CommonsWare So I made a static LinkedBlockingQueue in the ExerciseMovement class and did what you asked me to. In the run() method, I polled the queue and played the media player sound if readings are in a certain range. But how do I wait for the next event? I don't know how I can implement that.
comment on: http://stackoverflow.com/a/22725944
type: AnswerComment
score: 0
type: Comment

http://stackoverflow.com/a/22760642
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/22760513
has comment: http://stackoverflow.com/comment/34696899
answers question: http://stackoverflow.com/q/22760513
type: Answer
has comment: http://stackoverflow.com/comment/34696766
has comment: http://stackoverflow.com/comment/34696817
score: 3
has body: public &lt;T extends DMAbstractObject&gt; DataFactory&lt;T&gt; getDataFactory(Class&lt;T&gt; clazz) use a generic to lock down the type. Generics can be defined at the method level as well as at the class level.
downvote count: 0
upvote count: 3

http://stackoverflow.com/comment/34770866
type: AnswerComment
score: 0
comment on: http://stackoverflow.com/a/22777104
type: Comment
has text: @SotiriosDelimanolis You are a champ. This is why stack exchange is awesome!

http://stackoverflow.com/a/22748815
score: 0
type: Answer
answers question: http://stackoverflow.com/q/22747680
has body: Sorry for some reasons the format here doesnt work for me You have int selected = r.nextInt[100]; the code should be int selected = r.nextInt(100); The reason being this is you use [] for array, () to call a method on an object. For example, if you want to create an array, you do int[] arr = new int[100]; // created an array with enough storage to hold 100 int the following would fail int() arr = new int(arr); // fail! On the other hand, if you do Random r = new Random(); // it works! but the following would fail Random r = new Random[]; // fail!

http://stackoverflow.com/q/22776172
has comment: http://stackoverflow.com/comment/34726307
type: Question
has body: EDIT at end of post Test Code and Output import java.awt.EventQueue; import java.beans.PropertyChangeEvent; import java.beans.PropertyChangeListener; import java.text.NumberFormat; import javax.swing.JFormattedTextField; import javax.swing.JOptionPane; import javax.swing.JPanel; import javax.swing.text.NumberFormatter; public class Test{ private JFormattedTextField input, input2; private NumberFormatter formatter; private PropertyChangeListener listener; public Test(){ formatter = new NumberFormatter(NumberFormat.getNumberInstance()); input = new JFormattedTextField(formatter); input2 = new JFormattedTextField(formatter); listener = new PropertyChangeListener(){ @Override public void propertyChange(PropertyChangeEvent evt) { convert(evt); } }; input.setColumns(4); input2.setColumns(4); input.addPropertyChangeListener("value", listener); input2.addPropertyChangeListener("value", listener); input.setValue(0.0); JPanel panel = new JPanel(); panel.add(input); panel.add(input2); JOptionPane.showMessageDialog(null, panel); } private void convert(PropertyChangeEvent evt){ if (evt.getSource()== input){ if (evt.getSource()!= null){ double temp; temp = converter((Double)evt.getNewValue()); input2.setValue(temp); } } } public static void main(String[] args) { EventQueue.invokeLater(new Runnable(){ public void run(){ new Test(); } }); } private double converter(double value){ value = value*2; return value; } } The stack trace: Exception in thread "AWT-EventQueue-0" java.lang.ClassCastException: java.lang.Long cannot be cast to java.lang.Double at test.Test.convert(Test.java:46) My thoughts Because I have a method that passes in a double (it's convert()) , and seemingly evt.getNewValue() returns the direct value, which at the time of input is technically a long, it's throwing that error. But every attempt at parsing my evt.getNewValue() to a double hasn't worked. Perhaps a little knowledge of what I'm trying to do with this program would help. What The Program is for So I've got…
has comment: http://stackoverflow.com/comment/34727064
has comment: http://stackoverflow.com/comment/34726945
downvote count: 0
has comment: http://stackoverflow.com/comment/34725288
accepted answer: http://stackoverflow.com/a/22776224
has comment: http://stackoverflow.com/comment/34725851
has comment: http://stackoverflow.com/comment/34724947
has comment: http://stackoverflow.com/comment/34750901
has comment: http://stackoverflow.com/comment/34725061
has title: Don't know how to fix my PropertyChangeListener on a JFormattedTextField
answer count: 1
favorite count: 0
tagged with: listener
has comment: http://stackoverflow.com/comment/34762856
tagged with: jformattedtextfield
upvote count: 2
has comment: http://stackoverflow.com/comment/34725497
tagged with: propertychangelistener
tagged with: swing
score: 2
has answer: http://stackoverflow.com/a/22776224
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/34768020
tagged with: java
has comment: http://stackoverflow.com/comment/34725902
has comment: http://stackoverflow.com/comment/34726869

http://stackoverflow.com/q/22758327
accepted answer: http://stackoverflow.com/a/22780976
type: AnsweredQuestion
tagged with: java
tagged with: hibernate
downvote count: 3
score: -1
type: Question
tagged with: jpa
answer count: 1
has title: Infinispan : Remote Second Level Cache for Hibernate (JPA)
has comment: http://stackoverflow.com/comment/34701123
favorite count: 0
has answer: http://stackoverflow.com/a/22780976
has comment: http://stackoverflow.com/comment/43225778
tagged with: infinispan
has comment: http://stackoverflow.com/comment/34702124
upvote count: 2
tagged with: maven
has body: Does Infinispan support Distributed and Remote Second Level Cache for Hibernate when using JPA? Would you please give me the necessary Maven dependencies and the needed settings in persistence.xml? Any other necessary settings (orther files) mentionned in your answer would be so appreciated. EDIT 1 Why the downvotes? You can check this link no settings are mentionned. Would you please justify your downvotes? EDIT : Details What are the needed properties in persistence.xml to set the L2 cache in a remote cluster/node? &lt;property name="..." value="..." /&gt; Thank you a lot!

http://stackoverflow.com/q/22726334
tagged with: java
has body: i would like to generate 24 string values on 24 textview which i created the xml file in android and also i code for the getid and set listener but not mentioned here. In the override oncick method i define the click fun method. In this code i simply code for the integer values but now i would like to compare from the string array which has static values like String[] value = {11,12,13,14,15,16,17,18,19,20,21,22,11,12,13,14,15,16,17,18,19,20,21,22}; Please help me to resolve my problem. public class GameDemo extends Activity implements AnimationListener, OnClickListener { FrameLayout iv1,iv2,iv3,iv4,iv5,iv6,iv7,iv8,iv9,iv10,iv11,iv12,iv13,iv14,iv15,iv16,iv17,iv18,iv19,iv20,iv21,iv22,iv23,iv24; TextView tv1,tv2,tv3,tv4,tv5,tv6,tv7,tv8,tv9,tv10,tv11,tv12,tv13,tv14,tv15,tv16,tv17,tv18,tv19,tv20,tv21,tv22,tv23,tv24; Animation an1,an2; int i1,counter,score,rev_count,level_counter; boolean r_c,s_c; Integer[] no; FrameLayout[] count,rem,revise; final Context context = this; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_game_demo); an1 = AnimationUtils.loadAnimation(this,R.anim.flip1); an1.setAnimationListener(this); an2 = AnimationUtils.loadAnimation(this,R.anim.flip1); an2.setAnimationListener(this); level_counter=24; getIDForAll(); setListnerForAll(); counter=1; rev_count=0; no = new Integer[25]; count = new FrameLayout[3]; rem = new FrameLayout[3]; revise = new FrameLayout[8]; int i=0; for(i=0 ; i&lt;24 ; i++) { Random r = new Random(); i1 = r.nextInt(25 - 1) + 1; if(i!=0) { while(Arrays.asList(no).contains(i1)) { r = new Random(); i1 = r.nextInt(25 - 1) + 1; } no[i]= i1 ; } else { no[i]= i1 ; } } public void click_fun(FrameLayout arg0, TextView arg1, int n) { if(counter&lt;2) { arg0.setAnimation(an1); if(no[n]&lt;=12) { arg1.setText(""+no[n]); arg0.setBackgroundResource(android.R.color.white); } else { arg1.setText(""+(no[n]-12)); arg0.setBackgroundResource(android.R.color.white); } a…
type: Question
score: 0
tagged with: random
answer count: 1
tagged with: android
has answer: http://stackoverflow.com/a/22726381
accepted answer: http://stackoverflow.com/a/22726381
has title: How to generate 24 string values randomly on textview in android?
type: AnsweredQuestion

http://stackoverflow.com/q/22757455
tagged with: java
tagged with: eclipse
has answer: http://stackoverflow.com/a/22788581
type: Question
has body: We have an .ear project with several dependent .jar projects and we are using Maven. Each project has its own property file, but the properties inside do not have specific values but placeholders, e.g. database.url=${database.url} The placeholder ${database.url} is replaced during Maven build process using the resources plugin. So for each stage (local, test, integration, production) we have a different Maven profile defining the filter, so if we build for the test stage we get something like database.url=url.for.test.db The application is running on WLS 12, and we want to deploy it on local WLS using the Eclipse server plugin (we are using Eclipse Kepler). However, when we add the application to the server in Eclipse and publish, it is not working since the placeholders in the property files are not replaced with specific values. AFAIK, the content being deployed is located in the Eclipse workspace: &lt;workspace&gt;\.metadata\.plugins\org.eclipse.core.resources\.projects\&lt;ear-project-name&gt;\beadep\&lt;WLS domain name&gt;\&lt;ear-project-name&gt; Of course we could change the property files in that location, but whenever we publish in Eclipse, those changes are overwritten and we get again the original property file database.url=${database.url} which is useless when it is deployed to WLS. Is there any mechanism or possibility to change the property files before they are deployed to WLS from Eclipse? Thanks for your help.
tagged with: weblogic12c
has title: Replace content of property files when publishing application in Eclipse
upvote count: 2
answer count: 1
downvote count: 0
favorite count: 0
type: UnansweredQuestion
tagged with: maven
tagged with: properties
score: 2

http://stackoverflow.com/a/22691334
answers question: http://stackoverflow.com/q/22690905
type: Answer
has comment: http://stackoverflow.com/comment/34572030
downvote count: 0
has body: Look at the JavaDocs for sendRedirect(). You're telling the client on each request to go back to /Servlet1, but then you're filtering it indefinitely. At some point you need to stop sending redirects in your filter! To clarify some more. If you don't intend to actively filter a request, the only thing you need to do is call filterChain.dofilter(request, response); Don't send back a redirect unless you really mean to send an HTTP 302 (Temporary Redirect). The Servlet Filter Chain is an important part of the servlet process and although it may seem counterintuitive, you can make your filter appear to do nothing by calling the filterChain.doFilter command, which allows the request to proceed to other filters that are configured by your application server. What's not clear to me is what filtering your filter is attempting to do. If you intend to filter by URL then you should look for matching URLs and then redirect only if there's a match.
score: 1
has comment: http://stackoverflow.com/comment/34572458
has comment: http://stackoverflow.com/comment/34572276
upvote count: 1

http://stackoverflow.com/q/22694285
tagged with: arrays
answer count: 1
favorite count: 0
accepted answer: http://stackoverflow.com/a/22694640
has body: I have a problem with a table in JAVA. So I want to know, how do I get all the data out of a table1 which isn't a member of table2. Example : table1 [1, 2, 3, 4] , table2[1, 2, 3] I want to get the data "4" out of table1. If someone can help me, please do.
type: AnsweredQuestion
tagged with: java
downvote count: 1
type: Question
has title: How to get data out of a Table element which isn't a member of another table
score: -1
has answer: http://stackoverflow.com/a/22694640
has comment: http://stackoverflow.com/comment/34577037
upvote count: 0

http://stackoverflow.com/q/22656528
tagged with: tomcat
favorite count: 0
has body: I am using tomcat 7 and I have a webapp which has 1 configuration file &amp; 1 hazelcast.xml file in tomcat bin directory. When I start tomcat as a process from startup.bat catalina.timestamp.log shows INFO: Configuring Hazelcast from 'C:\Program Files\Apache Software Foundation\Tomcat 7.0_ApacheTomcat7\bin\hazelcast.xml'. and everything works fine, but when I start the same webapp by starting tomcat as a windows service it goes to tomcat home dir and looks for the file here INFO: Configuring Hazelcast from 'C:\Program Files\Apache Software Foundation\Tomcat 7.0_ApacheTomcat7\hazelcast.xml'. Is there any jvm or tomcat option that I need to place? below is my Java Options which is set in Tomcat properties -Dcatalina.home=C:\Program Files\Apache Software Foundation\Tomcat 7.0_ApacheTomcat7 -Dcatalina.base=C:\Program Files\Apache Software Foundation\Tomcat 7.0_ApacheTomcat7 -Djava.endorsed.dirs=C:\Program Files\Apache Software Foundation\Tomcat 7.0_ApacheTomcat7\endorsed -Djava.io.tmpdir=C:\Program Files\Apache Software Foundation\Tomcat 7.0_ApacheTomcat7\temp -Djava.util.logging.manager=org.apache.juli.ClassLoaderLogManager -Djava.util.logging.config.file=C:\Program Files\Apache Software Foundation\Tomcat 7.0_ApacheTomcat7\conf\logging.properties
type: AnsweredQuestion
downvote count: 0
tagged with: tomcat7
tagged with: windows-services
type: Question
has answer: http://stackoverflow.com/a/22659084
accepted answer: http://stackoverflow.com/a/22659084
score: 3
has title: Tomcat fails to load webapp when it is running as a windows service
tagged with: java
tagged with: tomcat6
upvote count: 3
answer count: 1

http://stackoverflow.com/q/22696248
answer count: 0
has comment: http://stackoverflow.com/comment/34588757
type: UnansweredQuestion
has body: I'm trying to create a cpp JNI file to allow me to do pretty much this tutorial in two calls so I can use this SURF Feature Detection in a Google Glass app. This error/problem that I'm having is not Google Glass related, but I believe Eclipse build environment related. I'm still relatively new to making projects in Eclipse, much less Android projects in Eclipse, so I'm pretty sure I'm missing something that's just ridiculously obvious and I need it pointed out to me. My main problem is that my final shared library file from the JNI is not being built, but the inbetween file is and my output from the build isn't indicating any explicit errors. I know I should be able to build a JNI lib file that I can use in the Java in Android because JNI has been used in Android and I was also trying to follow the tutorials provided by the awesome person who made them here and here. These tutorials explain how to side-build the nonfree Opencv libs (the ones that contain SURF and SIFT) and put them in an Android project and how to utilize the libraries in JNI in the Android project. My JNI code is the code from the very first link split into two functions, one that get called to setup the object keypoint setup that only needs to happen once and the other to get called on every frame in the Activity onCameraFrame() function. #include &lt;jni.h&gt; #include &lt;stdio.h&gt; #include &lt;opencv2/core/core.hpp&gt; #include &lt;opencv2/features2d/features2d.hpp&gt; #include &lt;opencv2/highgui/highgui.hpp&gt; #include &lt;opencv2/imgproc/imgproc.hpp&gt; #include &lt;opencv2/calib3d/calib3d.hpp&gt; #include &lt;opencv2/nonfree/features2d.hpp&gt; #include &lt;opencv2/nonfree/nonfree.hpp&gt; using namespace std; using namespace cv; extern "C" { // SURF Vars Mat mat_object; int minHessian = 500; SurfFeatureDetector detector( minHessian ); vector&lt;KeyPoint&gt; kp_object; SurfDescriptorExtractor extractor; Mat des_object; FlannBasedMatcher matcher; vector&lt;Point2f&gt; obj_corners(4); JNIEXP…
tagged with: java-native-interface
tagged with: java
tagged with: eclipse
type: Question
has comment: http://stackoverflow.com/comment/34583832
score: 0
has title: What setup do I need to fix in Eclipse to get final jni.so file?
tagged with: android
tagged with: c++

http://stackoverflow.com/a/22785388
type: AcceptedAnswer
downvote count: 0
accepted answer of: http://stackoverflow.com/q/22785139
type: Answer
answers question: http://stackoverflow.com/q/22785139
score: 4
has body: Apache's HttpClient has two separate timeouts: a timeout for how long to wait to establish a TCP connection, and a separate timeout for how long to wait for a subsequent byte of data. HttpConnectionParams.setConnectionTimeout() is used for establishing a TCP connection, whereas HttpConnectionParams.setSoTimeout() is used while waiting for a subsequent byte of data. // Creating default HttpClient HttpClient httpClient = new DefaultHttpClient(); final HttpParams httpParams = httpClient.getParams(); // Setting timeouts HttpConnectionParams.setConnectionTimeout(httpParams, 5000); HttpConnectionParams.setSoTimeout(httpParams, 30000); // Rest of your code final HttpPost httppost = new HttpPost(address); httppost.setHeader("Accept", "text/xml"); httppost.setHeader("Content-type", "application/xml; charset=UTF-8"); httppost.setEntity(new StringEntity(body)); final HttpResponse response = httpclient.execute(httppost); final HttpEntity entity = response.getEntity();
upvote count: 4

http://stackoverflow.com/comment/38652428
comment on: http://stackoverflow.com/q/22780970
has text: same here with .bmp, how did you solved it ? img = (BufferedImage)(new ImageIcon(path).getImage()); also hangs
type: Comment
type: QuestionComment
score: 1

http://stackoverflow.com/comment/53193111
type: Comment
comment on: http://stackoverflow.com/q/22786968
score: 0
type: QuestionComment
has text: If you save the file as an xlsx, do you still have the problem? If so, you can expand the file and check which area is the culprit.

http://stackoverflow.com/comment/34729766
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/22778480
has text: Hey Nicolás, I've updated the question with the code. Now can you please help me?
score: 0

http://stackoverflow.com/q/22736399
has answer: http://stackoverflow.com/a/22743298
has title: Reading a response of an APDU command
score: 1
tagged with: java
tagged with: apdu
type: Question
has answer: http://stackoverflow.com/a/33415766
answer count: 2
downvote count: 0
favorite count: 0
tagged with: smartcard
has body: I am trying to read data from a file in a smart card, I'm using the following APDU command 00 B0 00 02 00 but I get this response: A1 1B 4F 0C A0 00 00 00 77 02 08 05 04 49 44 01 50 07 43 4E 49 2D 43 53 45 51 02 10 01 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 90 00 How can I convert or read this value in hexadecimal encoding?
type: UnansweredQuestion
upvote count: 1

http://stackoverflow.com/q/22745762
tagged with: code-generation
has comment: http://stackoverflow.com/comment/34670147
type: AnsweredQuestion
tagged with: java
has title: Eclipse access to workspace, compiler and export function from code
tagged with: eclipse
has comment: http://stackoverflow.com/comment/34669771
type: Question
accepted answer: http://stackoverflow.com/a/22762132
has comment: http://stackoverflow.com/comment/34674238
has comment: http://stackoverflow.com/comment/34669609
score: 0
has answer: http://stackoverflow.com/a/22762132
answer count: 1
has body: I have following tasks: Automatically generate java source files in the current workspace. Compile those files after generation. Export every generated and compiled class with needed libraries to runnable JAR file. I already installed Eclipse SDK and I suppose what I need is to make my main class inherit some class from SDK and maybe load some other classes. But i don't know what do I need exactly and where to look. I'd appreciate some clues.
tagged with: eclipse-plugin
has comment: http://stackoverflow.com/comment/34688812

http://stackoverflow.com/comment/34819240
type: Comment
comment on: http://stackoverflow.com/a/22808689
score: 0
type: AnswerComment
has text: @Zedai OP has accepted your answer, since it has helped to solve the problem OP faced :) But, anyway thanks for the compliment!

http://stackoverflow.com/comment/123423713
type: AnswerComment
comment on: http://stackoverflow.com/a/22695031
type: Comment
has text: @TWiStErRob ohh, sure, mb, I was way too focused on the collecting itself. So actually, you want to filter, and after the second element passing through the filtering abort with an error. This avoids filtering the other god-knows-how-many elements. To answer your question: I guess the solution by reduction (e.g. by @assylias) would do that, or you use 3rd party packages like guava. You also could use a for-loop...
score: 0

http://stackoverflow.com/a/22687907
has body: Tomcat is a web server and a servlet container.
downvote count: 0
answers question: http://stackoverflow.com/q/22687861
type: Answer
score: 1
upvote count: 1

http://stackoverflow.com/q/22717830
answer count: 4
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/22717996
has body: I'm creating a login system and wanted to add three more hardcoded login details to my code. I currently have one that requires a username, password and student number to login. When prompted to enter code in the console, the entries must match the hardcoded details to gain authentication. I would like to add three more login details, so there will be four in total. Here is my login system as it currently stands; final String UserID = "TomDeponeo"; final String Password = "LJMU"; final int StudentNumber = 22334455; String EnteredUserID; String EnteredPassword; int EnteredStudentNumber; for (int s = 0; s &lt;= 3; s++) { if (s &lt; 3) { System.out.println("Enter your UserID to access lift;"); EnteredUserID = console.nextLine(); System.out.println("Your UserID is &gt;&gt;&gt; " + EnteredUserID); System.out.println("Enter your password to authenticate login;"); EnteredPassword = console.nextLine(); System.out.println("Password Entered is &gt;&gt;&gt; " + EnteredPassword); System.out.println("Enter your student number to finalise login and authentication;"); EnteredStudentNumber = console.nextInt(); System.out.println("Student Number Entered is &gt;&gt;&gt; " + EnteredStudentNumber); if (UserID.equals(EnteredUserID) &amp;&amp; (Password.equals(EnteredPassword)) &amp;&amp; (StudentNumber == EnteredStudentNumber)) { System.out.println("Athentication complete!"); System.out.println("***Elevator access granted!***"); System.out.println("Welcome..."); Elevator a = new Elevator(); Elevator.selectFloor(); break; } else { System.out.println("Wrong UserID, Password or Student Number. Please try again."); } } else { System.out.println("3 incorrect enteries detected. Access Denied!"); } } } I currently only have one set of login details, but would like to add more. Here is an example of what I mean; final String UserID = "TomDeponeo"; final String Password = "LJMU"; final int StudentNumber = 22334455; final String UserID2 ="Secondname"; final String Password2 = "Secondpassword"; fi…
tagged with: java
tagged with: authentication
tagged with: loops
upvote count: 1
has answer: http://stackoverflow.com/a/22718111
type: Question
has answer: http://stackoverflow.com/a/22718256
has comment: http://stackoverflow.com/comment/34620240
tagged with: if-statement
possible better answer: http://stackoverflow.com/a/22718256
accepted answer: http://stackoverflow.com/a/22717996
has comment: http://stackoverflow.com/comment/34620213
downvote count: 0
score: 1
has comment: http://stackoverflow.com/comment/34620264
favorite count: 0
has title: Using || (or) or other operator?
has answer: http://stackoverflow.com/a/22718060

http://stackoverflow.com/q/22794839
score: 0
has body: I'm trying to make a .jar file out of a java project I wrote in Eclipse and I'm following this tutorial to get it done. I went to my 'workspace' directory and created the .mf file outside my src folder and opened a cmd window on the same level as the .mf file. I started the command jar cmf mf-file.mf jartest.mf Class1.class Class2.class . . . but I have like 40 classes! Is this really the way to make a double-click runnable program to use??
tagged with: command-line
has answer: http://stackoverflow.com/a/22794888
accepted answer: http://stackoverflow.com/a/22794888
has comment: http://stackoverflow.com/comment/34758295
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/34758324
has comment: http://stackoverflow.com/comment/34758425
tagged with: java
type: Question
has title: Do I need to manually enter class names of classes in a .jar-file?
linked to: http://stackoverflow.com/q/502960
answer count: 1
tagged with: jar

http://stackoverflow.com/q/22671072
answer count: 2
has answer: http://stackoverflow.com/a/22671182
has title: Trouble With Quotation Marks
downvote count: 0
has comment: http://stackoverflow.com/comment/34535928
tagged with: unicode
has answer: http://stackoverflow.com/a/22671354
favorite count: 0
has body: Works public static void main(String[] args) throws Exception { String PATH = "C:\\WINDOWS\\system32\\notepad.exe"; new ProcessBuilder(PATH).start(); } Does Not Work public static void main(String[] args) throws Exception { String PATH = "‪C:\\WINDOWS\\system32\\notepad.exe"; new ProcessBuilder(PATH).start(); } Exception in thread "main" java.io.IOException: Cannot run program "‪C:\WINDOWS\system32\notepad.exe": CreateProcess error=2, The system cannot find the file specified The two snippets appear to be identical. In the first example, I manually typed the quotes around the path. In the latter, broken example, the quotes were copied and pasted from a web site. When I copied and pasted both quotes into a Unicode character lookup tool I got the same result both times. Why does replacing a Unicode character with the exact same Unicode character suddenly fix my code? Am I missing something here? If anyone thinks that the snippets are identical, open your favorite IDE and copy and paste the snippets above without changing a single character. I am using NetBeans IDE 7.4 on a Windows 8 machine. I also tried Eclipse and had the same results.
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/34536124
score: 1
tagged with: java
accepted answer: http://stackoverflow.com/a/22671354
upvote count: 1
possible better answer: http://stackoverflow.com/a/22671182
type: Question

http://stackoverflow.com/q/22674044
upvote count: 15
favorite count: 0
has answer: http://stackoverflow.com/a/22674113
has comment: http://stackoverflow.com/comment/34541310
has body: As I know per default are controllers in Spring MVC singletons. HttpServletRequest passed offen to the controller handler method. And its ok, while HttpServletRequest is request-scoped, but I see often HttpServletRequest gets @Autowired into the controller field, like this: @Controller("CMSProductComponentController") @RequestMapping(CMSProductComponentController.CONTROLLER_PATH) public class CMSProductComponentController { @Autowired private HttpServletRequest request; } Could be this a problem? And more general question: What happens if inject a reqeust-scoped component into a singleton?
tagged with: spring
has answer: http://stackoverflow.com/a/22691328
has title: Inject HttpServletRequest into Controller
tagged with: spring-mvc
type: AnsweredQuestion
linked to: http://stackoverflow.com/q/10373617
tagged with: java
type: Question
answer count: 2
has comment: http://stackoverflow.com/comment/34541237
score: 15
possible better answer: http://stackoverflow.com/a/22691328
accepted answer: http://stackoverflow.com/a/22674113
downvote count: 0

http://stackoverflow.com/comment/34643733
score: 0
type: AnswerComment
has text: I did that and it displays the word but when i put together multiple dots and dashes, it just display the english letter for a single dot or single dash
type: Comment
comment on: http://stackoverflow.com/a/22731050

http://stackoverflow.com/q/22712961
has comment: http://stackoverflow.com/comment/35592047
type: AnsweredQuestion
possible better answer: http://stackoverflow.com/a/34688851
has answer: http://stackoverflow.com/a/34688851
tagged with: java
has comment: http://stackoverflow.com/comment/35592039
has comment: http://stackoverflow.com/comment/34615263
tagged with: quickcheck
has comment: http://stackoverflow.com/comment/34619216
type: Question
accepted answer: http://stackoverflow.com/a/23267203
upvote count: 12
tagged with: haskell
score: 12
answer count: 2
tagged with: property-based-testing
has title: What is the difference between Agitar and Quickcheck property based testing?
downvote count: 0
has body: A number of years ago a Java testing tool called Agitar was popular. It appeared to do something like property based testing. Nowadays - property based testing based on Haskell's Quickcheck is popular. There are a number of ports to Java including: quickcheck jcheck junit-quickcheck My question is: What is the difference between Agitar and Quickcheck property based testing?
has comment: http://stackoverflow.com/comment/34625143
favorite count: 0
has answer: http://stackoverflow.com/a/23267203

http://stackoverflow.com/q/22661163
has body: I am building an application which reveives message from a Message Queue , Process it and and send the generated response to another queue. I have successfully built the same. But, before sending the msg I must get the Correlation ID, Message ID and Message Type from it, So that I will be able to set these in my generated response msg as well. I have fetched CorrelationID and Message ID using the below code. Message Requestmessage = ReceiveMessage(queueName); String correlationID = Requestmessage.getJMSCorrelationID(); String messageID = Requestmessage.getJMSMessageID(); How will I get the Message Type. There are 5 types of Messages as far as I understood. 1. Text Message 2. Byte Message 3. Stream Message 4. Object Message 5. Map Message All I need is, to find out which type my "Requestmessage" belongs to. Thanks in Advance.
upvote count: 1
has title: Get the Message Type in JMS - IBM MQ
type: Question
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/34517352
score: 1
tagged with: java
accepted answer: http://stackoverflow.com/a/22861609
answer count: 1
downvote count: 0
favorite count: 0
tagged with: ibm-mq
tagged with: jms
has answer: http://stackoverflow.com/a/22861609

http://stackoverflow.com/comment/34515454
has text: You're already adding your jar to the classpath `java -cp AreYouExample.jar`. You can have multiple jars separated by `;` on windows and `:` on *nix, like `java -cp jar1;jar2;jarN com.sample.MyClass`. You can read more about it here: http://docs.oracle.com/javase/7/docs/technotes/tools/windows/classpath.html
type: Comment
score: 1
type: AnswerComment
comment on: http://stackoverflow.com/a/22659883

http://stackoverflow.com/a/48231355
downvote count: 0
type: Answer
has comment: http://stackoverflow.com/comment/99797116
score: 2
has comment: http://stackoverflow.com/comment/99768114
upvote count: 2
has body: If you need you precompile and call JavaSctipt functions with various arguments you may compile them separately and assemble execution flow in Java. With JavaScript engine Nashorn available in Java8 you can do: private static final String FUNCTIONS = "function hello( arg ) {" + //&lt;-- passing java.lang.String from Java " return 'Hello ' + arg;" + //&lt;-- returning string back "};" + "function sayTime( arg ) {" + //&lt;-- passing java.util.HashMap from Java " return 'Java time ' + arg.get( 'time' );" + //&lt;-- returning string back "};" + "function () {" + //&lt;-- this callable "function pointer" is being returned on [step1] below " return { 'hello': hello, 'sayTime': sayTime };" + "};"; public static void main(String... args) throws Exception { ScriptEngine engine = new ScriptEngineManager().getEngineByName( "Nashorn" ); CompiledScript compiled = ((Compilable) engine).compile(FUNCTIONS); ScriptObjectMirror lastFunction = (ScriptObjectMirror)compiled.eval(); // [step1] ScriptObjectMirror functionTable = (ScriptObjectMirror)lastFunction.call( null ); // this method retrieves function table String[] functionNames = functionTable.getOwnKeys( true ); System.out.println( "Function names: " + Arrays.toString( functionNames ) ); System.out.println( functionTable.callMember( "hello", "Robert" ) ); //&lt;-- calling hello() with String as argiment Map map = new HashMap(); map.put( "time", new Date().toString() ); //&lt;-- preparing hashmap System.out.println( functionTable.callMember( "sayTime", map ) ); //&lt;-- calling sayTime() with HashMap as argument } You may pass Java objects inside of JavaSctipt, see example with java.util.HashMap above. Output is: Function names: [hello, sayTime] Hello Robert Java time Fri Jan 12 12:23:15 EST 2018
answers question: http://stackoverflow.com/q/22752196

http://stackoverflow.com/comment/35505219
score: 0
comment on: http://stackoverflow.com/q/22778470
type: Comment
type: QuestionComment
has text: Found solution, actually its all correct but problem was with war building. thank you sorencito

weak-references
tags question: http://stackoverflow.com/q/22779413
type: Tag
tag name: weak-references

http://stackoverflow.com/comment/34586301
score: 0
type: Comment
comment on: http://stackoverflow.com/a/22699101
has text: Okay, I added that to my code. But now i get the error: java: no suitable method found for encode(java.lang.String) method android.util.Base64.encode(byte[],int,int,int) is not applicable (actual and formal argument lists differ in length) method android.util.Base64.encode(byte[],int) is not applicable (actual and formal argument lists differ in length) Do you know why?
type: AnswerComment

http://stackoverflow.com/q/22720675
score: 1
tagged with: java
has title: spring external properties file; file not found exception
type: Question
has comment: http://stackoverflow.com/comment/34625245
accepted answer: http://stackoverflow.com/a/22720733
has body: I am trying to read from an external properties file with the following code below. I am pretty sure I have the path set up correctly but I am still getting the file not found error. Any suggestions? Here is my code: public class Timer { @Autowired private ApplicationContext ctx; @Autowired private SpringMailSender springMailSender; @Scheduled(cron="${timer.time}") //this is the line that is having trouble public void timer() { System.out.println("timer() in Timer Class has been stepped into"); try { springMailSender.sendMail(); } catch (Exception e) { e.printStackTrace(); } System.out.println("Method executed on every 2nd Monday of each month. Current time is :: "+ new Date()); } } And here is how I have my config file set up for it... classpath:properties/system.properties file:${external.property.directory}propfilename file:${external.property.directory}propfilename With my external file path set up like this in the properties file within the web app. #directory on the server where property files will be stored external.property.directory=C\:\\propfoldername\\ And the error I'm getting is this: org.springframework.beans.factory.BeanInitializationException: Could not load properties; nested exception is java.io.FileNotFoundException: ${external.property.directory}propfilename (The system cannot find the file specified) Any help would be appreciated. Let me know if I left out some code you might need to see.
tagged with: javabeans
has comment: http://stackoverflow.com/comment/34625222
answer count: 1
downvote count: 0
tagged with: http://stackoverflow.com/tag/xml
favorite count: 0
upvote count: 1
tagged with: spring
has answer: http://stackoverflow.com/a/22720733
type: AnsweredQuestion

http://stackoverflow.com/a/22748477
score: 0
answers question: http://stackoverflow.com/q/22739655
type: Answer
has body: In case of Java there is no competition for any lock when the object is small enough to fit into the Thread Local Allocation Buffer. TLAB. This is an internal design and it has proven to work really good. From my understanding, allocating a new Object is just a pointer bump TLAB Bump The Pointer which is pretty fast.

sqlite
tags question: http://stackoverflow.com/q/22770951
tags question: http://stackoverflow.com/q/22703560
tags question: http://stackoverflow.com/q/22750831
tags question: http://stackoverflow.com/q/22737330
tags question: http://stackoverflow.com/q/22688266
tags question: http://stackoverflow.com/q/22801594
tags question: http://stackoverflow.com/q/22762138
type: Tag
tags question: http://stackoverflow.com/q/22743753
tags question: http://stackoverflow.com/q/22765805
tags question: http://stackoverflow.com/q/22744987
tags question: http://stackoverflow.com/q/22775532
tags question: http://stackoverflow.com/q/22714854
tags question: http://stackoverflow.com/q/22783805
tags question: http://stackoverflow.com/q/22762845
tags question: http://stackoverflow.com/q/22679128
tags question: http://stackoverflow.com/q/22741382
tags question: http://stackoverflow.com/q/22682078
tags question: http://stackoverflow.com/q/22779938
tags question: http://stackoverflow.com/q/22744728
tags question: http://stackoverflow.com/q/22652606
tags question: http://stackoverflow.com/q/22792734
tags question: http://stackoverflow.com/q/22766116
tags question: http://stackoverflow.com/q/22802883
tags question: http://stackoverflow.com/q/22775282
tags question: http://stackoverflow.com/q/22787121
tags question: http://stackoverflow.com/q/22793368
tags question: http://stackoverflow.com/q/22746026
tag name: sqlite

http://stackoverflow.com/comment/34560154
type: AnswerComment
comment on: http://stackoverflow.com/a/22684375
type: Comment
score: 0
has text: Yes Sir, I got the point! Thanks a lot for the timely help @Thomas

http://stackoverflow.com/comment/34647578
type: QuestionComment
has text: `#branchIdList` does not exist in your example.
score: 0
comment on: http://stackoverflow.com/q/22731159
type: Comment

http://stackoverflow.com/a/22717532
type: Answer
has body: TL;DR: You cannot delete an SVN location and assign its history to another location, even if they are named the same. What you can do is merge to the right place and preserve all original history. Now, let me get this straight: You have a trunk. You have a branch with major changes branch A. Now trunk has some minor changes. You created a new branch B off branch A? It's really not clear what you created the branch B off You merged trunk changes to branch B Now you want branch B to become your trunk (in other words, you need to merge whole branch B to trunk) Why didn't you just merge those minor changes from trunk to branch A directly, thus keeping branch in sync, and then reintegrate branch A to trunk? You are supposed to keep your feature branch in sync with trunk on daily basis, the more often the better. The only time you shouldn't be keeping a branch in sync is when this is a release branch, and you don't want new trunk changes in it. But from your question, you do want trunk changes in branch A, no? branch B seems completely redundant here. I don't know anything about Eclipse, but it is probably failing because branch B is not a direct descendant from trunk. Performing: Merge branch A to trunk nets the same effective result as performing: Create branch B off branch A Merge trunk to branch B Merge branch B back to trunk to preserve trunk history The complexity of the merge between "branch A -> trunk" is identical as the complexity of the merge between "trunk -> branch B (which is same as branch A)" Please provide your reasons for branch B existence, maybe I am completely missing some point here. What you should have done is: Check out trunk or update your existing checkout Using TortoiseSVN (because you linked that, and I don't know Eclipse), right click on trunk, select TortoiseSVN -> Merge Click, Next, supply the URL of branch A Click Show Log, select all revisions you want to merge, or you can specify a range with 12121-12777 Click Next Click Merge Resolve co…
downvote count: 0
answers question: http://stackoverflow.com/q/22714837
score: 3
upvote count: 3

http://stackoverflow.com/q/22715839
downvote count: 1
answer count: 4
has answer: http://stackoverflow.com/a/22716047
linked to: http://stackoverflow.com/q/13682838
has title: strange result in simple arithmetic using eclipse (java)
tagged with: floating-point
has comment: http://stackoverflow.com/comment/34616189
has answer: http://stackoverflow.com/a/22716993
possible better answer: http://stackoverflow.com/a/22715895
has comment: http://stackoverflow.com/comment/34616174
type: Question
has answer: http://stackoverflow.com/a/22715892
accepted answer: http://stackoverflow.com/a/22715892
type: AnsweredQuestion
tagged with: math
tagged with: java
has answer: http://stackoverflow.com/a/22715895
tagged with: eclipse
has body: When i want to calculate 0.9623 - 0.9619 it returns: 4.0000000000006697E-4 Why is that? and how can i avoid this? I tried casting to float but didn't helped. System.out.println(0.9623 - 0.9619); prints to console: 4.0000000000006697E-4
upvote count: 1
duplicate of: http://stackoverflow.com/q/13682838
favorite count: 0
score: 0

http://stackoverflow.com/comment/34707474
comment on: http://stackoverflow.com/q/22736528
score: 0
type: Comment
type: QuestionComment
has text: Adding a return didn't help. @Balder it just shows the game screen, but flashes as though it's rendering then drawing a blank screen, then rendering again every second, really fast. End game code above, no calls back to the game screen.

http://stackoverflow.com/q/22789608
has comment: http://stackoverflow.com/comment/34748628
has body: I have a json string which i want to convert to ArrayList&lt;Offer&gt; I have tried to use gson and got this error: offersList = gson.fromJson(res, ArrayList&lt;Offer&gt;); Syntax error on token "&gt;", Expression expected after this token how can i easily convert the json to such ArrayList Of custom type? update I have tried @weston answer and it worked paritally for this json, i got the foolowing array: [ { "address" : "my street 22, my city, my country", "endDateTime" : "2014-03-25T17:10:07.1466Z", "id" : "d8ffd4e6-6166-4fb5-bc88-10a7639bbdae", "latitude" : 32.457799999999999, "longitude" : 34.457799999999999, "media" : [ "0fe424fe-70cc-46fe-b" ], "recurringType" : 1, "startDateTime" : "2014-03-25T19:10:07.1466Z", "target" : 0, "title" : "some campaign title bla bla" }, { "address" : "my street 22, my city, my country", "endDateTime" : "2014-03-25T17:10:01.749Z", "id" : "a860cd99-df4d-449d-b19b-9be8e65d30b1", "latitude" : 32.457799999999999, "longitude" : 34.457799999999999, "media" : [ "e859818f-6dbc-4801-9" ], "recurringType" : 1, "startDateTime" : "2014-03-25T19:10:01.749Z", "target" : 0, "title" : "some campaign title bla bla" }, { "address" : "my street 22, my city, my country", "endDateTime" : "2014-03-25T17:09:57.0222Z", "id" : "7578c31d-477b-47c8-bf29-9f7ac39d8520", "latitude" : 32.457799999999999, "longitude" : 34.457799999999999, "media" : [ "a08bb80e-9522-4bb3-b" ], "recurringType" : 1, "startDateTime" : "2014-03-25T19:09:57.0222Z", "target" : 0, "title" : "some campaign title bla bla" }, { "address" : "my street 22, my city, my country", "endDateTime" : "2014-03-25T17:09:52.1394Z", "id" : "47471ea4-c3d5-466f-993f-050cfe6aaa0a", "latitude" : 32.457799999999999, "longitude" : 34.457799999999999, "media" : [ "ac7ad715-bbb0-4649-b" ], "recurringType" : 1, "startDateTime" : "2014-03-25T19:09:52.1394Z", "target" : 0, "title" : "some campaign title bla bla" }, { "address" : "my street 22, my city, my country", "endDateTime" : "2014-03-25T17:09:47.0226Z", "id…
type: Question
downvote count: 0
tagged with: arraylist
answer count: 3
upvote count: 1
has answer: http://stackoverflow.com/a/22789870
tagged with: android
has answer: http://stackoverflow.com/a/22793603
has title: how can i easily convert the json to such ArrayList Of custom type?
favorite count: 0
type: AnsweredQuestion
score: 1
possible better answer: http://stackoverflow.com/a/22789870
tagged with: java
tagged with: http://stackoverflow.com/tag/json
has answer: http://stackoverflow.com/a/22789699
tagged with: gson
accepted answer: http://stackoverflow.com/a/22789699

http://stackoverflow.com/q/22696902
tagged with: java
linked to: http://stackoverflow.com/q/5362874
has answer: http://stackoverflow.com/a/22700917
linked to: http://stackoverflow.com/q/409286
downvote count: 0
answer count: 1
favorite count: 0
accepted answer: http://stackoverflow.com/a/22700917
has body: I'm using Pentaho Data Integration (Table Input step) to pull in data from a MySQL server. A couple of fields are of the type 'Timestamp', and Pentaho keeps spewing out errors because of the timestamp being NULL (0000-00-00 00:00:00.000000). I added a zeroDateTimeBehavior=convertToNull to the parameters which should take care of the bad timestamps, but it's converting all of my Timestamp data to NULL. One reason why I think it may be happening is because some of my 'good' data is represented as, for example, 2013-03-14 04:55:09.000000. While most of the date is 'good data', the fractional seconds (.000000) might be being interpreted as 'bad' data by the zeroDateTimeBehavior parameter, and is thus being converted to NULL. I'm not sure if this is why it's happening, but could someone give me some insight as to other probable causes and how in the world I can stop this? Perhaps converting to a string might be a good idea, but I have no idea how to go about doing this. Suggestions?
tagged with: jdbc
has title: JDBC converting Timestamp to NULL (zeroDateTimeBehavior issue)
type: AnsweredQuestion
tagged with: mysql
upvote count: 7
type: Question
tagged with: pentaho
score: 7

http://stackoverflow.com/comment/34735991
type: Comment
score: 0
comment on: http://stackoverflow.com/a/22782638
has text: You are wrong. List<String> is changed to List not to List<Object>
type: AnswerComment

http://stackoverflow.com/a/35258075
has body: Reference taken from this article: You should take decision based on your system complexity and scalability. I suggest you to go with File System and Database Storage is not allowable, but still it is advisable. Management is always easy with database storage, but will create a performance issue in some circumstances. Management is quite complex with file system, but you will get more performance.
downvote count: 0
score: 1
accepted answer of: http://stackoverflow.com/q/22656237
answers question: http://stackoverflow.com/q/22656237
upvote count: 1
type: AcceptedAnswer
type: Answer

http://stackoverflow.com/a/22736740
accepted answer of: http://stackoverflow.com/q/22736724
upvote count: 1
type: AcceptedAnswer
answers question: http://stackoverflow.com/q/22736724
has body: because GenericClass has null values for those FIELD_1, FIELD_2, FIELD_3 public abstract class GenericClass extends JFrame { protected static String FIELD_1; protected static String FIELD_2; protected static String FIELD_3; public GenericClass() { // null +" " +null+null = `null nullnull` super(FIELD_1+" "+FIELD_2+FIELD_3); } } This was the idea: GenericClass should just DECLARE fields and subclasses should initialize them. – Danylo Esterman 41 secs ago You can't have it that way for fields, You need to overload abstract class's constructor and force subclass to pass parameters during constructor (by hiding default constructor) and then use those passed parameter for JFrame's constructor
type: Answer
downvote count: 0
has comment: http://stackoverflow.com/comment/34653542
score: 1

http://stackoverflow.com/a/22664835
has body: verify your web.xml. it says that the class was not found, because the class does not exist or the web.xml is not correct. Post your web.xml file
has comment: http://stackoverflow.com/comment/34524692
score: 0
has comment: http://stackoverflow.com/comment/34525110
type: Answer
answers question: http://stackoverflow.com/q/22664418
has comment: http://stackoverflow.com/comment/34525788
has comment: http://stackoverflow.com/comment/34524975
has comment: http://stackoverflow.com/comment/34525625
has comment: http://stackoverflow.com/comment/34525742

http://stackoverflow.com/comment/34815394
comment on: http://stackoverflow.com/q/22785942
has text: @5agado hey , i tried using the solution that you provided, but its still the same, im still getting same NullPointerException like in the question i posted.Any training method i use, i get the deprecated warning, the autosuggestion in eclipse gives three methods to train, i tried using all of them , and i get deprecated for all the three methods. please let me know if i am missing anything.
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/q/22733613
tagged with: aop
has comment: http://stackoverflow.com/comment/34879443
has comment: http://stackoverflow.com/comment/34648987
score: 0
has comment: http://stackoverflow.com/comment/34659261
has comment: http://stackoverflow.com/comment/34662386
has title: call aspect service method before Restful Api method called
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/34794763
tagged with: spring
answer count: 0
has comment: http://stackoverflow.com/comment/34659290
has body: How is it possible to make sure that aspect service method (i.e using annotation @before and expression) is called before the the rest APi method is called. for example public class Student { @GET @Produces("application/json") @Path("/{studentId}") public JSONWithPadding getStudentDetails(@QueryParam("callback") String callback, @PathParam("studentId") String studentId, @Context javax.servlet.http.HttpServletRequest request) { } } class SomethingAspect { @Before("execution(*get*())") public void doSomethingAdvice(){ System.Out.prinltln("do something"); } I want doSomethingAdvice() aspect to called before getStudentDetails() but since Student class is not getting through Spring bean how it would called the aspect.
has comment: http://stackoverflow.com/comment/34648932
type: Question
has comment: http://stackoverflow.com/comment/34879602
has comment: http://stackoverflow.com/comment/34797932
tagged with: java

http://stackoverflow.com/q/22731488
accepted answer: http://stackoverflow.com/a/22731636
upvote count: 5
answer count: 2
has comment: http://stackoverflow.com/comment/34647182
score: 5
has body: To give some background I've been learning java for about 10 months now so I am really not that experienced. I have been reading a bit recently on how how its bad practice to test private methods and variables. In the perfect world you shouldn't do this as it suggests bad design - however, I am working with a legacy framework where most methods are called via reflection and it IS bad design, but I cannot change that no matter what. Please don't reply saying "you should redesign your code" as I cannot change the way the framework works. I want to test that a 'flow' class behaves in a certain way and calls the right methods depending on the state of private variables, and I want to make sure that certain methods set private instance variables to a correct value if another private variable has a certain value. This is so when I make future changes to the class I can ensure that the flow/behavior of the class hasn't broken or changed. Now, because the flow is based largely on the state of private instance variables and because its bad to test the state of private instance variables - how else do I test the class? Ways of testing the private variables that all work: Implement default access getters and setters at the end of the code and put the junit test class in same package. Comment these clearly that they should be used for testing only. Make instance variables default access instead of private and put junit test class in same package. No other classes in the same package will instantiate this class anyway. Test the private variables via reflection - I lose IDE functionality here as Eclipse won't refactor if I change the name of variables and could be a future pain of manually changing Strings to match variable names in the class to be tested. Which of the three above is the "lesser" evil to use? Is it better to test private variables then have no tests at all?
tagged with: mockito
tagged with: junit
downvote count: 0
favorite count: 0
has title: Testing private variables - always bad practice?
has answer: http://stackoverflow.com/a/22731636
tagged with: private-members
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/34644604
possible better answer: http://stackoverflow.com/a/22731695
tagged with: java
has answer: http://stackoverflow.com/a/22731695
tagged with: unit-testing
type: Question

http://stackoverflow.com/q/22721529
has comment: http://stackoverflow.com/comment/34627525
tagged with: arrays
possible better answer: http://stackoverflow.com/a/22721572
has answer: http://stackoverflow.com/a/22721566
has answer: http://stackoverflow.com/a/22721572
has answer: http://stackoverflow.com/a/22721600
accepted answer: http://stackoverflow.com/a/22721564
answer count: 4
score: -6
favorite count: 0
tagged with: constructor
has body: If I was to make a simple class in Java with only an array of integers for an instance variable, then what would make sense for a default constructor? I don't want to leave it empty.
downvote count: 6
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/34626882
has title: Array Default Constructor
tagged with: default-constructor
tagged with: java
has answer: http://stackoverflow.com/a/22721564
has comment: http://stackoverflow.com/comment/34626847
type: Question
upvote count: 0

http://stackoverflow.com/a/22789500
upvote count: 1
has comment: http://stackoverflow.com/comment/34751181
downvote count: 0
score: 1
answers question: http://stackoverflow.com/q/22789218
has body: In HQL and JPQL, if you want to refer to entity properties after the FROM clause, you need to assign aliases; so your query would be: from Page p join Tag t on p.id = t.pageId where t.tag = 'sport' there is also an alternative implicit join syntax: from Page p where p.tag.tag = 'sport' To be fully compliant with JPQL, you would also specify the select clause: select p from Page p where p.tag.tag = 'sport'
type: Answer
has comment: http://stackoverflow.com/comment/34751275
has comment: http://stackoverflow.com/comment/34759002

http://stackoverflow.com/q/22680210
has comment: http://stackoverflow.com/comment/34551619
linked to: http://stackoverflow.com/q/1956376
downvote count: 1
type: AnsweredQuestion
tagged with: stringbuilder
possible better answer: http://stackoverflow.com/a/22680278
score: 1
tagged with: java
has answer: http://stackoverflow.com/a/22680404
accepted answer: http://stackoverflow.com/a/22680235
has answer: http://stackoverflow.com/a/22680810
type: Question
tagged with: string
has answer: http://stackoverflow.com/a/22680235
upvote count: 2
has comment: http://stackoverflow.com/comment/34598209
has answer: http://stackoverflow.com/a/22680278
has body: I am confuse about String and String Builder. Here is my simple code StringBuilder sb1 = new StringBuilder("123"); String s1 = "123"; sb1.append("abc"); s1.concat("abc"); System.out.println(sb1 + " " + s1); sb1 output for 123abc. It is ok! because it use append method.But String s1 should be abc123 but it output is abc. Why? And what is concat method purpose? Please explain me. Thank you
has title: java String and StringBuilder
duplicate of: http://stackoverflow.com/q/1956376
answer count: 4
favorite count: 0

http://stackoverflow.com/comment/34683873
type: QuestionComment
comment on: http://stackoverflow.com/q/22753326
score: 0
has text: Instead of deleting your post, answer it yourself. There's no penalty for that, as long as you are explicit in your answer.
type: Comment

http://stackoverflow.com/a/22802137
has body: You are not sending a parameter named name in the request.That's why! To confirm, try &lt;% String name = request.getParameter("1"); out.write(name); %&gt; Your form should be like below. See the value of name attribute of the input text. The name attribute denotes the name of the request parameter &lt;form action="viewParticularImage.jsp" method="post"&gt; First name: &lt;input type="text" name="name"&gt;&lt;br&gt; &lt;input type="submit" value="Submit"&gt; &lt;/form&gt; Note : Try entering a value in the text and submit. You will receive it in the server request
score: 0
type: Answer
answers question: http://stackoverflow.com/q/22802121

http://stackoverflow.com/comment/34580046
comment on: http://stackoverflow.com/a/22695209
type: AnswerComment
type: Comment
has text: @YahyaUddin what JDK are you using? OpenJDK? Another one? How did you install it?
score: 1

http://stackoverflow.com/comment/34522664
type: Comment
has text: The JIT in server mode, kicks in after 10k executions. And then it takes some time to compile the code and swap it.
type: AnswerComment
score: 0
comment on: http://stackoverflow.com/a/22659950

http://stackoverflow.com/a/77616289
downvote count: 1
has body: I use @apiNote as well as @implNote. I use @apiNote for info that the developer writing consuming code must know and conform to. For example, if the app must be in a particular state before calling the method I might say: Must call init() before calling this method. I use @implNote to describe to the maintainer of the method as to why the method is implemented the way it is. A consumer need not know how it's implemented, but the maintainer may need this info to make future changes and fixes. For example: Uses bubble sort. Sadly, I often want to document info that fits neither of these two categories. I default to @implNote for such info.
answers question: http://stackoverflow.com/q/22673421
type: Answer
score: 2
has comment: http://stackoverflow.com/comment/137415267
upvote count: 3
has comment: http://stackoverflow.com/comment/139538305

http://stackoverflow.com/comment/34500913
type: AnswerComment
has text: I'll give this a shot and let you know if it works tommorow, thanks for the suggestion
type: Comment
comment on: http://stackoverflow.com/a/22651391
score: 0

binary-search-tree
tags question: http://stackoverflow.com/q/22750986
tags question: http://stackoverflow.com/q/22791509
tags question: http://stackoverflow.com/q/22699798
tags question: http://stackoverflow.com/q/22736890
type: Tag
tags question: http://stackoverflow.com/q/22740219
tags question: http://stackoverflow.com/q/22720605
tags question: http://stackoverflow.com/q/22669671
tag name: binary-search-tree
tags question: http://stackoverflow.com/q/22750289

http://stackoverflow.com/comment/34762913
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/22796902
has text: Here is the documentation http://books.google.com/books?id=Wp9Xrm1ujncC&pg=PA352&lpg=PA352&dq

http://stackoverflow.com/comment/34617690
score: 0
type: Comment
type: AnswerComment
comment on: http://stackoverflow.com/a/22714645
has text: now I get `E/AndroidRuntime(16680): java.lang.RuntimeException: Unable to start service com.test.leapservice.LeapService@41ef0dd8 with Intent { cmp=com.test.leapservice/.LeapService }: android.os.NetworkOnMainThreadException` do you think the socket connection and sendbroadcast call its ok?

http://stackoverflow.com/comment/34621793
type: Comment
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/22718383
has text: Thanks. In what method would you recommend putting this? As you mentioned, oncreate or oncreateview is too early, and I've found onResume is too early as well. IS there some sort of "view is loaded" callback?

http://stackoverflow.com/comment/34543793
comment on: http://stackoverflow.com/a/22674770
score: 0
type: AnswerComment
has text: Gives errors, i will update code to show new version
type: Comment

http://stackoverflow.com/a/38962258
has body: Even after applying above defined project specific settings on IntelliJ as well as Eclipse, it was still failing for me ! what worked for me was addition of maven plugin with source and target with 1.8 setting in POM XML: org.apache.maven.plugins maven-compiler-plugin 2.0.2 1.8 1.8 org.apache.maven.plugins maven-jar-plugin true lib/ com.abc.sparkcore.JavaWordCount org.apache.maven.plugins maven-dependency-plugin copy install copy-dependencies ${project.build.directory}/lib
type: Answer
upvote count: 1
downvote count: 1
score: 0
answers question: http://stackoverflow.com/q/22703412

http://stackoverflow.com/q/22666737
type: AnsweredQuestion
score: 1
tagged with: java
upvote count: 1
has answer: http://stackoverflow.com/a/22670717
type: Question
tagged with: thrift
accepted answer: http://stackoverflow.com/a/22670717
answer count: 1
downvote count: 0
has title: Thrift: using an external java class in list definition
favorite count: 0
has body: I'm newbie to Thrift and would greatly appreciate some help in writing the Thrift generator file. I want to use a Java server with many clients in various languages. I'm using Thrift to autogenerate these files. Here's my Thrift file: namespace php example namespace py example namespace csharp example namespace cpp example namespace perl example namespace d example namespace java javaobjectmethods struct ExternalLibraryItem { 1: required string name } service ExampleService { list&lt;ExternalLibraryItem&gt; javaObjectMethod(1:i32 count) } I have a separate set of Java files that is in the package javaObject and javaObjectMethod is one of the methods in the package. However, this method returns an object that is instantiated by an external library. How do I write this in the Thrift file without the: struct ExternalLibraryItem { 1: required string name } It currently won't let my generate the server files without this line. Here's my Java file: package javaobjectmethods; import externalLibrary.ExternalLibaryItem; import externalLibrary.ExternalLibraryClass; public class javaObject { private String file; public javaObject(String file) { this.file = file; } public List&lt;ExternalLibraryItem&gt; javaObjectMethod(int count) { // this method returns List&lt;ExternalLibraryItem&gt; return ExternalLibraryClass.doThis(count, this.file); } }
tagged with: thrift-protocol

http://stackoverflow.com/q/22763021
has comment: http://stackoverflow.com/comment/34701774
has title: Comparisions using ternary operator vs if else vs switch case (Performance)
tagged with: if-statement
answer count: 1
tagged with: ternary-operator
favorite count: 0
upvote count: 5
linked to: http://stackoverflow.com/q/4192225
linked to: http://stackoverflow.com/q/6705955
type: AnsweredQuestion
has body: I was searching for if-else vs ternary operator vs switch case but could not find any post with all the three comparisons. However, I came across some good posts and found that switch-case is faster than if-else. You may check the below one: Why switch is faster than if Then I came across some posts which said that there is no performance difference between if-else and the ternary operator. One of the most relevant posts is the following: ternary operator vs. if statement: question of prettiness? However, I did not find any relevant posts for switch-case vs ternary operator. So, I just want to know if I can conclude that switch case is faster than both ternary operator and if-else? I know this is a silly question but I want to know the answer.
tagged with: performance
accepted answer: http://stackoverflow.com/a/22763083
downvote count: 0
tagged with: java
tagged with: switch-statement
type: Question
has comment: http://stackoverflow.com/comment/34739883
score: 5
has answer: http://stackoverflow.com/a/22763083

http://stackoverflow.com/comment/89687311
has text: This is not a case of unacknowledged messages but care of messages falsely acknowledged. Client acknowledges 5th message but 1-4 gets acked as well as per the spec but processing of these 4 could be in partial state.
type: Comment
comment on: http://stackoverflow.com/a/22695968
score: 0
type: AnswerComment

http://stackoverflow.com/comment/34523257
has text: @DaveNewton `Build Automatically` is checked.
score: 0
comment on: http://stackoverflow.com/q/22664342
type: Comment
type: QuestionComment

http://stackoverflow.com/q/22703111
favorite count: 0
has body: I am working in a GWT-Struts-Hibernate project. Whenever I changed any GWT code, it will reflect in Dev mode. But Whenever I changed any Struts or Hibernate related code, I need to stop the server and export the war to Jboss and then start the server. This eats lots of my working time. Is there any alternative process for this? We are using Jboss 4.2.3.GA server.
type: UnansweredQuestion
upvote count: 1
type: Question
tagged with: gwt
score: 1
tagged with: java
tagged with: hibernate
tagged with: jboss
tagged with: struts
has title: For every code change need to export the war and restart the server
answer count: 1
downvote count: 0
has answer: http://stackoverflow.com/a/22703344
has comment: http://stackoverflow.com/comment/34593745
has comment: http://stackoverflow.com/comment/34593675

http://stackoverflow.com/q/22727303
tagged with: string
favorite count: 0
has body: I have a json as csv file column value. I am using csv reader for processing the file. The problem is while parsing this particular string "status": false, "name": "\"funaction(Group, ind and six)", "id": "groupindsix" As there is a \" , the csv reader escapes the second line as "name": "funaction(Group, ind and six) Hence the comma which is supposed to be inside the double quote separates into a different column with "ind and six" in separate column. I need a way to replace the \" only in the string. I tried replace("\\\","") but no use. Kindly help me out.
has title: Replace \" in a csv column java
tagged with: http://stackoverflow.com/tag/csv
has answer: http://stackoverflow.com/a/22727417
type: UnansweredQuestion
downvote count: 1
tagged with: java
score: -1
tagged with: replace
type: Question
upvote count: 0
answer count: 1

http://stackoverflow.com/a/22739560
score: 4
type: AcceptedAnswer
type: Answer
upvote count: 4
answers question: http://stackoverflow.com/q/22739507
downvote count: 0
has comment: http://stackoverflow.com/comment/34658788
accepted answer of: http://stackoverflow.com/q/22739507
has body: The distinction is that the contents backing an Iterator don't necessarily have to be in memory. The contents of a List generally are, but you could write an Iterator&lt;Integer&gt; that read a file on disk and returned the values in order.
has comment: http://stackoverflow.com/comment/34658696

http://stackoverflow.com/comment/34533166
has text: Does it enter the loop at all? Does an Exception short-circuit your code?
score: 3
comment on: http://stackoverflow.com/q/22669646
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/34644010
comment on: http://stackoverflow.com/q/22731018
type: QuestionComment
has text: I guess inside the display() method
score: 0
type: Comment

http://stackoverflow.com/comment/34683301
comment on: http://stackoverflow.com/q/22753171
type: Comment
type: QuestionComment
score: 2
has text: Do u want the thoughts about what error are u getting? Better post the error message and then seek thoughts about why/

http://stackoverflow.com/comment/34698422
type: QuestionComment
comment on: http://stackoverflow.com/q/22761344
type: Comment
has text: @AndreyAdamovich : I mean to say that I do not want my program to come back to main class. Just treat everything (after completion of main class) as a Junit class.
score: 0

http://stackoverflow.com/q/22799968
type: Question
answer count: 2
has answer: http://stackoverflow.com/a/22800101
has answer: http://stackoverflow.com/a/22800537
has comment: http://stackoverflow.com/comment/34767796
possible better answer: http://stackoverflow.com/a/22800537
has title: Where to place DeleteNode in Java Node class?
score: 0
accepted answer: http://stackoverflow.com/a/22800101
type: AnsweredQuestion
tagged with: linked-list
has body: I have the following Node class used to implement linked list: class Node { Node next = null; int data; public Node (int d) { data = d; } void AppendToTail (int d) { Node end = new Node(d); Node current = this; while (current.next != null) { current = current.next; } current.next = end; } } And I want to create a method that given a Node, it will delete it from a Linked list. So, I know how to create a function like this. But I am unsure how would I make it fit in my class. Node deleteNode(Node head, Node toDelete) { Node n = head; if (n.data == toDelete.data) { return head.next; } while (n.next != null) { if (n.next.data == toDelete.data) { n.next = n.next.next; return head; } n = n.next; } return head; } However, I am failing to see how would I put that into my Node class. Any suggestions?
tagged with: java
has comment: http://stackoverflow.com/comment/34767778

http://stackoverflow.com/q/22706068
score: 0
accepted answer: http://stackoverflow.com/a/22706120
has body: I have a string containing some HTML content. I want to replace all the HTML tags and the content within them using Regex in java. So for example &lt;a&gt;,&lt;a href=""/&gt;,&lt;/a&gt; etc. should be removed. I tried str=str.replaceAll("&lt;\\w*&gt;",""); but it replaces only the first occurrence from the string. How can I replace all the occurrences of this kind from the string. Thanks
answer count: 1
has comment: http://stackoverflow.com/comment/34598738
has title: Regex replace all in java
tagged with: regex
type: AnsweredQuestion
tagged with: java
has answer: http://stackoverflow.com/a/22706120
type: Question
linked to: http://stackoverflow.com/q/832620

http://stackoverflow.com/q/22671927
accepted answer: http://stackoverflow.com/a/22673447
upvote count: 3
has answer: http://stackoverflow.com/a/41576491
tagged with: gradle
type: Question
score: 3
tagged with: java
has body: I have a socket server application. This application shutdown server and unbinding from port inside of standard Java shutdown hook when process is stopping : Runtime.getRuntime().addShutdownHook(new ShutdownHook()); I use application gradle plugin to run it from command line: apply plugin: 'application' mainClassName = "com.ServerLauncher" But when I run application from gradle: ./gradlew :server:run And then close application with ctrl+z my shutdown hook doesn't trigger. I guess it's because gradle starts it's own process which starts java process, but it looks like java process doesn't receive shutdown signal.
has answer: http://stackoverflow.com/a/22680766
answer count: 3
has title: Shutdown hook of Java process doesn't trigger in gradle daemon
downvote count: 0
favorite count: 0
possible better answer: http://stackoverflow.com/a/41576491
has comment: http://stackoverflow.com/comment/34538877
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/22673447

exception
tags question: http://stackoverflow.com/q/22796385
tags question: http://stackoverflow.com/q/22762372
tags question: http://stackoverflow.com/q/22793368
tags question: http://stackoverflow.com/q/22698584
tags question: http://stackoverflow.com/q/22792449
tags question: http://stackoverflow.com/q/22669508
tags question: http://stackoverflow.com/q/22751888
tags question: http://stackoverflow.com/q/22695572
tags question: http://stackoverflow.com/q/22679154
tags question: http://stackoverflow.com/q/22760291
tags question: http://stackoverflow.com/q/22700786
tags question: http://stackoverflow.com/q/22654031
tags question: http://stackoverflow.com/q/22756144
type: Tag
tags question: http://stackoverflow.com/q/22765805
tags question: http://stackoverflow.com/q/22659056
tags question: http://stackoverflow.com/q/22795669
tags question: http://stackoverflow.com/q/22709774
tags question: http://stackoverflow.com/q/22724675
tags question: http://stackoverflow.com/q/22728527
tags question: http://stackoverflow.com/q/22791828
tags question: http://stackoverflow.com/q/22693299
tags question: http://stackoverflow.com/q/22664418
tags question: http://stackoverflow.com/q/22737415
tag name: exception
tags question: http://stackoverflow.com/q/22773809
tags question: http://stackoverflow.com/q/22664788
tags question: http://stackoverflow.com/q/22746531
tags question: http://stackoverflow.com/q/22724282
tags question: http://stackoverflow.com/q/22693333
tags question: http://stackoverflow.com/q/22667659
tags question: http://stackoverflow.com/q/22655826
tags question: http://stackoverflow.com/q/22806781
tags question: http://stackoverflow.com/q/22719327
tags question: http://stackoverflow.com/q/22660033

http://stackoverflow.com/q/22721181
favorite count: 0
tagged with: ssh
has answer: http://stackoverflow.com/a/22727996
score: 2
upvote count: 2
possible better answer: http://stackoverflow.com/a/22727937
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/22727937
accepted answer: http://stackoverflow.com/a/22727996
tagged with: java
has title: delete remote directory using apache camel
has body: I came across Apache Camel today as I was thinking about implementing some basic Java routines for copying a directory to a remote server, and then running an MPI job, then on completion of the MPI job, deleting that directory. However, it seems more difficult than I thought - I spent the whole afternoon today simply trying to copy a directory to a remote machine via sftp (I still can't get it to copy a single file). Basically, I'm wondering if Apache Camel is really the best java library/solution I should be using for my problem (as stated in my first sentence). I envisage mostly sftp/ssh communications (and on windows - through usual file sharing in an internal network), but may change this according to requirements. Perhaps Apache Camel doesn't fit my requirements, or is using a sledgehammer to crack a nut? I would be grateful for any comments - unfortunately my networking knowledge is pretty limited outside basic usage. Thanks!
tagged with: apache-camel
type: Question
answer count: 2
downvote count: 0

http://stackoverflow.com/comment/34616855
type: QuestionComment
type: Comment
has text: possible duplicate of [Could not resolve Spring property placeholder](http://stackoverflow.com/questions/4779572/could-not-resolve-spring-property-placeholder)
score: 0
comment on: http://stackoverflow.com/q/22716119

http://stackoverflow.com/comment/34705236
type: Comment
has text: possible duplicate of [How do I compare strings in Java?](http://stackoverflow.com/questions/513832/how-do-i-compare-strings-in-java)
comment on: http://stackoverflow.com/q/22765218
score: 0
type: QuestionComment

jdbc
tags question: http://stackoverflow.com/q/22696902
tags question: http://stackoverflow.com/q/22763813
tags question: http://stackoverflow.com/q/22728343
tags question: http://stackoverflow.com/q/22765655
tags question: http://stackoverflow.com/q/22775408
tags question: http://stackoverflow.com/q/22657468
tags question: http://stackoverflow.com/q/22751071
tags question: http://stackoverflow.com/q/22670189
tags question: http://stackoverflow.com/q/22727951
tags question: http://stackoverflow.com/q/22741348
tags question: http://stackoverflow.com/q/22768632
tags question: http://stackoverflow.com/q/22651670
tags question: http://stackoverflow.com/q/22659506
tags question: http://stackoverflow.com/q/22666671
tags question: http://stackoverflow.com/q/22663816
tags question: http://stackoverflow.com/q/22714738
tags question: http://stackoverflow.com/q/22803409
tags question: http://stackoverflow.com/q/22787412
tags question: http://stackoverflow.com/q/22760643
tags question: http://stackoverflow.com/q/22728985
tags question: http://stackoverflow.com/q/22745706
tags question: http://stackoverflow.com/q/22779917
type: Tag
tags question: http://stackoverflow.com/q/22741898
tags question: http://stackoverflow.com/q/22797377
tags question: http://stackoverflow.com/q/22648797
tags question: http://stackoverflow.com/q/22775838
tags question: http://stackoverflow.com/q/22732530
tags question: http://stackoverflow.com/q/22755795
tags question: http://stackoverflow.com/q/22725395
tags question: http://stackoverflow.com/q/22709813
tags question: http://stackoverflow.com/q/22711290
tags question: http://stackoverflow.com/q/22687280
tags question: http://stackoverflow.com/q/22649228
tags question: http://stackoverflow.com/q/22672580
tags question: http://stackoverflow.com/q/22693653
tags question: http://stackoverflow.com/q/22665948
tags question: http://stackoverflow.com/q/22785838
tags question: http://stackoverflow.com/q/22657968
tags question: http://stackoverflow.com/q/22694486
tags question: http://stackoverflow.com/q/22808384
tags question: http://stackoverflow.com/q/22744591
tags question: http://stackoverflow.com/q/22769670
tags question: http://stackoverflow.com/q/22689012
tags question: http://stackoverflow.com/q/22761210
tags question: http://stackoverflow.com/q/22695281
tag name: jdbc
tags question: http://stackoverflow.com/q/22743497
tags question: http://stackoverflow.com/q/22685382
tags question: http://stackoverflow.com/q/22776564
tags question: http://stackoverflow.com/q/22766133
tags question: http://stackoverflow.com/q/22741446
tags question: http://stackoverflow.com/q/22665365

http://stackoverflow.com/q/22753918
type: Question
tagged with: arrays
score: -1
answer count: 2
upvote count: 0
has answer: http://stackoverflow.com/a/22754573
favorite count: 0
has body: I am trying to get getIntArrayString to accept parameters given to it, unlike abc.getAverage which uses the field testArray. edit: Forgot to ask the question. how would I be able to send parameters such as test1 to getIntArrayString()? private int testArray; public static void main(String[] args) { int[] testArray = new int[]{2,4,6,8,9}; ArrayHW abc = new ArrayHW(testArray); System.out.printf(abc.getAverage()); int[] test1= new int[]{3,4,5,6,7}; System.out.printf("Array Values: %s\n",ahw.getIntArrayString()); int[] test1= new int[]{3,4,5,6,7} System.out.printf("Array Values: %s\n",ahw.getIntArrayString()); }
type: UnansweredQuestion
tagged with: parameters
has answer: http://stackoverflow.com/a/22754340
tagged with: java
has title: Accepting any array as a parameter
has comment: http://stackoverflow.com/comment/34684642
downvote count: 1

http://stackoverflow.com/q/22775802
duplicate of: http://stackoverflow.com/q/624581
favorite count: 0
score: -3
has answer: http://stackoverflow.com/a/22776011
type: Question
type: AnsweredQuestion
tagged with: java
has title: Simple Email Validation for Java Program
downvote count: 3
has body: I was looking for a very simple email validation. It just have to have an @ symbol and a period in the email. I want to accept for my string that will come in as a parameter. Does anyone know of any easy email validations?
upvote count: 0
answer count: 1
linked to: http://stackoverflow.com/q/624581
accepted answer: http://stackoverflow.com/a/22776011

http://stackoverflow.com/q/22807120
tagged with: java
has title: C# deserialization from Java(android) header
accepted answer: http://stackoverflow.com/a/23007833
score: 0
answer count: 1
tagged with: deserialization
has body: I am working on some android project, so i need to send hashtags to the server by Header info. So this is the server code they have for getting the hashtags. if (Request.Headers.Contains("hashtags")) newPost.HashTags = new System.Web.Script.Serialization.JavaScriptSerializer() .Deserialize&lt;List&lt;string&gt;&gt; (Request.Headers.GetValues("hashtags").First()); and i really don't know how to send ArrayList in java side to a single parametar by Headers parametar. conn.setRequestProperty("hashtags", ""); I guess i need to serialize somehow the list and send it as string? Please if anyone knows anything share with me, i really appreciate it!
tagged with: android
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/23007833
type: Question
tagged with: c#

http://stackoverflow.com/comment/34785793
type: AnswerComment
comment on: http://stackoverflow.com/a/22805326
type: Comment
has text: I have 2 answers, one saying I can, one saying I can't. I know both work, but is this one more correct or equivalent?
score: 0

ajax
tags question: http://stackoverflow.com/q/22761980
tags question: http://stackoverflow.com/q/22661232
tags question: http://stackoverflow.com/q/22691732
type: Tag
tags question: http://stackoverflow.com/q/22764756
tags question: http://stackoverflow.com/q/22651549
tags question: http://stackoverflow.com/q/22727799
tags question: http://stackoverflow.com/q/22698737
tags question: http://stackoverflow.com/q/22724165
tags question: http://stackoverflow.com/q/22664634
tags question: http://stackoverflow.com/q/22654566
tags question: http://stackoverflow.com/q/22666419
tags question: http://stackoverflow.com/q/22703192
tags question: http://stackoverflow.com/q/22733176
tags question: http://stackoverflow.com/q/22740572
tags question: http://stackoverflow.com/q/22710557
tags question: http://stackoverflow.com/q/22789604
tags question: http://stackoverflow.com/q/22693020
tags question: http://stackoverflow.com/q/22690036
tags question: http://stackoverflow.com/q/22769703
tag name: ajax

onclick
tags question: http://stackoverflow.com/q/22737853
tags question: http://stackoverflow.com/q/22723610
tags question: http://stackoverflow.com/q/22759404
type: Tag
tag name: onclick
tags question: http://stackoverflow.com/q/22677169

http://stackoverflow.com/q/22713938
answer count: 1
favorite count: 0
tagged with: rest
upvote count: 2
tagged with: php
tagged with: curl
has title: Convert java rest request to php code
type: AnsweredQuestion
score: 2
tagged with: java
has answer: http://stackoverflow.com/a/22713967
has body: How can I convert this java code to php. server = new URL(url); HttpURLConnection urlConnection = (HttpURLConnection) server.openConnection() ; urlConnection.setRequestMethod( method ); urlConnection.setDoInput(true); urlConnection.setDoOutput(true); urlConnection.setRequestProperty("Content-Type",mimeType ); if( requestParameter != null) { CyberoamLogger.appLog.debug(MODULE+":"+METHOD+"Request parameter: "+requestParameter.toString()); out = new BufferedWriter( new OutputStreamWriter( urlConnection.getOutputStream() ) ); out.write(requestParameter.toString()); out.flush(); out.close() ; } urlConnection.connect(); strbuf = new StringBuffer(); is= urlConnection.getInputStream() ; byte[] buffer = new byte[1024 * 4]; int n = 0; while (-1 != (n = is.read(buffer))) strbuf.append(new String(buffer, 0, n)); is.close(); strResponse=strbuf.toString(); CyberoamLogger.appLog.debug(MODULE+METHOD+ " WS Responce in String : "+strResponse); urlConnection.disconnect(); When I try following php code I get The server refused this request because the request entity is in a format not supported by the requested resource for the requested method (). error $curl = curl_init(); curl_setopt($curl, CURLOPT_POSTFIELDS, $data); curl_setopt($curl, CURLOPT_URL, $url); echo curl_exec($curl);
type: Question
downvote count: 0
accepted answer: http://stackoverflow.com/a/22713967

http://stackoverflow.com/q/22696124
score: 1
tagged with: java
has answer: http://stackoverflow.com/a/22696302
accepted answer: http://stackoverflow.com/a/22696302
upvote count: 1
type: Question
tagged with: date
has answer: http://stackoverflow.com/a/22697687
possible better answer: http://stackoverflow.com/a/22696262
downvote count: 0
favorite count: 0
has body: I have some time Strings such as "09:00" and "17:30" and I need to check if the current time is between that range. I thought I could make this comparison: SimpleDateFormat format = new SimpleDateFormat("HH:mm"); Date now = new Date(); Date begin; Date end; begin = format.parse(begin_string); end = format.parse(end_string); if (now.compareTo(begin) &gt; 0 &amp;&amp; end.compareTo(now) &gt; 0) return true; else return false; Turns out that when I parse the strings, the times are parsed correctly, but the date is set to Jan 1st 1970. This way, the code will always return false. I'd like to know how can I set begin and end to the current date, but with the times from their strings.
tagged with: android
tagged with: datetime
has answer: http://stackoverflow.com/a/22696262
answer count: 4
has title: Get current Date with custom time
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/22696269

http://stackoverflow.com/q/22781940
has body: I am learning threading in java. As per the description of finally block in an Oracle tutorial: Note: If the JVM exits while the try or catch code is being executed, then the finally block may not execute. Likewise, if the thread executing the try or catch code is interrupted or killed, the finally block may not execute even though the application as a whole continues. So I tried to interrupt a thread in try catch block and check whether finally is executed in following class. But as per the output of the program, finally block is executed. Can someone explain what happened? package com.lock; import java.util.concurrent.locks.Lock; import java.util.concurrent.locks.ReentrantLock; public class TestLock{ public static void main(String[] args) throws InterruptedException { MyThread lockT= new MyThread(); Thread t= new Thread(lockT); t.setName("TempThread1"); t.start(); Thread.sleep(1000); t.interrupt(); } } class MyThread implements Runnable { Lock lock; public MyThread() { lock= new ReentrantLock(); } @Override public void run() { try { if(lock.tryLock()){ Thread.sleep(5000); while (!Thread.currentThread().isInterrupted()) { System.out.println("My thread name is "+ Thread.currentThread().getName()); } } } catch (Exception e) { e.printStackTrace(); }finally{ System.out.println("finally "); lock.unlock(); } } }
tagged with: multithreading
type: Question
has title: Behavior of finally block if thread interrupted
possible better answer: http://stackoverflow.com/a/44608958
accepted answer: http://stackoverflow.com/a/22782021
has answer: http://stackoverflow.com/a/22782093
upvote count: 2
downvote count: 0
has answer: http://stackoverflow.com/a/22782021
favorite count: 0
has answer: http://stackoverflow.com/a/44608958
answer count: 4
score: 2
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/22782029
tagged with: java

http://stackoverflow.com/comment/34596191
type: AnswerComment
comment on: http://stackoverflow.com/a/22704133
type: Comment
has text: So looking over it basically whit the add, It is forcing the element to be set to 0 and then adding 1 to it. So after running it say 4 times, how does it increment to 4?
score: 0

firefox
tags question: http://stackoverflow.com/q/22711441
tags question: http://stackoverflow.com/q/22779522
tag name: firefox
tags question: http://stackoverflow.com/q/22727620
type: Tag
tags question: http://stackoverflow.com/q/22804795
tags question: http://stackoverflow.com/q/22666480

http://stackoverflow.com/a/22718222
upvote count: 2
type: Answer
score: 2
accepted answer of: http://stackoverflow.com/q/22718096
has comment: http://stackoverflow.com/comment/35299634
has body: why am i getting a "" in the 0th index of the str2 array? Because the delimiter you use has matched here: aaaabbddaabbcc ^ Since .split() collects the parts is has "walked by" when it progresses into the string, here it collects the empty string. Note also that since the delimiter is empty, in order to avoid infinite loops, at the next iteration, .split() will forward one character before starting to search again.
has comment: http://stackoverflow.com/comment/34620742
answers question: http://stackoverflow.com/q/22718096
has comment: http://stackoverflow.com/comment/34621466
has comment: http://stackoverflow.com/comment/34620624
has comment: http://stackoverflow.com/comment/34621049
has comment: http://stackoverflow.com/comment/34620893
has comment: http://stackoverflow.com/comment/34620675
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/34621191

http://stackoverflow.com/comment/34666981
type: AnswerComment
score: 0
type: Comment
comment on: http://stackoverflow.com/a/22721650
has text: It seems that your first problem "file not found" has been solved, so this question should be closed (and mark my answer as accepted unless you don't like it). The new error "cannot find symbol" is another different problem. If you post another question about "cannot find symbol", people will help you.

http://stackoverflow.com/q/22744278
tagged with: image
score: 0
has answer: http://stackoverflow.com/a/22744907
answer count: 1
has comment: http://stackoverflow.com/comment/34668720
has title: Saving a picture into a variable
type: UnansweredQuestion
has body: I'm wanting to upload a picture and save it under a variable named contactPicture. I have tried looking online but can't find much, and what I have found seems to give errors. This is what i have so far. Bitmap contactPicture = null; (Error 1) JButton pictureanswer = new JButton("Browse"); pictureanswer.setForeground(Color.black); c.gridwidth = 1; c.gridx = 1; c.gridy = 9; addPanel.add(pictureanswer,c); pictureanswer.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { JFileChooser chooser = new JFileChooser(); FileNameExtensionFilter filter = new FileNameExtensionFilter("JPG &amp; GIF Images", "jpg", "gif"); chooser.setFileFilter(filter); int returnVal = chooser.showOpenDialog(null); File pictureDirectory = chooser.getSelectedFile(); contactPicture = BitmapFactory.decodeFile(pictureDirectory); (Error 2) } }); To explain whats happening here, I create a button "Browse". This then, when clicked, opens up the browse window to search for images. It saves this file directory under the variable, pictureDirectory. This is the bit giving errors. I found that the final line of code should save the picture. However its giving errors. Error 1: Bitmap cannot be reserved to a type. Error 2: BitmapFactory cannot be reserved and error 1 again. Please explain what Im doing wrong, all help appreciated! :)
has comment: http://stackoverflow.com/comment/34667857
has comment: http://stackoverflow.com/comment/34667787
has comment: http://stackoverflow.com/comment/34667495
tagged with: bitmap
type: Question
has comment: http://stackoverflow.com/comment/34668474
tagged with: java

http://stackoverflow.com/q/22675839
answer count: 0
has comment: http://stackoverflow.com/comment/34544310
has comment: http://stackoverflow.com/comment/34544426
tagged with: mysql
has comment: http://stackoverflow.com/comment/34544710
has comment: http://stackoverflow.com/comment/34544571
linked to: http://stackoverflow.com/q/5808160
type: Question
tagged with: java
tagged with: database
score: 0
tagged with: local
has body: I am using xampp Control Panel v3.1.0 , I have imported a database to myphpadmin and i am trying to connect to my local database sam but i am not sure why i keep getting the following errors: java.lang.ClassNotFoundException: org.gjt.mm.mysql.Driver at java.net.URLClassLoader$1.run(Unknown Source) at java.net.URLClassLoader$1.run(Unknown Source) at java.security.AccessController.doPrivileged(Native Method) at java.net.URLClassLoader.findClass(Unknown Source) at java.lang.ClassLoader.loadClass(Unknown Source) at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source) at java.lang.ClassLoader.loadClass(Unknown Source) at java.lang.Class.forName0(Native Method) at java.lang.Class.forName(Unknown Source) at system.DBConnector.connect(DBConnector.java:28) public class DBConnector { public static final String URL = "jdbc:mysql://localhost:3306/"; public static final String DATABASE = "sam"; public static final String DRIVER = "org.gjt.mm.mysql.Driver"; public static final String USERNAME = ""; public static final String PASSWORD = ""; private static Connection connection = null; private static Statement statement = null; private static PreparedStatement preparedStatement = null; private static ResultSet resultSet = null; /** Open database connection to a specified database */ protected void connect() { try { Class.forName(DRIVER).newInstance(); connection = DriverManager.getConnection(URL+DATABASE,USERNAME,PASSWORD); } catch (Exception e) { e.printStackTrace(); } }
has title: error in connecting to a local database (java)
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/34544479
tagged with: connection
has comment: http://stackoverflow.com/comment/34544507
has comment: http://stackoverflow.com/comment/34544431

http://stackoverflow.com/comment/35006198
comment on: http://stackoverflow.com/q/22776533
score: 0
type: Comment
has text: how does `serverPrinc` look like?
type: QuestionComment

netbeans
tags question: http://stackoverflow.com/q/22717053
tags question: http://stackoverflow.com/q/22700013
tags question: http://stackoverflow.com/q/22777159
tags question: http://stackoverflow.com/q/22696228
tags question: http://stackoverflow.com/q/22768759
tags question: http://stackoverflow.com/q/22735049
tags question: http://stackoverflow.com/q/22649374
tags question: http://stackoverflow.com/q/22749780
tags question: http://stackoverflow.com/q/22665777
tags question: http://stackoverflow.com/q/22744355
tags question: http://stackoverflow.com/q/22782489
tags question: http://stackoverflow.com/q/22655230
tags question: http://stackoverflow.com/q/22683492
tags question: http://stackoverflow.com/q/22653769
tags question: http://stackoverflow.com/q/22698829
tags question: http://stackoverflow.com/q/22728794
tags question: http://stackoverflow.com/q/22762372
tags question: http://stackoverflow.com/q/22729288
tags question: http://stackoverflow.com/q/22747366
tags question: http://stackoverflow.com/q/22771404
type: Tag
tags question: http://stackoverflow.com/q/22692858
tags question: http://stackoverflow.com/q/22654850
tags question: http://stackoverflow.com/q/22741043
tags question: http://stackoverflow.com/q/22719264
tags question: http://stackoverflow.com/q/22690762
tags question: http://stackoverflow.com/q/22650838
tags question: http://stackoverflow.com/q/22731675
tags question: http://stackoverflow.com/q/22707655
tags question: http://stackoverflow.com/q/22758459
tags question: http://stackoverflow.com/q/22692431
tags question: http://stackoverflow.com/q/22748700
tags question: http://stackoverflow.com/q/22700642
tags question: http://stackoverflow.com/q/22748822
tags question: http://stackoverflow.com/q/22783903
tags question: http://stackoverflow.com/q/22686174
tags question: http://stackoverflow.com/q/22674155
tags question: http://stackoverflow.com/q/22649351
tags question: http://stackoverflow.com/q/22651331
tags question: http://stackoverflow.com/q/22778450
tags question: http://stackoverflow.com/q/22701406
tags question: http://stackoverflow.com/q/22785322
tags question: http://stackoverflow.com/q/22806507
tags question: http://stackoverflow.com/q/22710823
tags question: http://stackoverflow.com/q/22752351
tags question: http://stackoverflow.com/q/22720746
tags question: http://stackoverflow.com/q/22707942
tags question: http://stackoverflow.com/q/22784572
tags question: http://stackoverflow.com/q/22795669
tags question: http://stackoverflow.com/q/22695210
tags question: http://stackoverflow.com/q/22721311
tags question: http://stackoverflow.com/q/22778776
tag name: netbeans
tags question: http://stackoverflow.com/q/22670196
tags question: http://stackoverflow.com/q/22790368
tags question: http://stackoverflow.com/q/22662609
tags question: http://stackoverflow.com/q/22771529
tags question: http://stackoverflow.com/q/22747299
tags question: http://stackoverflow.com/q/22716224
tags question: http://stackoverflow.com/q/22733592
tags question: http://stackoverflow.com/q/22651591
tags question: http://stackoverflow.com/q/22743447
tags question: http://stackoverflow.com/q/22684170
tags question: http://stackoverflow.com/q/22719327
tags question: http://stackoverflow.com/q/22750489
tags question: http://stackoverflow.com/q/22648737
tags question: http://stackoverflow.com/q/22684092

http://stackoverflow.com/comment/34524388
has text: what exactly is the issue? Can you provide your expected output?
score: 0
comment on: http://stackoverflow.com/q/22664881
type: Comment
type: QuestionComment

http://stackoverflow.com/q/22781683
linked to: http://stackoverflow.com/q/12127187
tagged with: swing
has comment: http://stackoverflow.com/comment/34735597
tagged with: text
type: AnsweredQuestion
score: 2
upvote count: 2
has body: I want to write a text on a circle. The intersection area of the text and circle must be a different color. At first I thought to use area class, but I couldn't figure out how to convert a text to an area. I still have no idea how to convert a text to a shape or something. Here is the example picture: void paintComponent(Graphics g){ Ellipse2D myEllipse = new Ellipse2D.Double(20,20,100,100); //i have no idea how to create a text as a shape. //if i was able to create a text as a shape,i would name it "myText" a1.add(new Area(myEllipse)); a2.add(new Area(myText)); g2.setColor(Color.red); g2.fill(myEllipse); g2.setColor(Color.CYAN); g2.fill(myText); a1.intersect(a2); g2.setColor(Color.BLACK); g2.fill(a1); }
tagged with: java
has title: Paint the intersection area of text inside a circle
type: Question
tagged with: graphics
linked to: http://stackoverflow.com/q/6295084
tagged with: intersection
has answer: http://stackoverflow.com/a/22782452
has comment: http://stackoverflow.com/comment/34735145
answer count: 2
accepted answer: http://stackoverflow.com/a/22782452
possible better answer: http://stackoverflow.com/a/22782557
downvote count: 0
has answer: http://stackoverflow.com/a/22782557
favorite count: 0
has comment: http://stackoverflow.com/comment/34735371

http://stackoverflow.com/q/22749336
has comment: http://stackoverflow.com/comment/34676420
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/34676441
tagged with: java
has comment: http://stackoverflow.com/comment/34676380
type: Question
tagged with: iterator
answer count: 1
has comment: http://stackoverflow.com/comment/34676467
has comment: http://stackoverflow.com/comment/34676332
tagged with: arraylist
score: 0
has comment: http://stackoverflow.com/comment/34676510
has title: Iterating through an arralist - java
has answer: http://stackoverflow.com/a/22749486
accepted answer: http://stackoverflow.com/a/22749486
has comment: http://stackoverflow.com/comment/34676365
has comment: http://stackoverflow.com/comment/34676331
has comment: http://stackoverflow.com/comment/34676306
has comment: http://stackoverflow.com/comment/34676327
has comment: http://stackoverflow.com/comment/34676320
has body: public void display(detailTom tomData) { ArrayList&lt;detailTom&gt; temp = new ArrayList&lt;detailTom&gt;(); for (int i=0;i&lt;tomData.toString().length();i++) { temp=tomData[i]; System.out.println(temp.getMark1()); } } Hello all, I am trying to iterate through an arraylist tomData which is an object arraylist. I am trying to iterate through the list and display the variable of the object "Mark1". The error is get is "Array required but detailTom found" any ideas? Or any other way of iterating through tomData?

http://stackoverflow.com/comment/34695833
comment on: http://stackoverflow.com/q/22757681
score: 0
type: QuestionComment
type: Comment
has text: I cant. It is request of customer

http://stackoverflow.com/q/22663652
score: 0
tagged with: bean-validation
answer count: 1
has answer: http://stackoverflow.com/a/22690329
has title: Guava Optional versus Bean Validation
type: UnansweredQuestion
type: Question
has body: We are implementing a new Java EE Project and are not very familiar with this technology so far. So we much have to learn... Currently we are using Guava Optional in BOs to implement fields that are not mandatory. We have a lot of discussion around this class and I don't see the advantages so far. I would prefer to using Bean Validation with the annotation @NotNull to indicate if a field is set always or not. Of course, that it's set, you can only be sure after validation. Now to my question. Does eclipse don't show the Bean Validation Annotations? So you would better see, what you can be sure. Is there a plugin that would help?
tagged with: guava
tagged with: java
tagged with: eclipse

http://stackoverflow.com/comment/34590702
score: 0
has text: infact im running on a local host so it would be localhost:8080/WebProject/user/Surname1993
comment on: http://stackoverflow.com/q/22701406
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/34664383
type: QuestionComment
has text: [Access modifiers in JAVA.](http://java8.in/unit-1-concept-1-access-modifiers-in-java/)
comment on: http://stackoverflow.com/q/22742728
score: 0
type: Comment

http://stackoverflow.com/comment/34554059
score: 0
type: Comment
type: AnswerComment
comment on: http://stackoverflow.com/a/22680540
has text: Where are you facing problem? Are you getting any exception? or something else. Please provide some info.

http://stackoverflow.com/comment/34552954
score: 1
type: AnswerComment
comment on: http://stackoverflow.com/a/22680836
has text: As per what OP says: // getC() is a function that returns degrees in Celsius as a double; thus, it should be safe to assume a postcondition of the getter is that 50 F would be converted into C.
type: Comment

http://stackoverflow.com/comment/72067570
has text: I'd like to know why things are shipped that don't work unless you google and read the answer on stack overflow! I know, job security for the volunteers, but wow I just installed STS, created a new maven project, and the error just showed up. Not just complaining here (well maybe a bit), but why do things end up like this a large portion of the time when concerning eclipse-built solutions? (not blaming eclipse specifically, just a correlation).
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/22756153

scala
tags question: http://stackoverflow.com/q/22664088
tags question: http://stackoverflow.com/q/22716136
tags question: http://stackoverflow.com/q/22742308
tags question: http://stackoverflow.com/q/22796049
tags question: http://stackoverflow.com/q/22762353
tags question: http://stackoverflow.com/q/22654750
tags question: http://stackoverflow.com/q/22718515
tags question: http://stackoverflow.com/q/22666804
tags question: http://stackoverflow.com/q/22737934
tags question: http://stackoverflow.com/q/22656909
tags question: http://stackoverflow.com/q/22791485
tags question: http://stackoverflow.com/q/22648885
tag name: scala
tags question: http://stackoverflow.com/q/22801834
tags question: http://stackoverflow.com/q/22803885
tags question: http://stackoverflow.com/q/22728929
tags question: http://stackoverflow.com/q/22806474
type: Tag

http://stackoverflow.com/a/22806828
has comment: http://stackoverflow.com/comment/34786652
type: Answer
score: 3
answers question: http://stackoverflow.com/q/22806748
downvote count: 0
has comment: http://stackoverflow.com/comment/34782930
upvote count: 3
has comment: http://stackoverflow.com/comment/34781270
has comment: http://stackoverflow.com/comment/34782038
has body: You can split by line returns and append alternately. No code example because of "Easy Kill". EDIT : Implemented because of "Nice": String concatenateHorizontally(final String left, final String right) { String br = "\n"; String[] lefts = left.split(br); String[] rights = right.split(br); if(lefts.length!=rights.length) throw new UnsupportedOperationException("This is where my time becomes money"); StringBuilder sB = new StringBuilder(); for (int i = 0; i &lt; lefts.length; i++) { sB.append(lefts[i]); sB.append(rights[i]); sB.append(br); } return sB.toString(); }

http://stackoverflow.com/q/22807894
has title: Android AsyncTask -
answer count: 1
downvote count: 1
favorite count: 0
tagged with: android
has body: I have a thread which loops and shows a progress dialogue, until everything has finished. In this thread I'm trying to run a class 'MapInteractor' which draws polygons on to the google map. However I got an error, 'not on the main thread'. So I read up a bit about it, and people seemed to suggest using an AsyncTask. I tried this, however I still get an error. The shortened code is show below, as well as the error. If anyone has any idea as to how to fix this, it would be highly appreciated. I have been tearing my hair out for hours!! mapInteractor = new MapInteractor(this); fileReader = new FileReader(this); try { progress = ProgressDialog.show(this, progressText, "Loading..", true); new Thread(new Runnable() { public void run() { //does stuff for (CountryData c : countryData){ try { c.setLatAndLong(fileReader.getlatlong(c.getCountryName())); } catch (IOException e) { e.printStackTrace(); } mapInteractor.execute(c.getLatAndLong()); } runOnUiThread(new Runnable() { @Override public void run() { progress.dismiss(); } }); } }).start(); } catch (Exception e) { e.printStackTrace(); } } My Map interactor class: public class MapInteractor extends AsyncTask&lt;double[],Integer,Boolean&gt;{ // Google Map private static GoogleMap googleMap; private int j = 1; static int count = 0; private FragmentActivity fragmentActivity = null; public MapInteractor(FragmentActivity fragmentActivity) { this.fragmentActivity = fragmentActivity; } @Override protected Boolean doInBackground(double[]... latLongs) { boolean complete = false; count++; System.out.println(count); if (googleMap == null) { googleMap = ((SupportMapFragment) fragmentActivity.getSupportFragmentManager().findFragmentById(R.id.map)).getMap(); } PolygonOptions polygonOptions = new PolygonOptions(); System.out.println("length of array = " + latLongs[0].length); for(int i =0;i &lt; latLongs[0].length-1;i++){ if(i == 0){ polygonOptions.add(new LatLng(latLongs[0][j], latLongs[0][i])); }else{ try{ if(((i*2 )+1) &lt;= latLongs.le…
has comment: http://stackoverflow.com/comment/34781595
tagged with: android-asynctask
type: AnsweredQuestion
upvote count: 0
accepted answer: http://stackoverflow.com/a/22808074
tagged with: multithreading
type: Question
has answer: http://stackoverflow.com/a/22808074
tagged with: java
score: -1

http://stackoverflow.com/comment/34668439
comment on: http://stackoverflow.com/q/22745064
score: 1
has text: ok. create your custom layout item
type: Comment
type: QuestionComment

http://stackoverflow.com/q/22681552
has comment: http://stackoverflow.com/comment/34554662
has title: Spring BeanNotOfRequiredTypeException
has comment: http://stackoverflow.com/comment/34554380
tagged with: spring-aop
type: Question
has comment: http://stackoverflow.com/comment/34554281
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/22681682
accepted answer: http://stackoverflow.com/a/22681682
score: 0
tagged with: spring
answer count: 1
tagged with: java
has body: I have bean like this : &lt;bean id="myBean" class="com.mypackage.MyClass" scope="session"&gt; &lt;/bean&gt; here is the class declaration : MyClass extends MySuperClass implements MyInterface&lt;A&gt; MySuperClass extends GenericClass&lt;A&gt; Later I try to do this : applicationContext.getBean("myBean", GenericClass.class); And I get this error : org.springframework.beans.factory.BeanNotOfRequiredTypeException: Bean named 'myBean' must be of type [com.mypackage.GenericClass], but was actually of type [com.sun.proxy.$Proxy118] I solved it by adding : &lt;aop:scoped-proxy /&gt; inside my bean declaration but I like to understand what I am doing and in this case I don't. Could you explain me why I am getting this exception and why adding &lt;aop:scoped-proxy /&gt; solved it ? thanks !

http://stackoverflow.com/comment/34564999
score: 0
type: Comment
has text: I think you're right, I didn't even realize a jar file was created at all... But inspecting the jar, I see the entities are not directly in the root, they're in their own respective packages. So now I'm actually having two questions :-) - Why is the jar created? - Why are the classes loaded even if they're not directly in the root? (I'm sorry but I can't get the formatting to work in this reply... I'm looking into it :-))
comment on: http://stackoverflow.com/a/22687160
type: AnswerComment

http://stackoverflow.com/comment/34562167
type: AnswerComment
has text: thanks but i get "countTextView" cannot be resolved"?
score: 0
type: Comment
comment on: http://stackoverflow.com/a/22686364

http://stackoverflow.com/q/22650872
type: Question
has answer: http://stackoverflow.com/a/22650921
linked to: http://stackoverflow.com/q/2501861
accepted answer: http://stackoverflow.com/a/22650926
answer count: 2
has comment: http://stackoverflow.com/comment/34500012
downvote count: 0
has body: JFrame frame1 = new JFrame("frame"); frame1.setVisible(true); frame1.setPreferredSize(new Dimension(800, 600)); frame1.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); JPanel Panel1 = new JPanel(); JPanel Panel2 = new JPanel(); frame1.add(Panel1,BorderLayout.SOUTH); frame1.add(Panel2,BorderLayout.North); How do i do something like this that if something happens the frame is blank if(SOMETHINGHAPPENS) { //remove all panels from frame 1 so i have a blank frame //now i want to add some new panels }
has comment: http://stackoverflow.com/comment/34500085
linked to: http://stackoverflow.com/q/17477891
has answer: http://stackoverflow.com/a/22650926
upvote count: 1
has comment: http://stackoverflow.com/comment/34500039
tagged with: frame
favorite count: 0
possible better answer: http://stackoverflow.com/a/22650921
has title: Remove Jframe panels
tagged with: swing
has comment: http://stackoverflow.com/comment/34499906
type: AnsweredQuestion
score: 1
tagged with: java
tagged with: jpanel
linked to: http://stackoverflow.com/q/9347076

http://stackoverflow.com/comment/34659056
score: 0
has text: I don't see you adding the first node to your linked list.
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/22739807

http://stackoverflow.com/a/22676027
score: 5
upvote count: 5
has body: You want to remove the head of the list and make it the new tail. You should work out how to do that in your head, and the code will be a logical representation of that. Remove the head of the list. The new head becomes the next item. The removed item stands alone, now; there's nothing after it. Place the node at the end of the list. The new tail becomes that node. Your code now, as you can see, doesn't exactly do that. Working through one step at a time: So, step 1: Node node = head; head = head.next; // &lt;- remove head, new head becomes next item Then, step 2: node.next = null; // there's nothing after it. And finally, step 3: tail.next = node; // &lt;- add to end of list tail = node; // &lt;- becomes new end of list Or, if you'd rather visualize it: Node node = head: +------+ +------+ +------+ +------+ | head |---&gt;| |---&gt;| |---&gt;| tail | +------+ +------+ +------+ +------+ node head = head.next: +------+ +------+ +------+ +------+ | |---&gt;| head |---&gt;| |---&gt;| tail | +------+ +------+ +------+ +------+ node node.next = null: +------+ +------+ +------+ +------+ | | | head |---&gt;| |---&gt;| tail | +------+ +------+ +------+ +------+ node tail.next = node: +------+ +------+ +------+ +------+ | head |---&gt;| |---&gt;| tail |---&gt;| | +------+ +------+ +------+ +------+ node tail = node: +------+ +------+ +------+ +------+ | head |---&gt;| |---&gt;| |---&gt;| tail | +------+ +------+ +------+ +------+ node By the way, if you already happen to have a popFront (or whatever) and/or append operation defined, don't forget you can use those, too; no sense duplicating code: Node node = popFront(); // if you have this append(node); // if you have this
answers question: http://stackoverflow.com/q/22675930
type: AcceptedAnswer
downvote count: 0
accepted answer of: http://stackoverflow.com/q/22675930
has comment: http://stackoverflow.com/comment/34544917
type: Answer

http://stackoverflow.com/comment/34757875
type: Comment
has text: Tried that but then it expects return type when compiling the startscreen class and I dont know how to go about that
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/22794461

http://stackoverflow.com/a/22741873
answers question: http://stackoverflow.com/q/22741848
has comment: http://stackoverflow.com/comment/34662580
type: Answer
score: 8
has comment: http://stackoverflow.com/comment/34662963
downvote count: 0
upvote count: 8
has body: The rule you gave is correct, but it applies to checked exceptions, not to runtime exceptions. Any method is allowed to throw any runtime exception it wants, without declaring it. You may declare them, but it's purely for documentation purpose. To answer your question, yes, the toString(String) method in Fir overrides the toString(String) method in Test. Add the @Override annotation to Fir.toString(), and the compiler will check that for you: you'll get a compilation error if Fir.toString(String) doesn't override any method.
accepted answer of: http://stackoverflow.com/q/22741848
type: AcceptedAnswer

http://stackoverflow.com/comment/128857281
type: AnswerComment
type: Comment
has text: That solved the problem on Pop_OS! (an Ubuntu variant) immediately.
comment on: http://stackoverflow.com/a/68308699
score: 2

http://stackoverflow.com/comment/34590827
has text: @Alvin Okay, I'll edit my post to have the Arena code in it.
score: 0
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/22677581

http://stackoverflow.com/q/22760397
downvote count: 0
has body: I am an android Beginner, I want to validate phone numbers with special character + , ( , ) , - and all digits example (123)456-7894 I tried this code public boolean validCellPhone(String number){ boolean b=true; String MOBILE_PATTERN = "[(,),-][0-9]{10,16}"; // ddm validating pattern = Pattern.compile(MOBILE_PATTERN); matcher = pattern.matcher(cellph.getText().toString()); if (!matcher.matches()) { cellph.requestFocus(); b=false; } else{ b=true; } return b; }
has comment: http://stackoverflow.com/comment/34696285
favorite count: 0
has comment: http://stackoverflow.com/comment/34696262
has title: mobile number validation with special character in android
tagged with: android
linked to: http://stackoverflow.com/q/6358380
type: AnsweredQuestion
score: 1
tagged with: java
type: Question
linked to: http://stackoverflow.com/q/22505336
has answer: http://stackoverflow.com/a/22760694
accepted answer: http://stackoverflow.com/a/22760694
has comment: http://stackoverflow.com/comment/34698018
upvote count: 1
answer count: 1

http://stackoverflow.com/comment/34733680
score: 0
type: Comment
has text: Eclipse just say "method XXX is not applicable for the arguments XXX" nothing else...
type: QuestionComment
comment on: http://stackoverflow.com/q/22781213

http://stackoverflow.com/comment/34564058
type: AnswerComment
comment on: http://stackoverflow.com/a/22682176
type: Comment
has text: I updated from my old project with same feature. Now I'll try to find a tutorial I used then.
score: 0

http://stackoverflow.com/q/22758242
type: Question
has title: Java Interactive Gantt Chart Drawing
has body: I'm trying to draw an interactive "Gantt-Chart" in Java for a project at school. I'm not really used to working with Java-GUI, thats why I would need some Input from your side :) What I'm trying to get (Example for 1 resource only) Resource | Period 1 | P2 | P3 | P4 | P5 | P6 | ... R1 |=====| |=======|==========| R1 |==========| |====| |=======| shall be a production scheduled on that specific resource ==> If there is more than 1 production per period, i don't want them to overlap, but place them beneath each other. What I got already/thought about: I can use JLabels for the Productions I can put them on a Grid I need the JLabels to be interactive --> MouseEventListeners that realize the position the JLabels have been dragged What I have no idea about: How to start...? Taking a JPanel and put some kind of a 2DGrid on it... Then place the Labels on it... Then check if they overlap &lt;-- I got no clue how to check that one except checking pixel for pixel? Then place the JPanel below the one, they overlapped Is it possible to take some kind of GridbagLayout or sth like that to place the JPanels inside of the Grid? So they take care of not overlapping by themselves? I know that my questions are very.... unspecific... But maybe someone could give me some ideas about how to start, what classes I have to look into first to really realize how to do something like that...
score: 0
answer count: 1
type: UnansweredQuestion
tagged with: java
has answer: http://stackoverflow.com/a/22758458
tagged with: swing

http://stackoverflow.com/a/74726084
has comment: http://stackoverflow.com/comment/137777721
answers question: http://stackoverflow.com/q/22725143
upvote count: 0
score: -2
type: Answer
downvote count: 2
has body: @ResponseEntity represents a response which includes headers, body and status code. @ResponseBody only returns the body of the response.

http://stackoverflow.com/q/22714333
has body: Okay so i'm trying to complete this project for school and it is asking me to make a switch statement of the months. So if a user enters 1 it will print out January and so on... I get this error where it says: cannot find symbol - variable January import java.util.*; /** * Outputs the number on a month name entered by the user. * * @author Jack * @version 1a */ public class MonthSwitchReverse { public static void main(String[] args) { Scanner in = new Scanner (System.in); int monthString; String month; System.out.println(" Jan = 1 / Feb = 2 / March = 3 / April = 4 / MAy = 5 / June = 6"); System.out.println(" July = 7 / Aug = 8 / Sep = 9 / Oct = 10 / Nov = 11 / Dec = 12"); System.out.print("Choose a month above and the system will print out the number assigned to that month: "); month = in.next(); switch (month) { case "January": monthString = 1; break; case "February": monthString = 2; break; case "March": monthString = 3; break; case "April": monthString = 4; break; case "May": monthString = 5; break; case "June": monthString = 6; break; case "July": monthString = 7; break; case "August": monthString = 8; break; case "September": monthString = 9; break; case "October": monthString = 10; break; case "November": monthString = 11; break; case "December": monthString = 12; break; default: monthString = 404; break; } System.out.println(monthString); } } EDIT: I fixed it. Thanks for your help.
score: -1
answer count: 1
favorite count: 0
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/34613500
has comment: http://stackoverflow.com/comment/34613410
tagged with: java
has comment: http://stackoverflow.com/comment/34613571
tagged with: switch-statement
downvote count: 1
has title: Switch Statement Reverse
type: Question
has answer: http://stackoverflow.com/a/22714348
has comment: http://stackoverflow.com/comment/34613393
upvote count: 0

http://stackoverflow.com/a/22806118
answers question: http://stackoverflow.com/q/22802605
type: Answer
has body: To avoid having to explicitly rebuild, app1, app2, app3 each time the core plugin changes, define the core plugin as a local plugin in these apps.
score: 0

http://stackoverflow.com/comment/34727710
type: QuestionComment
comment on: http://stackoverflow.com/q/22777662
has text: yes u can use for a testing purpose but i think it will not worked..
score: 0
type: Comment

http://stackoverflow.com/q/22649269
has answer: http://stackoverflow.com/a/22649300
tagged with: java
has title: How to print a 2D array to matrix format
type: Question
has comment: http://stackoverflow.com/comment/34497142
has answer: http://stackoverflow.com/a/22649294
score: 0
has body: My Code so far is below.... int [][] out = readGrayscaleImage("robbie_robot.jpg"); for (int x = 0; x &lt; out.length; x++) { System.out.println(); for (int y = 0; y &lt; out[0].length; y++) { System.out.print(out[x][y]); System.out.print(", "); } } with the output being: 255, 255, 255, 255, 255, 254, 255, 255, 255, 255, 255, 255, 255, 255, 156, 156, 255, 255, 255, 255, 255, 254, 244, 0, 88, 88, 0, 244, 255, 255, 255, 255, 255, 208, 39, 39, 184, 255, 255, 255, 254, 255, 254, 197, 40, 36, 197, 255, 255, 255, but i need it to look like this... {255, 255, 255, 255, 255, 254, 255, 255, 255, 255}, {255, 255, 255, 255, 156, 156, 255, 255, 255, 255}, {255, 254, 244, 0, 88, 88, 0, 244, 255, 255}. {255, 255, 255, 208, 39, 39, 184, 255, 255, 255}, {254, 255, 254, 197, 40, 36, 197, 255, 255, 255} how do i fix this ??
answer count: 2
type: UnansweredQuestion

http://stackoverflow.com/comment/34596972
comment on: http://stackoverflow.com/q/22702859
has text: Are you looking for glyphs like these: [*Unicode Characters in the Control Pictures Block*](http://www.fileformat.info/info/unicode/block/control_pictures/images.htm)?
type: Comment
type: QuestionComment
score: 2

http://stackoverflow.com/q/22664097
has comment: http://stackoverflow.com/comment/34525794
type: Question
has comment: http://stackoverflow.com/comment/34523903
score: 0
has title: How to build workflows with Spring?
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/34531210
tagged with: spring
has body: I'm building a desktop application and use Spring a lot. Now I wonder if there is any good approach to organize workflow executions against a webservice? Example usecase: the user wants to book a car. Therefore, my application would have to perform the following workflow. But not at once, as between the request the obtained data must be displayed to the user and wait for further interaction: authenticate -&gt; search for a list of cars -&gt; return result to user -&gt; pick a specific car -&gt; return details of the car -&gt; enter credit card payment data -&gt; book the car -&gt; display confirmation Also, at any time the user should of course have the chance to cancel the workflow and start all over. Is there any non-xml approach in Spring (or different java framework) that can help creating and maintaining such workflows?
answer count: 0
tagged with: java

http://stackoverflow.com/comment/34598701
comment on: http://stackoverflow.com/a/22705315
has text: @FlorescentTicker Please read [8.8.1](http://docs.spring.io/spring/docs/4.0.x/spring-framework-reference/html/aop.html#aop-atconfigurable) and follow those links. After reading ask what you didn't exactly not understand plus show what you've tried.
type: AnswerComment
type: Comment
score: 1

jenkins
tags question: http://stackoverflow.com/q/22754610
tag name: jenkins
tags question: http://stackoverflow.com/q/22739277
tags question: http://stackoverflow.com/q/22718219
tags question: http://stackoverflow.com/q/22701405
type: Tag

http://stackoverflow.com/comment/34702551
type: QuestionComment
has text: A "jar directory", that is, a directory within a jar?
comment on: http://stackoverflow.com/q/22763506
score: 0
type: Comment

http://stackoverflow.com/comment/34685078
score: 0
has text: move `setContentView` before getting TextView from layout in `DisplayMessageActivity` Activity
comment on: http://stackoverflow.com/q/22754187
type: QuestionComment
type: Comment

http://stackoverflow.com/comment/34629719
type: Comment
comment on: http://stackoverflow.com/a/22723101
has text: i changed it to getInteger
score: 0
type: AnswerComment

http://stackoverflow.com/a/77744375
type: Answer
answers question: http://stackoverflow.com/q/22709510
has body: Here is a solution using streams: Map&lt;V, Set&lt;U&gt;&gt; invertedMap = map.entrySet().stream() .flatMap(e -&gt; e.getValue().stream() .map(v -&gt; Map.entry(e.getKey(), v))) .collect(Collectors.groupingBy( Map.Entry::getValue, Collectors.mapping(Map.Entry::getKey, Collectors.toSet()))); Step-by-step breakdown Convert the map to a stream of entries // Stream&lt;Map.Entry&lt;U, Set&lt;V&gt;&gt;&gt; map.entrySet().stream() Split apart each entry into a separate item per item in the value list // Stream&lt;Map.Entry&lt;U, V&gt;&gt; .flatMap(e -&gt; e.getValue().stream().map(v -&gt; Map.entry(e.getKey(), v))) Group the entries into a new map, with keys equal to the previous values, and values containing a list of each original key mapped to that value. // Map&lt;V, Set&lt;U&gt;&gt; .collect(Collectors.groupingBy( Map.Entry::getValue, Collectors.mapping(Map.Entry::getKey, Collectors.toSet())));
score: 0

http://stackoverflow.com/comment/34607038
type: QuestionComment
score: 0
has text: Try synchronizing on an simple object and not the Thread object and you will see the difference.
comment on: http://stackoverflow.com/q/22710531
type: Comment

http://stackoverflow.com/comment/34657916
type: Comment
score: 0
type: AnswerComment
has text: I can see it now...gee this is crazy. Is there any tutorial or proper documentation on this? It's definitely not under "subclass".
comment on: http://stackoverflow.com/a/22739032

http://stackoverflow.com/q/22781385
has body: I'm trying to display a Dialog when any exception occurs in doInBackground method of AsyncTask. I know I can't display a dialog while previous task is running. So for this I tried to Cancel (finish) AsyncTask like this, try { response= HttpService.doServerRequest(params); } catch(Exception e){ task.cancel(true); //Cancelling AsyncTask CustomException.onException(CurrentActivityName.this); } I have created a CustomException class for handling all exceptions and for displaying a dialog that will tell some error has occurred. I know this type of question is already asked here but I am not getting any solution that's why I am asking. Is there any way to finish all previous activity or finish AsyncTask ? Please help. Thanks in Advance.
has title: Cancel AsyncTask when getting any exception
has answer: http://stackoverflow.com/a/22781794
has comment: http://stackoverflow.com/comment/34734362
score: 0
answer count: 2
has answer: http://stackoverflow.com/a/22781738
has comment: http://stackoverflow.com/comment/34734318
has comment: http://stackoverflow.com/comment/34734257
tagged with: android-asynctask
linked to: http://stackoverflow.com/q/2033914
type: UnansweredQuestion
tagged with: android
tagged with: java
type: Question

http://stackoverflow.com/q/22789625
type: Question
tagged with: google-fusion-tables
score: 0
answer count: 1
has body: I've been trying to insert new rows in my google fusion table, but in response I obtain a 401 error; also any other post request doesn't work. I've already put the oauth access token, and also the api key, here is the code: private void sendPost() throws Exception { String url = "https://www.googleapis.com/fusiontables/v1/query?sql= **here I put my query** ?key="+ "**here I put my api key**"; URL obj = new URL(url); HttpsURLConnection con = (HttpsURLConnection) obj.openConnection(); //add request header con.setRequestMethod("POST"); con.setRequestProperty("User-Agent", "Chrome/11.0.660.0"); con.addRequestProperty("client_id", "**here I put my client_ID**"); con.addRequestProperty("client_secret", "**here I put my client_secret**"); con.setRequestProperty("Authorization","Oauth " + "**here I put my access token**"); con.setRequestProperty("Content-Type", "application/json"); String urlParameters = "sn=C02G8416DRJM&amp;cn=&amp;locale=&amp;caller=&amp;num=12345"; // Send post request con.setDoOutput(true); DataOutputStream wr = new DataOutputStream(con.getOutputStream()); wr.writeBytes(urlParameters); wr.flush(); wr.close(); int responseCode = con.getResponseCode(); System.out.println("\nSending 'POST' request to URL : " + url); System.out.println("Post parameters : " + urlParameters); System.out.println("Response Code : " + responseCode); BufferedReader in = new BufferedReader(newInputStreamReader(con.getInputStream())); String inputLine; StringBuffer response = new StringBuffer(); while ((inputLine = in.readLine()) != null) { response.append(inputLine); } in.close(); //print result System.out.println(response.toString()); } } Can you tell me if the code is wrong and in which point? Thank you in advance.
has answer: http://stackoverflow.com/a/22886185
type: UnansweredQuestion
tagged with: java
tagged with: oauth-2.0
has title: post requests to google fusion tables

http://stackoverflow.com/q/22749748
score: -1
has answer: http://stackoverflow.com/a/22749799
type: Question
answer count: 2
possible better answer: http://stackoverflow.com/a/22749799
favorite count: 0
has title: Inheritance from an Interface
has answer: http://stackoverflow.com/a/22749797
has comment: http://stackoverflow.com/comment/34677151
has body: I have an interface at the top of my program (IVehicle), below this is a class which implements the majority of the inherited methods (Vehicle). Below Vehicle is two more classes, Fueled, and Non-Fuelled. Fueled needs methods to get/set/increment the fuel field, Non-Fulled doesn't. My problem is that without putting the methods into the interface, when I try to call them from elsewhere in my program Java won't allow it - I either have to cast (which I don't believe is an option here as I have two separate types of Vehicle) or create the method. Is there anyway to deal with this, other than creating a method in the interface? If that is the only option, how would I deal with the Inheritance in the Non-Fuelled class?
upvote count: 2
tagged with: interface
accepted answer: http://stackoverflow.com/a/22749797
has comment: http://stackoverflow.com/comment/34677128
type: AnsweredQuestion
tagged with: java
downvote count: 3

each
tags question: http://stackoverflow.com/q/22650444
type: Tag
tag name: each

http://stackoverflow.com/a/22723703
has comment: http://stackoverflow.com/comment/34631011
has comment: http://stackoverflow.com/comment/34633867
downvote count: 0
has comment: http://stackoverflow.com/comment/34631214
has comment: http://stackoverflow.com/comment/34631499
has comment: http://stackoverflow.com/comment/34633996
has comment: http://stackoverflow.com/comment/34630950
has body: Whenever implementing a singleton, the getInstance() method should be thread-safe. e.g., public static synchronized Clients getInstance() ... or ... private static final Object INSTANCE_LOCK = new Object(); public static Clients getInstance() { synchronized(INSTANCE_LOCK) { if(instance == null) instance = new Clients(); } return instance; } Of course, if you're in fact executing this bit of code from two different programs rather than two different threads, you'll have two instances. I'm assuming the former, because the latter makes your question nonsensical. I suppose I should explain why that's nonsensical. When you execute a Java program with a main(String[] args) method, all of your classes are loaded into the JVM. If you then execute another program, you get another JVM and another "copy" of all the associated classes. Thus, you have two separate singletons -- one for each program. Classes aren't shared between the two.
has comment: http://stackoverflow.com/comment/34633841
has comment: http://stackoverflow.com/comment/34631183
has comment: http://stackoverflow.com/comment/34631333
has comment: http://stackoverflow.com/comment/34630968
has comment: http://stackoverflow.com/comment/34631000
has comment: http://stackoverflow.com/comment/34631177
score: 5
has comment: http://stackoverflow.com/comment/34883893
has comment: http://stackoverflow.com/comment/34631094
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/34634030
accepted answer of: http://stackoverflow.com/q/22723647
has comment: http://stackoverflow.com/comment/34631431
upvote count: 5
has comment: http://stackoverflow.com/comment/34631046
answers question: http://stackoverflow.com/q/22723647
type: Answer

http://stackoverflow.com/q/22687027
score: 0
tagged with: jpa
answer count: 1
has answer: http://stackoverflow.com/a/22687755
accepted answer: http://stackoverflow.com/a/22687755
type: AnsweredQuestion
tagged with: mysql
type: Question
has title: Why am I getting this error when carrying out a basic mySQL search using JPA?
tagged with: java
has body: I am querying a my sql database. I have two tables: Table 1: BusinessAccount businessName (String); businessAddress (String); county (int); (county is the Foreign Key for countyId on table 2) Table 2: County countyId (int); countyName (String); I am trying to return a list of all business accounts where the county=1. I am getting an error saying the following: You have attempted to set a value of type class java.lang.Integer for parameter CountyId with expected type of class com.needABuilder.entities.County from query string SELECT u FROM BusinessAccount u WHERE u.county=:CountyId I don't understand why I am getting this error as I am searching the BusinessAccount table for entries where the integer value county=1. Here is my code. Thanks for any help. public List&lt;BusinessAccount&gt; searchContractors() { factory = Persistence.createEntityManagerFactory(PERSISTENCE_UNIT_NAME); EntityManager em = factory.createEntityManager(); List&lt;BusinessAccount&gt; contractorList = new ArrayList&lt;BusinessAccount&gt;(); em.getTransaction().begin(); int countyId=1; Query myQuery = em.createQuery( "SELECT u FROM BusinessAccount u WHERE u.county=:CountyId"); myQuery.setParameter("CountyId", countyId); contractorList=myQuery.getResultList(); em.getTransaction().commit(); em.close(); return contractorList; }

http://stackoverflow.com/q/22745845
has comment: http://stackoverflow.com/comment/34712007
has answer: http://stackoverflow.com/a/22863526
score: 0
answer count: 3
has title: Value does not update the bean property
has answer: http://stackoverflow.com/a/35586260
has comment: http://stackoverflow.com/comment/34756265
has comment: http://stackoverflow.com/comment/34729809
accepted answer: http://stackoverflow.com/a/22863526
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/22756756
tagged with: primefaces
tagged with: java
has body: I'm very new to JSF, I just started using it a few days ago and I'm trying to learn of tutorials. But I can't tell why this isn't working. I am using JSF 2.1 with PrimeFaces 3.5. The problem is when I submit the form, the value is not updated property. Only last inputText is updated. What am I missing? View: &lt;h:body&gt; &lt;h:form id="profilForm"&gt; &lt;p:growl id="msg" showDetail="true" life="3000" /&gt; &lt;p:panel header="Profil" style="width: 460px;"&gt; &lt;h:panelGrid id="loginPanel" columns="2"&gt; &lt;h:outputLabel for="idPracownik" value="Id Pracownika" /&gt; &lt;h:inputText id="idPracownik" value="#{pracownikControl.pracownik.idPracownik}" label="Id Pracownika"/&gt; &lt;p:outputLabel for="imie" value="Imię" /&gt; &lt;p:inputText id="imie" value="#{pracownikControl.pracownik.imie}" label="Imię" /&gt; &lt;h:outputLabel for="nazwisko" value="Nazwisko" /&gt; &lt;p:inputText id="nazwisko" value="#{pracownikControl.pracownik.nazwisko}" /&gt; &lt;h:outputLabel for="kraj" value="Kraj" /&gt; &lt;h:inputText id="kraj" value="#{pracownikControl.pracownik.kraj}" label="Kraj" /&gt; &lt;h:outputLabel for="wojewodztwo" value="Województwo" /&gt; &lt;h:inputText id="wojewodztwo" value="#{pracownikControl.pracownik.wojewodztwo}" label="Województwo" /&gt; &lt;h:outputLabel for="miejscowosc" value="Miejscowość" /&gt; &lt;h:inputText id="miejscowosc" value="#{pracownikControl.pracownik.miejscowosc}" label="Miejscowość" /&gt; &lt;h:outputLabel for="adres" value="Adres" /&gt; &lt;h:inputText id="adres" value="#{pracownikControl.pracownik.adres}" label="Adres" /&gt; &lt;h:outputLabel for="kodPocztowy" value="Kod Pocztowy" /&gt; &lt;h:inputText id="kodPocztowy" value="#{pracownikControl.pracownik.kodPocztowy}" label="Kod Pocztowy" /&gt; &lt;h:outputLabel for="telefon" value="Telefon" /&gt; &lt;h:inputText id="telefon" value="#{pracownikControl.pracownik.telefon}" label="Telefon" /&gt; &lt;h:outputLabel for="email" value="E-mail" /&gt; &lt;p:inputText id="email" value="#{pracow…
possible better answer: http://stackoverflow.com/a/22756756
type: Question
tagged with: jsf-2
has comment: http://stackoverflow.com/comment/34669808

http://stackoverflow.com/comment/34538809
score: 0
type: Comment
comment on: http://stackoverflow.com/a/22672764
type: AnswerComment
has text: Did you included the correct jdbc.jar in your WEB-INF/lib folder so that your application would be able to make connection with database

http://stackoverflow.com/a/22651926
has comment: http://stackoverflow.com/comment/34546881
accepted answer of: http://stackoverflow.com/q/22651880
has comment: http://stackoverflow.com/comment/34502507
answers question: http://stackoverflow.com/q/22651880
has comment: http://stackoverflow.com/comment/34545973
has comment: http://stackoverflow.com/comment/34543926
upvote count: 1
type: AcceptedAnswer
has body: Your worlds array has not been initialised, and therefore is null. You need to initialise it before accessing it: worlds = new Color[world.size()]; for (int i = 0; i &lt; world.size(); i++) { ... {
type: Answer
downvote count: 0
has comment: http://stackoverflow.com/comment/34546608
score: 1

http://stackoverflow.com/comment/34531250
comment on: http://stackoverflow.com/q/22668462
has text: OK, so it is in reference to `DateTime.now()`? What about the timezone?
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/q/22802079
has body: I'm creating application for game. I'm using GridView with images when i click on GridView item that item is display on another activity.On the other activity i want to match the image logo and textview String(logo name). I have done some logic but when i run the application it goes to else statement. Here is my code. The GridView Activity code: public class GridView_Activity extends Activity { public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.gridview_layout); GridView gridview = (GridView) findViewById(R.id.gridViewImage); gridview.setAdapter(new ImageAdapter(this)); gridview.setOnItemClickListener(new OnItemClickListener() { @Override public void onItemClick(AdapterView&lt;?&gt; arg0, View v, int position, long id) { // TODO Auto-generated method stub Toast.makeText(GridView_Activity.this, "" + position, Toast.LENGTH_SHORT).show(); Intent mInDisplay=new Intent(GridView_Activity.this, Activity_One.class); mInDisplay.putExtra("Index", position); startActivity(mInDisplay); } }); } } ** The Another Activity code** public class Activity_One extends Activity { Button btnSubmit; ImageView imgDisplayImg; String stringVAlue; EditText edittext; int index; public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.display_image); Bundle bdl = getIntent().getExtras(); index = bdl.getInt("Index"); System.out.println("Index Position = " + index); ImageView mImage = (ImageView) findViewById(R.id.mImgView1); mImage.setImageResource(Constants.mThumbIds[index]); stringVAlue = String.valueOf(index); System.out.println("stringVAlue = " + stringVAlue); btnSubmit = (Button) findViewById(R.id.buttonAdd); btnSubmit.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { // TODO Auto-generated method stub edittext = (EditText) findViewById(R.id.edittextString_ImageName); String stringtext = edittext.getText().toString().trim(); System.out.println("stri…
has answer: http://stackoverflow.com/a/22802272
has title: How to compare GridView Item with textview String in Android?
tagged with: android-gridview
upvote count: 2
answer count: 2
favorite count: 0
tagged with: android
score: 2
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/22802111
downvote count: 0
accepted answer: http://stackoverflow.com/a/22802111
tagged with: java
type: Question
possible better answer: http://stackoverflow.com/a/22802272

http://stackoverflow.com/q/22699122
has comment: http://stackoverflow.com/comment/34587351
has answer: http://stackoverflow.com/a/22699276
has answer: http://stackoverflow.com/a/22699267
has comment: http://stackoverflow.com/comment/34586242
has comment: http://stackoverflow.com/comment/34586272
tagged with: string
has comment: http://stackoverflow.com/comment/34586364
has comment: http://stackoverflow.com/comment/34586339
score: 0
has answer: http://stackoverflow.com/a/22699248
has comment: http://stackoverflow.com/comment/34586418
has answer: http://stackoverflow.com/a/22699208
has title: Converting string with letters and numbers
has body: So I have a String declared as String name = "John 20150.00" and I want to break up the name into a different variable and the number into a different variable, is this possible? I tried using the Double.parseDouble(name); method, but when it runs, it doesn't work right. What should I use?
type: UnansweredQuestion
tagged with: double
has comment: http://stackoverflow.com/comment/34586538
has answer: http://stackoverflow.com/a/22699221
has answer: http://stackoverflow.com/a/22700704
has answer: http://stackoverflow.com/a/22699244
tagged with: java
has answer: http://stackoverflow.com/a/22699238
has comment: http://stackoverflow.com/comment/34586744
type: Question
answer count: 8

http://stackoverflow.com/comment/68125337
comment on: http://stackoverflow.com/a/22793119
type: AnswerComment
has text: @nosid I don't think using an `int[]` is more intent revealing than `AtomicInteger`. And if performance is a concern, perhaps a for loop is better as it avoids the `Stream` machinery which probably dwarfs the highly optimized `Atomic*` classes.
score: 6
type: Comment

http://stackoverflow.com/comment/34556359
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/22682589
type: Comment
has text: No I want in a string I will be using this in a query as string, can you let me know how do I call this for loop one at a time in other class

http://stackoverflow.com/q/22780638
type: UnansweredQuestion
tagged with: java
has comment: http://stackoverflow.com/comment/34739916
has body: Let me start by saying I am a total noob in Java. I am building a Jboss JSF app. I have a file called DefaultDS-ds.xml with content: <?xml version="1.0" encoding="UTF-8"?> jdbc:mysql://localhost:3306/CinemaDb mysql-connector-java-5.0.8-bin.jar root test123 and a persistence.xml with content: <?xml version="1.0" encoding="UTF-8"?> model.User java:jboss/datasources/DefaultDS however, when deploying my app I get: JBAS014775: New missing/unsatisfied dependencies: service jboss.naming.context.java.jboss.datasources.DefaultDS (missing) dependents: [service jboss.persistenceunit."dynamic-web.war#user-unit"] I cannot seem to find the answer to this problem myself (if it is something simple - please accept my appologies), so can anyone help me? EDIT: after fidling around with the folder structure, here is the new structure dynamic-web +---WEB-INF ¦ faces-config.xml ¦ web.xml ¦ DefaultDS-ds.xml ¦ +---classes ¦ ¦ ¦ +---META-INF ¦ MANIFEST.MF ¦ persistence.xml ¦ +---lib mysql-connector-java-5.0.8-bin.jar and the new error: 16:40:00,475 INFO [org.jboss.as.server] (DeploymentScanner-threads - 2) JBAS015871: Deploy of deployment "mysql-connector-java-5.0.8-bin.jar" was rolled back with no failure message 16:40:00,479 INFO [org.jboss.as.server] (DeploymentScanner-threads - 2) JBAS015870: Deploy of deployment "dynamic-web.war" was rolled back with failure message {"JBAS014771: Services with missing/unavailable dependencies" => ["jboss.data-source.jboss/datasources/DefaultDSjboss.jdbc-driver.mysql-connector-java-5_0_8-bin_jarMissing[jboss.data-source.jboss/datasources/DefaultDSjboss.jdbc-driver.mysql-connector-java-5_0_8-bin_jar]"]} 16:40:00,483 INFO [org.jboss.as.connector.subsystems.datasources] (MSC service thread 1-11) JBAS010409: Unbound data source [jboss/datasources/DefaultDS] 16:40:00,487 INFO [org.jboss.as.server.deployment] (MSC service thread 1-14) JBAS015877: Stopped deployment dynamic-web.war in 11ms 16:40:00,487 INFO [org.jboss.as.server.deployment] (MSC service thread …
has title: JSF persistance file issue
type: Question
has answer: http://stackoverflow.com/a/22787990
has comment: http://stackoverflow.com/comment/34739774
tagged with: jsf-2
score: 0
answer count: 1
tagged with: jpa
tagged with: jboss7.x
has comment: http://stackoverflow.com/comment/34740565
has comment: http://stackoverflow.com/comment/34740628
has comment: http://stackoverflow.com/comment/34744391

http://stackoverflow.com/comment/34517793
comment on: http://stackoverflow.com/a/22659708
score: 0
has text: Wait, AntPackage.AntTest -- is the class with tests you want to run?
type: AnswerComment
type: Comment

linked-list
tags question: http://stackoverflow.com/q/22739807
tags question: http://stackoverflow.com/q/22751176
tags question: http://stackoverflow.com/q/22707163
tags question: http://stackoverflow.com/q/22776017
tag name: linked-list
tags question: http://stackoverflow.com/q/22747368
tags question: http://stackoverflow.com/q/22738820
type: Tag
tags question: http://stackoverflow.com/q/22668212
tags question: http://stackoverflow.com/q/22678755
tags question: http://stackoverflow.com/q/22677825
tags question: http://stackoverflow.com/q/22722682
tags question: http://stackoverflow.com/q/22676857
tags question: http://stackoverflow.com/q/22753131
tags question: http://stackoverflow.com/q/22775576
tags question: http://stackoverflow.com/q/22800159
tags question: http://stackoverflow.com/q/22727302
tags question: http://stackoverflow.com/q/22675930
tags question: http://stackoverflow.com/q/22799968
tags question: http://stackoverflow.com/q/22662494
tags question: http://stackoverflow.com/q/22748930
tags question: http://stackoverflow.com/q/22748906
tags question: http://stackoverflow.com/q/22763757
tags question: http://stackoverflow.com/q/22673150
tags question: http://stackoverflow.com/q/22759728
tags question: http://stackoverflow.com/q/22701325
tags question: http://stackoverflow.com/q/22720411

http://stackoverflow.com/a/22667836
has body: from http://docs.oracle.com/javase/7/docs/api/java/util/concurrent/ExecutorService.html: List&lt;Runnable&gt; shutdownNow Attempts to stop all actively executing tasks, halts the processing of waiting tasks, and returns a list of the tasks that were awaiting execution. This method does not wait for actively executing tasks to terminate. Use awaitTermination to do that. There is no way to accurately stop running thread, so you have to wait for already running tasks to finish.
answers question: http://stackoverflow.com/q/22665198
score: 0
type: Answer

http://stackoverflow.com/q/22666202
tagged with: eclipse-rcp
type: Question
accepted answer: http://stackoverflow.com/a/22692693
has body: I'm trying to implement a simple SWT dialog, which has a text field and if there is something wrong in the entered text of the text field, I want to show this error in a label at the bottom of the text field. So in the beginning you see only the text field, which is filling the whole window. If I show the label, I create it and want to show it at the bottom of the text field. My problem is, that you only see this label after resizing the window (all the same whether I make it smaller or bigger). So which method is called in the shell, when I resize the window? I tried: shell.layout(); shell.update(); shell.pack(); shell.redraw(); textField.update(); textField.redraw(); But nothing changed. So the only possibility that worked was to take: Point oldSize = shell.getSize(); oldSize.x += 1; shell.setSize(oldSize); oldSize.x -= 1; shell.setSize(oldSize); But this is not an acceptable solution, because the user notices the small changing of the size of the shell. My question is similar to this: Java SWT added Label not visible (also the application looks very similar), but in this solution with pack and setting the old size, the user notices the resizing, and this is very unsatisfying for me. So do you know, which method I could call to update the window, like when I resize? But in this way the size of the window stays the same? Thank you! Edit: If I create the label in the beginning ans set it as invisible, you notice that there is something: Example: this picture shows the window part without creating the label and setting it to invisible This picture shows the window part with creating the label and setting it to invisible: I would prefer version 1.
has title: Update swt window after adding a label
linked to: http://stackoverflow.com/q/10767275
tagged with: swt
has answer: http://stackoverflow.com/a/22694870
score: 0
tagged with: java
answer count: 3
has answer: http://stackoverflow.com/a/22714092
type: AnsweredQuestion
possible better answer: http://stackoverflow.com/a/22714092
has answer: http://stackoverflow.com/a/22692693
tagged with: resize

http://stackoverflow.com/comment/35180937
type: Comment
comment on: http://stackoverflow.com/q/22738497
score: 0
has text: Do you `need` to use Jersey 1? Would 2 suffice? I'm not up for fixing a Jersey 1 example, but could provide a working Jetty / Jersey 2 example.
type: QuestionComment

http://stackoverflow.com/comment/34513274
has text: That is the general solution but "give everybody a piece of bread" is not a solution to end world hunger either. If you're going to give an answer that basically says "here's how to approach it, now google it" then it is not an answer. Either flag it as a duplicate of the question where he'll end up after googling it or provide an answer that explains *why* this has to be done and *what* has to be done specifically.
comment on: http://stackoverflow.com/a/22658412
type: Comment
score: 0
type: AnswerComment

http://stackoverflow.com/q/22674348
type: Question
has body: [UPDATE] I uninstalled and then installed again the application on the test device, and it started working fine. I'm implementing APK Expansion file support (but no XAPK ZIP library support). The documentation implies that if a required APK Expansion file is missing (e.g. it got deleted from the obb folder), my application will re-download it. This doesn't happen for me; my app keeps saying NO_DOWNLOAD_REQUIRED. It seems that the Google Play Downloader Library gets null for the download info from its SQLite database. Note that I haven't updated the draft APK and Expansion file on Google Play - they are still the first version. Moreover, the versionCode of the APK uploaded to Google Play is also identical with the one on the test device. In details: There was an APK Expansion file in the correct folder (obb). I used it for testing purposes before I actually started implementing the downloader functionality. When the Downloader implementation (based on Google Play Downloader Library) was finished, I changed the size of the above obb file to make it invalid for my app. Therefore, this makes my app call the startDownloadIfNeeded() method. First, I ran my implementation without any files on Google Play. The response was, as I expected: "Download failed because the resources could not be found" Then I uploaded my 40MB APK and a 4 MB expansion file to Google Play (for testing purposes). Note that this 4 MB expansion file is not the invalid one which was left in the obb folder. When I ran my implementation, the response came after 1.5 seconds: "Download complete". This was strange, because my internet connection is not so fast to download 4 MB. Indeed, the obb folder (the folder for APK Expansion files) still contained the invalid expansion file that I initially put there manually. That is, nothing was downloaded! I deleted the invalid file, i.e. the obb folder is now empty, but still no download starts, and Downloader Library says NO_DOWNLOAD_REQUIRED. (I checked its inter…
has title: Deleted APK Expansion file still gives NO_DOWNLOAD_REQUIRED
tagged with: android-lvl
has comment: http://stackoverflow.com/comment/50724027
answer count: 1
downvote count: 0
favorite count: 0
has answer: http://stackoverflow.com/a/22724929
upvote count: 2
tagged with: google-play
tagged with: android
accepted answer: http://stackoverflow.com/a/22724929
score: 2
type: AnsweredQuestion
tagged with: java
tagged with: apk-expansion-files

http://stackoverflow.com/q/22760148
answer count: 1
favorite count: 0
tagged with: scope
has body: I'm currently working on an application to allow the user to select an ImageView from a GridView gallery and display it on its own and in all its beauty. The GridView is on a fragment and then will pass the data to an activity to show the selected image. My entire project is working up until initialising the ImageAdapter. I receive an error stating that there is no enclosing instance of type GalleryView. I have tried and tried and then tried some more, was reluctant to post the question but I'm still no closer to resolving the issue. public class SingleImageGallery extends Activity { @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.single_image_view); Intent i = getIntent(); int position = i.getExtras().getInt("id"); ImageAdapter imageAdapter = new ImageAdapter(this); ImageView imageView = (ImageView) findViewById(R.id.SingleView); imageView.setImageResource(imageAdapter.pics[position]); } }
has answer: http://stackoverflow.com/a/22760406
type: UnansweredQuestion
tagged with: android
has comment: http://stackoverflow.com/comment/34696501
tagged with: gridview
downvote count: 0
score: 1
type: Question
has title: ImageAdapter No Enclosing Error
tagged with: java
upvote count: 1

http://stackoverflow.com/a/22776470
has body: final variables means you can not change the value. For example final int x=9; and after that if you change it with x=6; then it will not compile. So in your case public void display(final String toDisplay){ } In this method you are allowing a String argument and after that within that method if you try to change then it will not compile.
answers question: http://stackoverflow.com/q/22776423
has comment: http://stackoverflow.com/comment/61493390
has comment: http://stackoverflow.com/comment/34753692
score: 4
upvote count: 4
type: AcceptedAnswer
downvote count: 0
accepted answer of: http://stackoverflow.com/q/22776423
type: Answer

android
tags question: http://stackoverflow.com/q/22725906
tags question: http://stackoverflow.com/q/22663450
tags question: http://stackoverflow.com/q/22661669
tags question: http://stackoverflow.com/q/22766006
tags question: http://stackoverflow.com/q/22688419
tags question: http://stackoverflow.com/q/22659734
tags question: http://stackoverflow.com/q/22779717
tags question: http://stackoverflow.com/q/22718047
tags question: http://stackoverflow.com/q/22733474
tags question: http://stackoverflow.com/q/22679288
tags question: http://stackoverflow.com/q/22789135
tags question: http://stackoverflow.com/q/22744728
tags question: http://stackoverflow.com/q/22771756
tags question: http://stackoverflow.com/q/22807894
tags question: http://stackoverflow.com/q/22761537
tags question: http://stackoverflow.com/q/22696759
tags question: http://stackoverflow.com/q/22742097
tags question: http://stackoverflow.com/q/22739851
tags question: http://stackoverflow.com/q/22795285
tags question: http://stackoverflow.com/q/22794338
tags question: http://stackoverflow.com/q/22676704
tags question: http://stackoverflow.com/q/22652606
tags question: http://stackoverflow.com/q/22691406
tags question: http://stackoverflow.com/q/22739196
tags question: http://stackoverflow.com/q/22767989
tags question: http://stackoverflow.com/q/22769304
tags question: http://stackoverflow.com/q/22727138
tags question: http://stackoverflow.com/q/22694400
tags question: http://stackoverflow.com/q/22759223
tags question: http://stackoverflow.com/q/22780997
tags question: http://stackoverflow.com/q/22669442
tags question: http://stackoverflow.com/q/22703643
tags question: http://stackoverflow.com/q/22784168
tags question: http://stackoverflow.com/q/22734877
tags question: http://stackoverflow.com/q/22696126
tags question: http://stackoverflow.com/q/22712935
tags question: http://stackoverflow.com/q/22717939
tags question: http://stackoverflow.com/q/22761919
tags question: http://stackoverflow.com/q/22787881
tags question: http://stackoverflow.com/q/22708452
tags question: http://stackoverflow.com/q/22745154
tags question: http://stackoverflow.com/q/22714874
tags question: http://stackoverflow.com/q/22781430
tags question: http://stackoverflow.com/q/22700734
tags question: http://stackoverflow.com/q/22788183
tags question: http://stackoverflow.com/q/22775255
tags question: http://stackoverflow.com/q/22804410
tags question: http://stackoverflow.com/q/22793594
tags question: http://stackoverflow.com/q/22750177
tags question: http://stackoverflow.com/q/22674183
tags question: http://stackoverflow.com/q/22717006
tags question: http://stackoverflow.com/q/22660148
tags question: http://stackoverflow.com/q/22781273
tags question: http://stackoverflow.com/q/22786575
tags question: http://stackoverflow.com/q/22663012
tags question: http://stackoverflow.com/q/22750738
tags question: http://stackoverflow.com/q/22704186
tags question: http://stackoverflow.com/q/22697227
tags question: http://stackoverflow.com/q/22797382
tags question: http://stackoverflow.com/q/22693874
tags question: http://stackoverflow.com/q/22657144
tags question: http://stackoverflow.com/q/22744083
tags question: http://stackoverflow.com/q/22730170
tags question: http://stackoverflow.com/q/22743153
tags question: http://stackoverflow.com/q/22697014
tags question: http://stackoverflow.com/q/22653438
tags question: http://stackoverflow.com/q/22733322
tags question: http://stackoverflow.com/q/22650617
tags question: http://stackoverflow.com/q/22727041
tags question: http://stackoverflow.com/q/22792734
tags question: http://stackoverflow.com/q/22750373
tags question: http://stackoverflow.com/q/22791027
tags question: http://stackoverflow.com/q/22721471
tags question: http://stackoverflow.com/q/22787840
tags question: http://stackoverflow.com/q/22679862
tags question: http://stackoverflow.com/q/22762783
tags question: http://stackoverflow.com/q/22766116
tags question: http://stackoverflow.com/q/22743890
tags question: http://stackoverflow.com/q/22806781
tags question: http://stackoverflow.com/q/22776430

http://stackoverflow.com/a/22767049
score: 1
answers question: http://stackoverflow.com/q/22766900
upvote count: 1
type: AcceptedAnswer
downvote count: 0
type: Answer
has body: If you want your listener to be more accessible (API usable), then I would recommend method 2. I also stopped using private classes a few years ago and use public static nested classes: public class YourClass { public static YourNestedClass { //... } } There are no real performance differences in the initialization of them aside from your own implementation. If you make, say, 30 different listener objects for something that could all be done by a common object (as in method 1/2), then there may be a slight difference. Otherwise, you can really just do what you prefer.
accepted answer of: http://stackoverflow.com/q/22766900

http://stackoverflow.com/comment/34646387
score: 0
type: Comment
has text: @MartynChamberlin that's even worse. Now you still have only one thread, and call synchronized methods of 2 different objects. To have a thread, you need to call `start()` on a Thread instance somewhere. Otherwise, everything is executed by the main thread.
comment on: http://stackoverflow.com/a/22732513
type: AnswerComment

http://stackoverflow.com/comment/34546040
has text: Depending on image size, you could also just store the images directly in PostgreSQL as `bytea` fields or using `pg_largeobject`.
score: 0
comment on: http://stackoverflow.com/q/22674101
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/34560427
type: Comment
comment on: http://stackoverflow.com/a/22684518
has text: No, I don't do anything with connections at all. Spring/Hibernate take care about it
type: AnswerComment
score: 0

http://stackoverflow.com/q/22672319
tagged with: java
tagged with: http
type: Question
has comment: http://stackoverflow.com/comment/34538105
has answer: http://stackoverflow.com/a/22672662
has comment: http://stackoverflow.com/comment/34538125
has title: Remove parameters from a URL regardless
has body: Let's say we have a URL like the following: https://www.google.com/search?q=X&amp;b=Y I like to just get https://www.google.com/search. There are a few easy ways to do this like so String baseUrl = url.split("?")[0]; What's a better/safe way to do this? Is there something build in?
score: 0
answer count: 2
tagged with: url
has comment: http://stackoverflow.com/comment/34538324
has comment: http://stackoverflow.com/comment/34537853
type: UnansweredQuestion
tagged with: netty
has answer: http://stackoverflow.com/a/22673779

http://stackoverflow.com/comment/34681367
type: Comment
type: QuestionComment
has text: `I am positive that "sentence" does equal john.` A decade of Java development disagrees with you. But seriously, maybe it contains characters that appear as whitespace, so you cannot debug it by printing it. Check the `String`'s bytes or check its length.
score: 1
comment on: http://stackoverflow.com/q/22752123

http://stackoverflow.com/q/22701480
tagged with: incompatibletypeerror
has body: I'm writing a roman numeral program for my class. I'm using a switch statement to convert strings to integers. However I'm getting an incompatible type error when I run it. Im running java 7 so that's not the issue. Here's my code: public static void main() { // Declare local variables Scanner input = new Scanner(System.in); String rNum; int i; int[] rArray; // Display program purpose System.out.println("This Program Converts Roman numerals to decimals"); System.out.println("The Roman numerals are I (1), V (5), X (10), L (50), C (100), D (500) and M (1000)."); System.out.print("Enter your roman numeral: "); rNum = input.next().toUpperCase(); rArray = new int[rNum.length()]; for(i = 0; i &lt; rNum.length(); i++){ switch(rNum.charAt(i)){ case "I": rArray[i] = 1; break; } }
tagged with: java
has answer: http://stackoverflow.com/a/22701487
tagged with: switch-statement
answer count: 3
has comment: http://stackoverflow.com/comment/34595031
tagged with: arrays
favorite count: 0
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/22701496
has title: Switch Incompatible Type Error
has comment: http://stackoverflow.com/comment/34590854
has comment: http://stackoverflow.com/comment/34590631
score: 0
upvote count: 1
downvote count: 1
type: Question
has answer: http://stackoverflow.com/a/22701549

http://stackoverflow.com/comment/34580350
comment on: http://stackoverflow.com/a/22695962
has text: Does `Map` has a `contains` method? Also what is the `key` variable?
score: 0
type: AnswerComment
type: Comment

http://stackoverflow.com/q/22649629
has answer: http://stackoverflow.com/a/22649835
linked to: http://stackoverflow.com/q/32987103
has comment: http://stackoverflow.com/comment/111783979
tagged with: ascii-art
score: 0
type: UnansweredQuestion
type: Question
has answer: http://stackoverflow.com/a/42239443
tagged with: java
has title: Convert contents of an image into an ASCII image
has body: I've stored the grayscale of an image into a double array and now i need to do the following task but I'm not sure where to begin: The contents of the image in &lt;infile&gt; will be converted into an ASCII image. Use the following (approximate!) grayscale-to-character mappings. You are free to adjust the numeric ranges a little bit in order to make programming easier: o 0 to 25:‘M’ o 26 to 50:‘$’ o 51 to 76:‘o’ o 77 to 102:‘|’ o 103 to 127: ‘*’ o 128 to 152: ‘:’ o 153 to 178: ‘=’ o 179 to 204: ‘\’’ (note the escape character before the single-quote) o 205 to 230: ‘.’ o 231 to 255: ‘ ’ (i.e., a single space)
answer count: 2
has comment: http://stackoverflow.com/comment/34498023
has comment: http://stackoverflow.com/comment/34498007

http://stackoverflow.com/q/22649223
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/22649322
score: 1
tagged with: java
has answer: http://stackoverflow.com/a/22649250
accepted answer: http://stackoverflow.com/a/22649250
type: Question
answer count: 2
upvote count: 1
has comment: http://stackoverflow.com/comment/34497083
has body: Can anyone tell why the auto boxing is not working, and why with constructor it works fine: int intValue = 12; Double FirstDoubleValue = new Double(intValue); Double SecondDoubleValue = intValue; // ==&gt; Error Thanks for advance :)
favorite count: 0
has title: Getting Error with java autoboxing
tagged with: autoboxing
possible better answer: http://stackoverflow.com/a/22649322
downvote count: 0

http://stackoverflow.com/a/22662022
has comment: http://stackoverflow.com/comment/34524895
type: Answer
answers question: http://stackoverflow.com/q/22661605
score: 2
downvote count: 0
has comment: http://stackoverflow.com/comment/34520674
has body: JAX-WS implementation introduced in J2EE 5. Non-full J2EE servlet container like Tomcat does not understand sun-jaxws.xml , so you need to add a library to make it work.
accepted answer of: http://stackoverflow.com/q/22661605
upvote count: 2
has comment: http://stackoverflow.com/comment/40859308
type: AcceptedAnswer

http://stackoverflow.com/q/22740314
tagged with: java
upvote count: 1
has comment: http://stackoverflow.com/comment/34661982
has comment: http://stackoverflow.com/comment/34662765
linked to: http://stackoverflow.com/q/7441625
accepted answer: http://stackoverflow.com/a/22740427
has answer: http://stackoverflow.com/a/22740618
type: AnsweredQuestion
has body: I found this code for a simple Java Swing calculator and ran it in Eclipse, but it's not adding numbers correctly and I'm not sure why. import javax.swing.*; import java.awt.*; import java.awt.event.*; /** A simplified calculator. The only operations are addition and subtraction */ public class Calculator extends JFrame implements ActionListener { public static final int WIDTH = 400; public static final int HEIGHT = 200; public static final int NUMBER_OF_DIGITS = 30; private JTextField ioField; private double result = 0.0; public static void main (String[] args) { Calculator aCalculator = new Calculator(); aCalculator.setVisible(true); } public Calculator() { setTitle("Simplified Calculator"); setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); setSize(WIDTH, HEIGHT); setLayout(new BorderLayout()); JPanel textPanel = new JPanel(); textPanel.setLayout(new FlowLayout()); ioField = new JTextField("Enter numbers here.", NUMBER_OF_DIGITS); ioField.setBackground(Color.WHITE); textPanel.add(ioField); add(textPanel, BorderLayout.NORTH); JPanel buttonPanel = new JPanel(); buttonPanel.setBackground(Color.BLUE); buttonPanel.setLayout(new FlowLayout()); JButton addButton = new JButton("+"); addButton.addActionListener(this); buttonPanel.add(addButton); JButton subtractButton = new JButton("-"); addButton.addActionListener(this); buttonPanel.add(subtractButton); JButton resetButton = new JButton("Reset"); resetButton.addActionListener(this); buttonPanel.add(resetButton); add(buttonPanel, BorderLayout.CENTER); } public void actionPerformed(ActionEvent e) { try { assumingCorrectNumberFormats(e); } catch (NumberFormatException e2) { ioField.setText("Error: Reenter Number."); } } //Throws NumberFormatException. public void assumingCorrectNumberFormats(ActionEvent e) { String actionCommand = e.getActionCommand(); if (actionCommand.equals("+")) { result = result + stringToDouble(ioField.getText()); ioField.setText(Double.toString(result)); } else if (actionCommand.equals("-")) { result = …
downvote count: 0
score: 1
possible better answer: http://stackoverflow.com/a/22740618
favorite count: 0
type: Question
has title: Java Swing simple calculator not adding correctly
answer count: 2
tagged with: swing
has answer: http://stackoverflow.com/a/22740427

http://stackoverflow.com/a/22776231
has comment: http://stackoverflow.com/comment/34725316
has body: My project file structure is like this: "Project/src/defaultpackage/classfiles" "Project/resources/Images/imagefiles" When you use getClass().getResourceAsStream(), the program will start it's search from the location of the calling class. So by passing "resource/Images/alphabet.png", you're saying that resources is in classfiles, which it isn't. To fix it, you need to allow the search to be traversed back. You can do that by adding a / to the path. So getClass().getResourceAsStream("/resource/Images/alphabet.png") Another option is to use the the class loader, which will search from the the root. In that case, you don't need the extra / and your current path would be correct. getClass().getClassLoader().getResourceAsStream("resource/Images/alphabet.png"); Note: getClass() and ImageLoader.class are interchangeable in most cases, in case you're wondering why I used getClass() UPDATE Use this example as a test import java.awt.Image; import java.io.*; import javax.imageio.ImageIO; import javax.swing.*; public class ImageLoader { public static void main(String[] args) throws IOException { InputStream is = ImageLoader.class.getResourceAsStream("/resource/images/alphabet.png"); Image image = ImageIO.read(is); JLabel label = new JLabel(new ImageIcon(image)); JOptionPane.showMessageDialog(null, label); } } UPDATE 2 I just noticed that resource is not in your src which it should be, so when it's built, it gets built into the class path. UPDATE 3 If you want to get a list of all the file names, you can use this method. Then you can do whatever you want with those file names. private String[] getFileNames() throws URISyntaxException { URL url = getClass().getResource("/resources/images/"); File file = new File(url.toURI()); String[] fileNames = file.list(); for (String s : fileNames) { System.out.println(s); } return fileNames; }
has comment: http://stackoverflow.com/comment/34727140
has comment: http://stackoverflow.com/comment/34724974
score: 4
has comment: http://stackoverflow.com/comment/34726634
has comment: http://stackoverflow.com/comment/34725057
has comment: http://stackoverflow.com/comment/34725100
accepted answer of: http://stackoverflow.com/q/22776177
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/34724981
answers question: http://stackoverflow.com/q/22776177
has comment: http://stackoverflow.com/comment/34725144
has comment: http://stackoverflow.com/comment/34726515
type: Answer
has comment: http://stackoverflow.com/comment/34726194
has comment: http://stackoverflow.com/comment/52439132
upvote count: 4
has comment: http://stackoverflow.com/comment/34726581
downvote count: 0
has comment: http://stackoverflow.com/comment/34727065
has comment: http://stackoverflow.com/comment/34726704
has comment: http://stackoverflow.com/comment/34726218

http://stackoverflow.com/comment/34726816
has text: In order to initialize each element of the Class2 array, iterate over it with a for loop. Each element (Example QR[0]) is a Class2 Object, so iterate over it and set each one to a new Class2 .
comment on: http://stackoverflow.com/a/22777305
type: Comment
score: 0
type: AnswerComment

http://stackoverflow.com/a/22808112
has comment: http://stackoverflow.com/comment/34783721
has comment: http://stackoverflow.com/comment/34784369
type: Answer
has body: Java 8 introduces the possibility to cast an object to an intersection of types by adding multiple bounds. In the case of serialization, it is therefore possible to write: Runnable r = (Runnable &amp; Serializable)() -&gt; System.out.println("Serializable!"); And the lambda automagically becomes serializable.
has comment: http://stackoverflow.com/comment/53886783
has comment: http://stackoverflow.com/comment/97833786
has comment: http://stackoverflow.com/comment/100651331
upvote count: 303
has comment: http://stackoverflow.com/comment/34937923
has comment: http://stackoverflow.com/comment/53889355
has comment: http://stackoverflow.com/comment/53015197
has comment: http://stackoverflow.com/comment/101800025
has comment: http://stackoverflow.com/comment/34963075
score: 303
accepted answer of: http://stackoverflow.com/q/22807912
has comment: http://stackoverflow.com/comment/65848552
answers question: http://stackoverflow.com/q/22807912
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/73254779
has comment: http://stackoverflow.com/comment/34801141

http://stackoverflow.com/comment/34822378
type: Comment
type: QuestionComment
has text: Done, now that we have the legality section handled, I hope someone can help with my question
comment on: http://stackoverflow.com/q/22803268
score: 0

http://stackoverflow.com/a/22744413
upvote count: 1
has body: If you need only integer part you can use System.out.print((int) cell.getNumericCellValue() + " ")
score: 1
has comment: http://stackoverflow.com/comment/34667605
downvote count: 0
answers question: http://stackoverflow.com/q/22744104
has comment: http://stackoverflow.com/comment/34667462
type: Answer
has comment: http://stackoverflow.com/comment/34667375
has comment: http://stackoverflow.com/comment/34670988

http://stackoverflow.com/a/22662402
type: Answer
accepted answer of: http://stackoverflow.com/q/22662241
answers question: http://stackoverflow.com/q/22662241
has comment: http://stackoverflow.com/comment/34520645
score: 0
type: AcceptedAnswer
has body: Think about why you're expecting u.getUsername() to be non-null. First, you're creating a user instance: User u = new User(); Then assigning some values to some local username and password variables: String username; String password; System.out.println("Enter Username: "); username = input.next(); System.out.println("Enter Password: "); password = input.next(); Then you're calling a login method which only accepts that username and password: DatabaseController dc = new DatabaseController(); dc.login(username, password); Finally, you're printing out this message: System.out.print("Logged in with "+ u.getUsername()+ " and " +u.getPassword()); At this point, u is just a newly-instantiated object - you haven't assigned any values to it, or done any work with it - there's no reason for the getUsername and getPassword methods to return anything but null. Perhaps you want your login method to return a User instance instead of returning a bool?

http://stackoverflow.com/q/22732011
downvote count: 0
favorite count: 0
has comment: http://stackoverflow.com/comment/34645393
has body: I am trying to access a VM from an RMI client in my machine using VM DNS NAME and port 1099 after setting an endpoint with this port but I get a refused to connect to the VM. How can I tackle this problem? this is the error I got D:\Dropbox\client\xxxxxxx>java -Djava.rmi.server.hostname=xx.xx.xx.xx -cp . client java.rmi.ConnectException: Connection refused to host: xx.xx.xx.xx; nested exception is: java.net.ConnectException: Connection timed out: connect at sun.rmi.transport.tcp.TCPEndpoint.newSocket(Unknown Source) at sun.rmi.transport.tcp.TCPChannel.createConnection(Unknown Source) at sun.rmi.transport.tcp.TCPChannel.newConnection(Unknown Source) at sun.rmi.server.UnicastRef.invoke(Unknown Source) at HelloImpl_Stub.getHelloMessage(Unknown Source) at client.main(client.java:18) Caused by: java.net.ConnectException: Connection timed out: connect at java.net.DualStackPlainSocketImpl.connect0(Native Method) at java.net.DualStackPlainSocketImpl.socketConnect(Unknown Source) at java.net.AbstractPlainSocketImpl.doConnect(Unknown Source) at java.net.AbstractPlainSocketImpl.connectToAddress(Unknown Source) at java.net.AbstractPlainSocketImpl.connect(Unknown Source) at java.net.PlainSocketImpl.connect(Unknown Source) at java.net.SocksSocketImpl.connect(Unknown Source) at java.net.Socket.connect(Unknown Source) at java.net.Socket.connect(Unknown Source) at java.net.Socket.(Unknown Source) at java.net.Socket.(Unknown Source) at sun.rmi.transport.proxy.RMIDirectSocketFactory.createSocket(Unknown Source) at sun.rmi.transport.proxy.RMIMasterSocketFactory.createSocket(Unknown Source) ... 6 more
type: UnansweredQuestion
answer count: 0
score: 1
tagged with: rmi
tagged with: java
upvote count: 1
type: Question
has title: Connecting to Azure VM using RMI

http://stackoverflow.com/comment/34572058
score: 0
type: QuestionComment
has text: Its not working using LAN cable also.
type: Comment
comment on: http://stackoverflow.com/q/22655615

http://stackoverflow.com/comment/34611186
type: QuestionComment
has text: The dimensions of an array must not exceed the number of array dimensions supported by the implementation which is typically 255.
score: 0
comment on: http://stackoverflow.com/q/22713069
type: Comment

http://stackoverflow.com/comment/34708083
score: 0
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/22753260
has text: you are right, sorry for that mistake ;)I used this implementation because there is also a number(n) witch maps to every character, I used array index to be that number(also it's fixed)

http://stackoverflow.com/a/22710948
score: 4
has body: Your else statements need braces too, you forgot a return statement for the innermost if, and you misspelled yearr in one location: boolean leapyear(int year) { if (year % 4==0) { if (year % 100 == 0) { if (year % 400 == 0) { return true; } else { return false; } } else { return true; } } else { return false; } } Java doesn't need the indentation like Python does, but it'd help make your branching structure more readable if you did use it anyway: boolean leapyear(int year) { if (year % 4 == 0) { if (year % 100 == 0) { if (year % 400 == 0) { return true; } else { return false; } } else { return true; } } else { return false; } } You don't need as many return statements here, the year % 400 == 0 already evaluates to a boolean: boolean leapyear(int year) { if (year % 4 == 0) { if (year % 100 == 0) { return year % 400 == 0; } else { return true; } } else { return false; } } or as a one-liner: boolean leapyear(int year) { return year % 4 == 0 &amp;&amp; (year % 100 != 0 || year % 400 == 0); } For completeness sake, here is the Python version the way I would write it: def leapyear(year): return year % 4 == 0 and (year % 100 != 0 or year % 400 == 0) or better still, use calendar.isleap() instead.
upvote count: 4
downvote count: 0
has comment: http://stackoverflow.com/comment/34607296
answers question: http://stackoverflow.com/q/22710921
type: Answer
has comment: http://stackoverflow.com/comment/34608815
has comment: http://stackoverflow.com/comment/34608661
has comment: http://stackoverflow.com/comment/34607188
has comment: http://stackoverflow.com/comment/34607189
has comment: http://stackoverflow.com/comment/34608769

http://stackoverflow.com/comment/34625523
comment on: http://stackoverflow.com/a/22720548
type: Comment
has text: Sotirios, I tried hasItem, but got a compiler error: The method assertThat(T, Matcher<? super T>) in the type Assert is not applicable for the arguments (Collection<Item>, Matcher<Iterable<? super Object>>)
score: 0
type: AnswerComment

http://stackoverflow.com/a/22704106
accepted answer of: http://stackoverflow.com/q/22704034
type: Answer
score: 2
upvote count: 2
answers question: http://stackoverflow.com/q/22704034
has body: byte[] array = System.Text.Encoding.UTF8.GetBytes(new string(chars));
type: AcceptedAnswer
downvote count: 0

http://stackoverflow.com/comment/34781291
score: 0
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/22807698
has text: Can you try to comment out "currentLine = sc.nextLine();"? And see if it works.

http://stackoverflow.com/a/46299615
type: Answer
has body: I know it is a little bit late, but still wanted to answer in case someone may also face this problem: have you considered to try fetch types like lazy and eager? With these you may get all the fields that are just marked as "eager" directly, "lazy" fields are fetched
score: 0
answers question: http://stackoverflow.com/q/22754534

http://stackoverflow.com/comment/34505907
comment on: http://stackoverflow.com/a/22654472
type: AnswerComment
has text: Thank you, here I don't have POJO classes
score: 0
type: Comment

http://stackoverflow.com/q/22798873
type: UnansweredQuestion
tagged with: multithreading
has answer: http://stackoverflow.com/a/22799018
tagged with: c++11
tagged with: c++
score: 3
tagged with: java
has answer: http://stackoverflow.com/a/22798974
has comment: http://stackoverflow.com/comment/34767224
type: Question
linked to: http://stackoverflow.com/q/6319146
has body: I know in Java visibility of a member is not guaranteed when accessing it from another thread. The meaning is the accessing thread will maybe see a stole value of the member (becuase the cache has not been flushed to main memory yet). I wonder if that is the case for C++ too? (also in C++11?) If so, how do you solve this problem in C++? (In Java, you can use the synchronized keyword).
upvote count: 3
answer count: 3
has answer: http://stackoverflow.com/a/22799343
has title: Visibility in concurrent C++ programs
tagged with: memory-visibility
favorite count: 0
has comment: http://stackoverflow.com/comment/34768725
downvote count: 0

http://stackoverflow.com/a/22919603
has comment: http://stackoverflow.com/comment/35227361
has comment: http://stackoverflow.com/comment/35309967
has comment: http://stackoverflow.com/comment/35509988
score: 0
has comment: http://stackoverflow.com/comment/35516783
answers question: http://stackoverflow.com/q/22757287
has comment: http://stackoverflow.com/comment/35449415
type: Answer
has body: I believe that you didn't activate R and typed into it: library("rJava") , try this for a start, if this does not work, then please attach your java code, and ill try to find other solutions.

http://stackoverflow.com/comment/34514838
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/22657007
has text: Just because there are 4 layers involved in the *real* code doesn't mean that there have to be 4 layers involved to reproduce the problem. Part of your job in diagnosing the issue is to isolate it as far as possible.

http://stackoverflow.com/q/22756081
possible better answer: http://stackoverflow.com/a/22756284
accepted answer: http://stackoverflow.com/a/22756189
has answer: http://stackoverflow.com/a/22757010
has answer: http://stackoverflow.com/a/22756189
upvote count: 1
has comment: http://stackoverflow.com/comment/34688867
tagged with: try-catch
type: AnsweredQuestion
score: 1
has answer: http://stackoverflow.com/a/22756284
tagged with: java
has title: Try Throw Catch in Java
type: Question
downvote count: 0
linked to: http://stackoverflow.com/q/528417
favorite count: 0
has body: I'm working on a Sudoku solver in Java as a fun introduction to the language. One of the things I'm having my code do is check if the puzzle is solvable before it tries to solve it. I thought it would be a good idea to use try{} catch{} for this but I cannot get the code to compile. public class SudokuSolver2 { public static void main(String[] args) { // 9x9 integer array with currentPuzzle // check current puzzle and make sure it is a legal puzzle, else throw "illegal puzzle" error try { // 1) check each row and make sure there is only 1 number per row // 2) check each column and make sure there is only 1 number per column // 3) check each square and make sure there is only 1 number per square throw new illegalPuzzle(""); } catch ( illegalPuzzle(String e) ) { System.out.println("Illegal puzzle."); System.exit(1); } } } public class illegalPuzzle extends Exception { public illegalPuzzle(String message) { super(message); } } Couple of questions... Why won't the code compile in its current form? Is there a way to write the code so that I do not have to use a "String message" parameter? All the examples I looked at use a string parameter but I don't really want it or need it. Is there a way to write the code so that I do not have to create my own custom exception class? In other words, can I just throw a general error? All the examples I looked at created their own custom exception but I don't need that level of detail. Thanks!
answer count: 3

http://stackoverflow.com/comment/34648125
comment on: http://stackoverflow.com/a/22733515
score: 0
type: Comment
has text: @RyanHosford yes, that is the problem, please see my edit and if the answer has been useful please accept it or/and upvote it :-)
type: AnswerComment

http://stackoverflow.com/comment/34745279
type: Comment
comment on: http://stackoverflow.com/a/22785104
score: 0
type: AnswerComment
has text: This was a good direction but - i check the last access time on dir **A** before and after the actual code execution and it doesn't change. I thinks it's because when i do have users i create the following structure in my test setup **A/User/Uploads** and then in the tested code doing `A.resolve("User/Uploads")` doesn't effect the access time on **A**. I guess there is no real justification in my test to dig dipper. But thank you for all the points you raised - I think I learned some new things

http://stackoverflow.com/q/22792806
score: 2
downvote count: 0
type: UnansweredQuestion
tagged with: code-duplication
has title: Better way to create Android content providers
type: Question
tagged with: android-contentprovider
has comment: http://stackoverflow.com/comment/37373373
tagged with: refactoring
tagged with: java
upvote count: 2
answer count: 1
favorite count: 0
has answer: http://stackoverflow.com/a/22793501
tagged with: android
has body: I have a content provider in my app and I really don't like it :-). The provider is created after reading number of articles like the official one and this unofficial one. What I really don't like is the amount of duplication in the provider class (see very stripped down code below). Even for two (or four, it depends on how you count) content types there is too much code. I thought about going the other route: raw SQL queries in the content provider but not sure if this will turn out to be more elegant. Please advise a better way to create Android content providers then the one in the code below. public abstract class BaseProvider extends ContentProvider { protected DatabaseHelper m_helper; protected static class DatabaseHelper extends SQLiteOpenHelper { private static final String DATABASE_NAME = "my.db"; private static final int DATABASE_VERSION = 4; public DatabaseHelper(Context context) { super(context, DATABASE_NAME, null, DATABASE_VERSION); } @Override public void onCreate(SQLiteDatabase db) { FolderTable.onCreate(db); TrackTable.onCreate(db); } @Override public void onUpgrade(SQLiteDatabase db, int oldVersion, int newVersion) { FolderTable.onUpgrade(db, oldVersion, newVersion); TrackTable.onUpgrade(db, oldVersion, newVersion); } } @Override public boolean onCreate() { m_helper = new DatabaseHelper(getContext()); return true; } // ... } public class MyProvider extends BaseProvider { private static final UriMatcher sURIMatcher = new UriMatcher(UriMatcher.NO_MATCH); private static final int FOLDERS = 10; private static final int FOLDER_ID = 20; private static final int TRACKS = 30; private static final int TRACK_ID = 40; private static final String FOLDERS_BASE_PATH = "folders"; private static final String TRACKS_BASE_PATH = "tracks"; public static final String AUTHORITY = ".contentprovider.MyProvider"; private static final String CONTENT_URI_BASE = "content://" + AUTHORITY + "/"; public static final Uri FOLDERS_CONTENT_URI = Uri.parse(CONTENT_URI_BASE + FOLDERS…

http://stackoverflow.com/comment/34693687
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/22758715
has text: @DanglingPiyush: I don't see what the number of classes has to do with it at all, perhaps a code example demonstrating the problem would help.
score: 0

http://stackoverflow.com/q/22685596
score: 0
answer count: 2
has answer: http://stackoverflow.com/a/22685751
has body: Im passing Serializable objects between activities, but seems that somehow im loosing some of them. Here is what I do: I parse the objects from json and all is good when I check them. After parsing I pass them to another activity by doing this: Intent intent = new Intent(Splash.this, Main.class); intent.putExtra(Constants.MAIN_ARR_OBJ, mainObjs); startActivity(intent); finish(); Now in my second activity I put them in a list, and onItemClick I want to send the object coresponding to the position clicked to another activity by doing: Intent intent = new Intent(Main.this, Second.class); Log.v("--", mainObjects.get(position).getAddi_info().getTasks() .size() + " TASKS SIZE IN MAIN toward second "); intent.putExtra(Constants.ADDI_INFO_OBJ, mainObjects.get(position).getAddi_info()); startActivity(intent); And as you see I do a check using Log.v... but that gives me size of 0 - that means there is no objects in the arrayList. In the second activity I get extras by doing mainObjects = (ArrayList&lt;MainScreenObject&gt;) getIntent() .getSerializableExtra(Constants.MAIN_ARR_OBJ); EDIT: In the second activity I get the main object, but that object holds an arrayList of objects, those objects are missing. Anyone got a clue what can the problem be?
has answer: http://stackoverflow.com/a/22707296
tagged with: android
has title: Losing objects between activities
tagged with: android-activity
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/34561220
has comment: http://stackoverflow.com/comment/34561000
tagged with: java
type: Question

http://stackoverflow.com/q/22769023
tagged with: mat
has comment: http://stackoverflow.com/comment/34711900
answer count: 1
has answer: http://stackoverflow.com/a/22775360
score: 0
tagged with: android
has title: JNI Mat to Java Mat
has comment: http://stackoverflow.com/comment/34712010
has body: I am trying to return a Mat object from my C++ source-code to my Java code. I have the following code: C++: JNIEXPORT void JNICALL *snip*_MainActivity_grabResult (jlong matPtr) { LOGD("The resultsImg has %d rows.", resultsImg.rows); LOGD("The sceneImg has %d rows.", sceneImg.rows); Mat* mat = new Mat(resultsImg.rows, resultsImg.cols, CV_8UC3); mat = (Mat*) matPtr; LOGD("Mat resultsImg is: %d", resultsImg.rows); LOGD("Mat* mat is %d", mat-&gt;rows); } Java: public static native void grabResult(long add); grabResult(m.getNativeObjAddr()); However, it doesn't seem to pass through the Mat to my Java as the row sizes of the Mat in Java is zero, where as in the C++ code its a ridiculous number, a number it should not be. Any assistance would be great.
type: UnansweredQuestion
tagged with: android-ndk
type: Question
tagged with: opencv
tagged with: java

http://stackoverflow.com/q/22656819
accepted answer: http://stackoverflow.com/a/22656957
upvote count: 3
answer count: 2
has title: How do I refactor my model?
has answer: http://stackoverflow.com/a/22656959
favorite count: 0
possible better answer: http://stackoverflow.com/a/22656959
type: AnsweredQuestion
tagged with: oop
downvote count: 0
has body: I have object model, which describes an instructions for worker: go to location get an item go to another location pick another item ........ finish job In my app I need a list of this instructions to guide worker in his job. The types of instructions are very different, that's why data which is required to describe instruction can be different. For changing location I just need the location id, but for getting item I also need an item id, quantity and item name, alongside with location id. So my model looks like that: public class Instruction{ int locationId; int itemId; String itemName; String quanity; Type itemType; // can be Type.GET_ITEM, Type.CHANGE_LOCATION etc. } So I have the situation where I describe different entities with one model. Should I live with that, or there's a way to eliminate duplication? What I want is to keep the ability to store all instructions in a list, but to make models more clean.
tagged with: java
type: Question
score: 3
has comment: http://stackoverflow.com/comment/34510126
has answer: http://stackoverflow.com/a/22656957

http://stackoverflow.com/a/22747091
has comment: http://stackoverflow.com/comment/34672119
upvote count: 1
type: AcceptedAnswer
answers question: http://stackoverflow.com/q/22746846
accepted answer of: http://stackoverflow.com/q/22746846
type: Answer
has body: Setup the listener OnTabChangeListener with setOnTabChangedListener in your TabHost, and inside TabHost.OnTabChangeListener add your code block. Something like this: tabHost.setOnTabChangedListener(new TabHost.OnTabChangeListener() { @Override public void onTabChanged(String tabId) { InputMethodManager imm = (InputMethodManager) getSystemService( Context.INPUT_METHOD_SERVICE); imm.hideSoftInputFromWindow(myEditText.getWindowToken(), 0); } }); You can use ActionBar to create tabs anyway An example: ActionBar actionBar = getActionBar(); actionBar.addTab(actionBar.newTab().setText("Your Tab").setTabListener(new ActionBar.TabListener() { @Override public void onTabSelected(ActionBar.Tab tab, FragmentTransaction ft) { InputMethodManager imm = (InputMethodManager)getSystemService( Context.INPUT_METHOD_SERVICE); imm.hideSoftInputFromWindow(myEditText.getWindowToken(), 0); } @Override public void onTabUnselected(ActionBar.Tab tab, FragmentTransaction ft) { } @Override public void onTabReselected(ActionBar.Tab tab, FragmentTransaction ft) { } })); .addTab() .newTab() .setTabListener()
downvote count: 0
score: 1
has comment: http://stackoverflow.com/comment/34672396
has comment: http://stackoverflow.com/comment/34672458

http://stackoverflow.com/q/22700786
has comment: http://stackoverflow.com/comment/34589601
type: Question
tagged with: java
has comment: http://stackoverflow.com/comment/34589629
has title: Throw exception or return a crazy value when input is bad, but might be common?
tagged with: null
tagged with: exception
has body: I have a class that analyzes and interprets GPS strings. The incoming strings are formatted in a very specific way (15 comma separated strings/values). Right now, if I receive a string that is not expected (like if it doesn't have 14 commas), I am throwing an IllegalArgumentException. This is for the cases when the incoming string is truly broken and this event should rarely, if ever happen. However, if my GPS unit has not connected to the satellite yet, I will receive blank values between the commas. How can I return something that tells the user "The GPS isn't turned on yet," without returning Null? In my particular case, returning Null is something that is already needed. I thought of returning some insane value that can be checked against, but this seems like really sloppy program design to me. What would a good method for a situation like this be?
answer count: 0
score: 0
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/34589358

http://stackoverflow.com/a/22671043
score: 4
answers question: http://stackoverflow.com/q/22668374
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/22668374
has comment: http://stackoverflow.com/comment/114063703
type: Answer
upvote count: 4
downvote count: 0
has body: There seems to be a way to configure ObjectMapper to ignore all non annotated fields. ObjectMapper mapper = new ObjectMapper(); mapper.setVisibilityChecker(getSerializationConfig().getDefaultVisibilityChecker() .withCreatorVisibility(JsonAutoDetect.Visibility.NONE) .withFieldVisibility(JsonAutoDetect.Visibility.NONE) .withGetterVisibility(JsonAutoDetect.Visibility.NONE) .withIsGetterVisibility(JsonAutoDetect.Visibility.NONE) .withSetterVisibility(JsonAutoDetect.Visibility.NONE)); Source

http://stackoverflow.com/comment/35002869
score: 0
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/22796629
has text: I get the error 'processDocument2(java.io.FileOutputStream)' on java class 'AZGPackage.writeXWPFDocument' not found at com.ibm.jscript.types.JavaAccessObject.call(JavaAccessObject.java:360). I call the code from the postGenerationProcess event using var temp = java.lang.System.getProperty("java.io.tmpdir"); var file = new java.io.File(temp + "YourFile.docx"); var fileOutputStream = new java.io.FileOutputStream(file); var jce:writeXWPFDocument = new writeXWPFDocument(); jce.processDocument2(xwpfdocument,fileOutputStream); The method processDocument2 is contained in the java class below.

http://stackoverflow.com/a/22802563
accepted answer of: http://stackoverflow.com/q/22783803
type: AcceptedAnswer
answers question: http://stackoverflow.com/q/22783803
score: 0
type: Answer
has comment: http://stackoverflow.com/comment/66225595
has body: I know where my problem is, I should make servlet for /_ah/start first.

http://stackoverflow.com/q/22720136
accepted answer: http://stackoverflow.com/a/22721650
tagged with: cygwin
has body: I have followed a tutorial on how to embed pig commands on java. I have installed cygwin and I did all the required setup. I have embedded the program in netbeans and called it idlocal1. The problem that I have is on cygwin. Basically when I typed (on cygwin) javac -cp pig.jar idlocal1.java in order to compile the program, I got the following message: javac -cp pig.jar idlocal1.java javac: file not found: idlocal1.java Usage: javac &lt;options&gt; &lt;source files&gt; use -help for a list of possible options Can you please tell me where is the problem?
answer count: 1
downvote count: 0
favorite count: 0
tagged with: javac
has answer: http://stackoverflow.com/a/22721650
has title: javac: file not found (cygwin error)
type: AnsweredQuestion
tagged with: apache-pig
score: 1
tagged with: java
upvote count: 1
type: Question

http://stackoverflow.com/comment/34546715
type: Comment
comment on: http://stackoverflow.com/a/22676935
has text: I can't remove that constructor though. My instructor had me set it up that way when I was working with him, so it's a part of my assignment.
score: 0
type: AnswerComment

http://stackoverflow.com/comment/34680148
comment on: http://stackoverflow.com/q/22735446
type: Comment
type: QuestionComment
has text: @JasonC read the edit
score: 0

http://stackoverflow.com/a/22777401
has body: If you are creating criteria on CashToOrder, please reach out to cash from that class for alias. i.e. cashToOrder.cash Criteria criteria = session.createCriteria(CashToOrderItem.class, "cashToOrder"); criteria.createAlias("cashToOrder.cash","c1");
answers question: http://stackoverflow.com/q/22776803
score: 0
type: Answer

http://stackoverflow.com/a/22800442
has comment: http://stackoverflow.com/comment/35106154
answers question: http://stackoverflow.com/q/22798767
has body: The Realtime API is currently only available in javascript.
score: 0
type: Answer

http://stackoverflow.com/q/22798002
has comment: http://stackoverflow.com/comment/34764182
downvote count: 1
tagged with: java
has title: NullPointerException when trying to run PostFixCalculator in Java
type: Question
answer count: 2
has answer: http://stackoverflow.com/a/22798118
favorite count: 0
has answer: http://stackoverflow.com/a/22800439
tagged with: dictionary
has body: I have gotten my code to work to the extent that it can compile and run but now I get exceptions at two different places as follows: Exception in thread "main" java.lang.NullPointerException at PostFixCalculator.storeOperand(PostFixCalculator.java:97) at CalcTest.main(CalcTest.java:17) ...I am not sure at all what is wrong. The first error is in the code that follows at myStack.push(operand); But I am so lost as to where to go from here... import java.util.*; public class PostFixCalculator { private DoubleStack&lt;Double&gt; myStack; private ArrayList&lt;Double&gt; evalList; //private Map&lt;String, Operator&gt; operatorMap; Map&lt;String, Operator&gt; operatorMap = new HashMap&lt;String, Operator&gt;(); public PostFixCalculator () { Map&lt;String, Operator&gt; operatorMap = new HashMap&lt;String, Operator&gt;(); operatorMap.put("+", new AddOp()); operatorMap.put("add", new AddOp()); operatorMap.put("-", new SubOp()); operatorMap.put("sub", new SubOp()); operatorMap.put("/", new DivOp()); operatorMap.put("div", new DivOp()); operatorMap.put("*", new MultOp()); operatorMap.put("mult", new MultOp()); operatorMap.put("=", new PrintOp()); operatorMap.put("print", new PrintOp()); } public class AddOp implements Operator { public AddOp () { } public int numArgs () { return 2; } public double eval (List&lt;Double&gt; args) { double a = args.get(0); double b = args.get(1); double sum = a + b; return sum; } } public class SubOp implements Operator { public SubOp () { } public int numArgs () { return 2; } public double eval (List&lt;Double&gt; args) { double a = args.get(0); double b = args.get(1); double difference = a - b; return difference; } } public class DivOp implements Operator { public DivOp () { } public int numArgs () { return 2; } public double eval (List&lt;Double&gt; args) { double a = args.get(0); double b = args.get(1); double quotient = a / b; return quotient; } } public class MultOp implements Operator { public MultOp () { } public int numArgs () { return 2;…
tagged with: list
tagged with: compiler-errors
type: UnansweredQuestion
score: 0
upvote count: 1

http://stackoverflow.com/comment/34599090
comment on: http://stackoverflow.com/q/22705710
type: QuestionComment
type: Comment
has text: IMHO service returns something I would say some data or does something. It's not supposed to provide visible representation.
score: 0

http://stackoverflow.com/q/22710228
tagged with: arrays
has title: Producer - Consumer Model; Storing Buffer Entry and Exit Times
possible better answer: http://stackoverflow.com/a/24850619
has answer: http://stackoverflow.com/a/24850619
score: 0
has body: I am currently trying to solve a problem based around the producer - consumer model in relation to concurrent programming. I have a bounded buffer, storing integer values that enter and leave the buffer in a first in - first out manner. What I want to do is randomize an amount of time that each object stays in the buffer, after which it will be flagged to the consumer that it is time to collect this object from the buffer. My idea so far is as follows: at the producer end, an int is assigned for each value. As well as this int (used to identify the object) a date stamp would be created to store the time the object is put into the buffer whilst in the buffer, a random 'stay' time will be generated and added to this start time to create an exit time the consumer class will then search for firstly items in the buffer, and then for items that have reached their exit time, before removing that object from the buffer, using the int produced to identify which element has been removed Is there any way to do this with one Array? Should I be looking at parallel arrays, one for storing the integer that identifies each element, and a parallel index to store the entrance time? In this last case I would then use 2 put methods in the buffer to assign the 'time stamp' to a parallel index in the second array.
has comment: http://stackoverflow.com/comment/34623365
accepted answer: http://stackoverflow.com/a/22720270
type: AnsweredQuestion
tagged with: java
tagged with: concurrency
type: Question
answer count: 2
has answer: http://stackoverflow.com/a/22720270

http://stackoverflow.com/comment/34687952
comment on: http://stackoverflow.com/a/22755669
type: AnswerComment
has text: please relate to session-persistence and application-lifetime presistence
score: 0
type: Comment

http://stackoverflow.com/q/22716440
upvote count: 1
type: Question
tagged with: jakarta-ee
has body: I am having a jsp page on which am trying to show a button depending on my variable flag. If flag=0 then i want to have a submit ADD button but if flag is set to 1 then i want to have a disabled REQUEST SEND button and other button should not be shown while other is been shown. Here is my jsp code part : &lt;% String groupidd = request.getSession().getAttribute("groupid").toString(); s=null; rs=null; int flag=0; String sql="select * from TBGROUPUSERS where I_ID=? and GU_GROUPID=?"; s = con.prepareStatement(sql); s.setString(1,idperson); s.setString(2,groupidd); rs=s.executeQuery(); if(rs.next()) flag=1; %&gt; Now based on this flag value how i can do this ?
has answer: http://stackoverflow.com/a/22716624
answer count: 2
tagged with: jstl
downvote count: 0
tagged with: jsp
favorite count: 0
has title: Showing button based on data value
has answer: http://stackoverflow.com/a/22716722
accepted answer: http://stackoverflow.com/a/22716624
linked to: http://stackoverflow.com/q/3177733
possible better answer: http://stackoverflow.com/a/22716722
type: AnsweredQuestion
score: 1
tagged with: java

http://stackoverflow.com/comment/34772700
score: 0
has text: It is always a bad idea to make intensive computation, such as inserting or retrieving data from a database, on the main thread. I recommend you use an `AsyncTask` to get the work done! The Logcat entry even tells you that you shouldn't do that! ;)
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/22802883

http://stackoverflow.com/comment/34603364
type: AnswerComment
score: 0
comment on: http://stackoverflow.com/a/22708619
type: Comment
has text: Thanks for the code, But I want two user input with the help of read() method only. May I take two user inputs using console with the help of read() method. Kindly suggest.

http://stackoverflow.com/comment/34680470
score: 1
comment on: http://stackoverflow.com/q/22751514
has text: I answered this at http://stackoverflow.com/questions/20181887/java-string-variable-using-next-or-nextline - it's for `nextInt()`, but `nextDouble()` works the same way.
type: Comment
type: QuestionComment

http://stackoverflow.com/q/22752454
has comment: http://stackoverflow.com/comment/34683305
downvote count: 2
has comment: http://stackoverflow.com/comment/34683082
has title: NullPointerException when reading a file
has comment: http://stackoverflow.com/comment/34683078
has body: When I load this file, I always get the NullPointerException. I try many thing and I could not find a way to fix it. When I saved I used the Game object. @Override public void load(Superhero aHero,Villain aVillain) throws IOException, ClassNotFoundException { ObjectInputStream ois = null; FileInputStream fis = null; File f = new File("C:\\prog24178\\dcgames.dat"); Game aGame = new Game(aHero,aVillain); try { fis = new FileInputStream(f); ois = new ObjectInputStream(fis); while(true){ aGame = (Game) ois.readObject(); System.out.println(aGame); } } catch(EOFException eof){ ois.close(); } catch (FileNotFoundException ex) { Logger.getLogger(DcGameController.class.getName()).log(Level.SEVERE, null, ex); } } When I open the file I see something like that: ¬í sr model.Game ^r Z gameOverZ heroTurnL theHerot Lmodel/Superhero;L theVillaint Lmodel/Villain;xp sr model.hero.Batman ^r Z armedL sidekickq ~ xr model.Superhero ^r I energyZ secretIdentityL codenamet Ljava/lang/String;L hometownq ~ xr model.Avatar ^r I agilityI enduranceI fightingI hitPointsI intuitionI psycheI reasonI strengthL firstNameq ~ L lastNameq ~ xp W t q ~ t Batmant Gotham Citysq ~ t Dickt Grayson ppsr model.villain.Cheetah ^r xr model.Villain ^r I energyZ insaneL codenameq ~ xq ~ b t Priscillat Rich t Cheetah So I know it's working but I would like to read and after that I could set the setting I need to use. That's my save method : @Override public void saveGame(Game aGame) { File aSaveFile = new File("C:\\prog24178\\dcgames.dat"); FileOutputStream fos = null; if (!aSaveFile.getParentFile().exists()) { aSaveFile.getParentFile().mkdir(); } try { if (!aSaveFile.exists()) { aSaveFile.createNewFile(); } if (aSaveFile.length() &gt; 0) { fos = new FileOutputStream(aSaveFile, true); } else { fos = new FileOutputStream(aSaveFile, false); } if (oos == null) { oos = new ObjectOutputStream(fos); } oos.writeObject(aGame); } catch (FileNotFoundException ex) { } catch (Exception x) { System.out.println("Something bad ha…
has comment: http://stackoverflow.com/comment/34681966
type: AnsweredQuestion
tagged with: java
has answer: http://stackoverflow.com/a/22753447
type: Question
linked to: http://stackoverflow.com/q/218384
has comment: http://stackoverflow.com/comment/34683285
upvote count: 0
score: -2
answer count: 1
accepted answer: http://stackoverflow.com/a/22753447
favorite count: 0

http://stackoverflow.com/a/22652047
type: Answer
has body: How about logging to files instead of to the console? If you use a RollingFileAppender you can configure log4j to create a new file every hour or every 10 minutes. Using the RoutingAppender you should be able to create a new file for very build (see the log4j2 FAQ page for an example).
answers question: http://stackoverflow.com/q/22648305
has comment: http://stackoverflow.com/comment/34543286
score: 0
has comment: http://stackoverflow.com/comment/34534823

http://stackoverflow.com/comment/34899005
type: QuestionComment
type: Comment
has text: It shouldn't be surprising, since you can do `new Main().meh(42)`
score: 0
comment on: http://stackoverflow.com/q/22663112

http://stackoverflow.com/a/22857678
type: AcceptedAnswer
type: Answer
has body: We were using elasticsearch 0.90.12 and the java library was 0.90.6. Since we updated the java library to 0.90.12 all the problem disappeared.
answers question: http://stackoverflow.com/q/22665973
score: 0
accepted answer of: http://stackoverflow.com/q/22665973

http://stackoverflow.com/q/22672103
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/34537659
tagged with: java
has answer: http://stackoverflow.com/a/22674668
has title: Faster way to read from Socket with ByteBuffer?
type: Question
score: 0
answer count: 2
possible better answer: http://stackoverflow.com/a/22674668
has answer: http://stackoverflow.com/a/22672336
tagged with: bytebuffer
has comment: http://stackoverflow.com/comment/34537697
has comment: http://stackoverflow.com/comment/34539760
has comment: http://stackoverflow.com/comment/34537975
has comment: http://stackoverflow.com/comment/34537757
accepted answer: http://stackoverflow.com/a/22672336
tagged with: tcp
has comment: http://stackoverflow.com/comment/34537508
has body: I have connected by TCP to a socket which is constantly sending a large amount of data, which I need to read in. What I have so far is a byte buffer that is reading byte by byte in a while loop. But the test case I am using right now is about 3 MB, which takes a while to read when reading in byte by byte. Here is my code for this explanation: ByteBuffer buff = ByteBuffer.allocate(3200000); while(true) { int b = in.read(); if(b == -1 || buff.remaining() == 0) { break; } buff.put((byte)b); } I know that byte buffers are not thread safe and I'm not sure if this could be made faster by possibly reading in multiple bytes at a time and then storing it in the buffer? What would be a way for me to speed this process up?

http://stackoverflow.com/a/22774994
has comment: http://stackoverflow.com/comment/34724243
score: 0
has comment: http://stackoverflow.com/comment/34722976
has body: add the intergers up using long subtract the result from (N+1)*(N+2)/2 where N is the number of integers in your file. The result is your missing number Example: file contains 1,3 sum = 4 N=2, so (N+1)(N+2)/2 = (2+1)(2+2)/2 = 6 6-sum=6-4=2 2 is your missing number
answers question: http://stackoverflow.com/q/22774896
has comment: http://stackoverflow.com/comment/34722996
type: Answer
has comment: http://stackoverflow.com/comment/34724212

http://stackoverflow.com/comment/34501828
type: Comment
has text: But i dont know ther how many spans or divs or the tables because we arwe passing the url dynamically and which element having the data which we have to use also dont know , we have to read data dynamically just passsing the url ,and that page contains the huge data but we dnt want all the data from that we are passing the some search words if that words match that contains then only we read that data ...thank u for reply
comment on: http://stackoverflow.com/a/22651794
score: 0
type: AnswerComment

http://stackoverflow.com/a/22833098
score: 0
type: AcceptedAnswer
type: Answer
answers question: http://stackoverflow.com/q/22793257
accepted answer of: http://stackoverflow.com/q/22793257
has body: At the end after examining the pgrs link I went to the guys own project and examined the project.clj Turns out the repo has to be called local: :repositories {"local" "file:repo"} then you have to add the dependency: :dependencies [[org.clojure/clojure "1.4.0"] [org.clojure/tools.cli "0.2.2"] [org.clojure/java.jdbc "0.2.3"] [mylib "0.1"]] In the buildscript here is what I have: mkdir repo FILE_NAME=`ls -c ../path/to/mylib-* | head -n 1` mvn install:install-file -Dfile=$FILE_NAME -DartifactId=mylib -Dversion=0.1 -DgroupId=mylib -Dpackaging=jar -DlocalRepositoryPath=repo -DcreateChecksum=true This works on my Ubuntu 12.04 machine with java 7 (oracle) and Leiningen 1.7.1

http://stackoverflow.com/q/22691322
score: 0
type: UnansweredQuestion
tagged with: c#
tagged with: java
has answer: http://stackoverflow.com/a/46069383
has comment: http://stackoverflow.com/comment/34571811
type: Question
has comment: http://stackoverflow.com/comment/34575435
answer count: 1
has body: i have some code in java and im trying to translate to C#. My main problem at this moment its the TreeMaps... I will put some java code that i want translate, and some C# i already did but don´t know if its well done. JAVA: private TreeMap&lt;String, Node&gt; nodeMap = new TreeMap&lt;String, Node&gt;(); public double[] strategy = new double[NUM_TURNS] public int pot; (...) if (eval.isWinnerFirst(cards[0], cards[1])) { return nodeMap.get(infoSet).pot; } else { return -nodeMap.get(infoSet).pot; } (...) double[] nodeStrategy = nodeMap.get(infoSet).strategy; C# (attempt) (some quots): public Dictionary&lt;string, Node&gt; sort = new Dictionary&lt;string, Node&gt;(); public double[] strategy = new double[NUM_TURNS] public int pot; (...) if (isWinnerFirst(cards[0], cards[1])) { if (sort.ContainsKey(infoSet)) { return pot; } } else { if (sort.ContainsKey(infoSet)) { return -pot; } } (...) if (sort.ContainsKey(infoSet)) { double[] nodeStrategy = strategy;} Someone know how can i do it right? PS. I have the class Node implemented. thanks
has comment: http://stackoverflow.com/comment/34571368
has comment: http://stackoverflow.com/comment/34571817
tagged with: dictionary
has title: Java to C# (Tree / dictionary search)

http://stackoverflow.com/a/22679559
downvote count: 0
has body: The error message: "Type tutorial.model.Point is not found" specifies a Point class in a package tutorial.model. Your package name is objectdb.tutorial.model. Probably you had that package name previously, but you moved your package to a new location and name. Try to delete the database file, since it still includes the class in its previous name (or if you need the data, follow the instructions on ObjectDB website regarding schema change). If you do not have a getMetamodel method, you may have an old JPA 1.0 jar in your classpath before ObjectDB (which includes the JPA 2.1 jar). You have to fix your classpath to avoid additional issues.
type: Answer
score: 2
has comment: http://stackoverflow.com/comment/34581685
upvote count: 2
accepted answer of: http://stackoverflow.com/q/22676105
answers question: http://stackoverflow.com/q/22676105
type: AcceptedAnswer

http://stackoverflow.com/a/22695031
has comment: http://stackoverflow.com/comment/123420642
has comment: http://stackoverflow.com/comment/126954799
has comment: http://stackoverflow.com/comment/87808402
has comment: http://stackoverflow.com/comment/62353780
has comment: http://stackoverflow.com/comment/94166547
has comment: http://stackoverflow.com/comment/115239881
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/87808601
has comment: http://stackoverflow.com/comment/54625449
has comment: http://stackoverflow.com/comment/87808498
has comment: http://stackoverflow.com/comment/64861600
type: Answer
has comment: http://stackoverflow.com/comment/87808774
has comment: http://stackoverflow.com/comment/129358796
has comment: http://stackoverflow.com/comment/88040819
answers question: http://stackoverflow.com/q/22694884
upvote count: 308
has comment: http://stackoverflow.com/comment/83735723
score: 303
has comment: http://stackoverflow.com/comment/123423713
has comment: http://stackoverflow.com/comment/119813111
accepted answer of: http://stackoverflow.com/q/22694884
has comment: http://stackoverflow.com/comment/123420946
has comment: http://stackoverflow.com/comment/73294461
has body: Create a custom Collector public static <T> Collector<T, ?, T> toSingleton() { return Collectors.collectingAndThen( Collectors.toList(), list -> { if (list.size() != 1) { throw new IllegalStateException(); } return list.get(0); } ); } We use Collectors.collectingAndThen to construct our desired Collector by Collecting our objects in a List with the Collectors.toList() collector. Applying an extra finisher at the end, that returns the single element — or throws an IllegalStateException if list.size != 1. Used as: User resultUser = users.stream() .filter(user -> user.getId() > 0) .collect(toSingleton()); You can then customize this Collector as much as you want, for example give the exception as argument in the constructor, tweak it to allow two values, and more. An alternative — arguably less elegant — solution: You can use a 'workaround' that involves peek() and an AtomicInteger, but really you shouldn't be using that. What you could do instead is just collecting it in a List, like this: LinkedList<User> users = new LinkedList<>(); users.add(new User(1, "User1")); users.add(new User(2, "User2")); users.add(new User(3, "User3")); List<User> resultUserList = users.stream() .filter(user -> user.getId() == 1) .collect(Collectors.toList()); if (resultUserList.size() != 1) { throw new IllegalStateException(); } User resultUser = resultUserList.get(0);
has comment: http://stackoverflow.com/comment/88041274
has comment: http://stackoverflow.com/comment/88037463
has comment: http://stackoverflow.com/comment/125888907
downvote count: 5

http://stackoverflow.com/a/22699816
type: Answer
has comment: http://stackoverflow.com/comment/34587847
has comment: http://stackoverflow.com/comment/34587673
answers question: http://stackoverflow.com/q/22699735
score: 0
has body: If you use str.substring(startingIndex), you will have the substring to the end of the string. It seems to be what you want. If you have extra spaces at the end of the string, you can always use a str.trim() to remove the spaces.

http://stackoverflow.com/comment/34554579
has text: @DmitryTsechoev: tried that as well.. still got the same exception.
comment on: http://stackoverflow.com/q/22681831
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/a/22954723
has body: The solution to this turned out to be simple, though I had a lot of trouble getting message formatting to work correctly due to problems with my properties files. The Map I send to freemarker.template.Template.process() simply needs ResourceBundle instances in the same hierarchy used by the FTL files. E.g. Where the FTL file has this: __parameters.__resourceBundle I have a notification.properties file with my Java source, and added it to the map sent to Freemarker like this: HashMap tmplParams=new HashMap(); tmplParams.put("__resourceBundle",ResourceBundle.getBundle( "&lt;parent directory path&gt;.activities.resources.nls.notification")); root.put("__parameters",tmplParams);
type: AcceptedAnswer
type: Answer
score: 2
downvote count: 0
accepted answer of: http://stackoverflow.com/q/22799877
answers question: http://stackoverflow.com/q/22799877
upvote count: 2

http://stackoverflow.com/q/22807407
has comment: http://stackoverflow.com/comment/34781264
has answer: http://stackoverflow.com/a/22807984
accepted answer: http://stackoverflow.com/a/22827937
has body: I'm working on a Java application and ran into a problem that I cannot seem to solve on my own. I've set a DocumentFilter on JTextField to only allow digit entries, however, the default values are text. I have a button that resets JTextFields back to default, and it is not working presumingly because of the DocumentFilter. How can I overcome this problem? Thanks
has comment: http://stackoverflow.com/comment/34781531
tagged with: digit
possible better answer: http://stackoverflow.com/a/22807984
tagged with: swing
tagged with: jtextfield
linked to: http://stackoverflow.com/q/20578568
has comment: http://stackoverflow.com/comment/34781446
has comment: http://stackoverflow.com/comment/34817615
type: AnsweredQuestion
tagged with: documentfilter
has comment: http://stackoverflow.com/comment/34781090
tagged with: java
has comment: http://stackoverflow.com/comment/34781477
type: Question
score: 0
has answer: http://stackoverflow.com/a/22827937
has comment: http://stackoverflow.com/comment/34780884
has answer: http://stackoverflow.com/a/22815833
has title: Force JTextField to string value while DocumentFilter only allows digits
linked to: http://stackoverflow.com/q/5662651
answer count: 3
has comment: http://stackoverflow.com/comment/34781545
has comment: http://stackoverflow.com/comment/34781404
has comment: http://stackoverflow.com/comment/34781599

spring
tags question: http://stackoverflow.com/q/22666416
tags question: http://stackoverflow.com/q/22724165
tags question: http://stackoverflow.com/q/22740727
tags question: http://stackoverflow.com/q/22763243
tags question: http://stackoverflow.com/q/22742229
tags question: http://stackoverflow.com/q/22779872
tags question: http://stackoverflow.com/q/22712575
tags question: http://stackoverflow.com/q/22792255
tags question: http://stackoverflow.com/q/22764164
tags question: http://stackoverflow.com/q/22717782
tags question: http://stackoverflow.com/q/22671140
tags question: http://stackoverflow.com/q/22785501
tags question: http://stackoverflow.com/q/22681552
tags question: http://stackoverflow.com/q/22802865
tags question: http://stackoverflow.com/q/22806840
tags question: http://stackoverflow.com/q/22684008
tags question: http://stackoverflow.com/q/22705912
tags question: http://stackoverflow.com/q/22794514
tags question: http://stackoverflow.com/q/22659012
tags question: http://stackoverflow.com/q/22714090
tags question: http://stackoverflow.com/q/22722653
tags question: http://stackoverflow.com/q/22769704
tags question: http://stackoverflow.com/q/22725547
tags question: http://stackoverflow.com/q/22780939
tags question: http://stackoverflow.com/q/22750900
tags question: http://stackoverflow.com/q/22729740
tags question: http://stackoverflow.com/q/22736688
tags question: http://stackoverflow.com/q/22762597
tags question: http://stackoverflow.com/q/22744666
tags question: http://stackoverflow.com/q/22768655
tags question: http://stackoverflow.com/q/22684482
tags question: http://stackoverflow.com/q/22773116
tags question: http://stackoverflow.com/q/22733631
tags question: http://stackoverflow.com/q/22740199
tags question: http://stackoverflow.com/q/22694486
tags question: http://stackoverflow.com/q/22760205
tags question: http://stackoverflow.com/q/22808384
tags question: http://stackoverflow.com/q/22675605
tags question: http://stackoverflow.com/q/22655085
tags question: http://stackoverflow.com/q/22662077
tags question: http://stackoverflow.com/q/22703501
tags question: http://stackoverflow.com/q/22761673
tags question: http://stackoverflow.com/q/22722399
tags question: http://stackoverflow.com/q/22704518
tags question: http://stackoverflow.com/q/22802536
tags question: http://stackoverflow.com/q/22764471
tags question: http://stackoverflow.com/q/22795931
type: Tag
tags question: http://stackoverflow.com/q/22784398
tags question: http://stackoverflow.com/q/22716302
tags question: http://stackoverflow.com/q/22805512
tags question: http://stackoverflow.com/q/22696741
tags question: http://stackoverflow.com/q/22749965
tags question: http://stackoverflow.com/q/22696401
tags question: http://stackoverflow.com/q/22677822
tags question: http://stackoverflow.com/q/22730801
tags question: http://stackoverflow.com/q/22807748
tags question: http://stackoverflow.com/q/22747253
tags question: http://stackoverflow.com/q/22758646
tags question: http://stackoverflow.com/q/22666175
tags question: http://stackoverflow.com/q/22671048
tags question: http://stackoverflow.com/q/22763440
tags question: http://stackoverflow.com/q/22694559
tags question: http://stackoverflow.com/q/22720943
tags question: http://stackoverflow.com/q/22734877
tags question: http://stackoverflow.com/q/22652148
tags question: http://stackoverflow.com/q/22805492
tags question: http://stackoverflow.com/q/22668198
tags question: http://stackoverflow.com/q/22690723
tags question: http://stackoverflow.com/q/22796910
tags question: http://stackoverflow.com/q/22744154
tags question: http://stackoverflow.com/q/22702568
tags question: http://stackoverflow.com/q/22659866
tags question: http://stackoverflow.com/q/22658147
tags question: http://stackoverflow.com/q/22778470
tags question: http://stackoverflow.com/q/22767270
tags question: http://stackoverflow.com/q/22745054
tags question: http://stackoverflow.com/q/22703947
tags question: http://stackoverflow.com/q/22761120
tags question: http://stackoverflow.com/q/22684783

http://stackoverflow.com/comment/34677791
type: AnswerComment
has text: While I'll except your answer as been relatively correct, you could also achieve the same thing by using a JLabel instead of the ImagePanel, just saying +1
type: Comment
comment on: http://stackoverflow.com/a/22749144
score: 1

http://stackoverflow.com/q/22763986
has title: Creating new object in java error
possible better answer: http://stackoverflow.com/a/22764217
favorite count: 0
has comment: http://stackoverflow.com/comment/34703353
has comment: http://stackoverflow.com/comment/34703092
score: 2
upvote count: 2
type: AnsweredQuestion
tagged with: java
has answer: http://stackoverflow.com/a/22764217
type: Question
accepted answer: http://stackoverflow.com/a/22764089
answer count: 2
has comment: http://stackoverflow.com/comment/34703025
tagged with: brackets
has body: I wrote this code in the main: if (startAmount&gt;0) //create new cashier object with or without a start amount Cashier newCashier = new Cashier(startAmount); else Cashier newCashier = new Cashier(); and got an compile error for the second and third lines: Multiple markers at this line - Cashier cannot be resolved to a variable - Syntax error on token "newCashier", delete and: Multiple markers at this line - Cashier cannot be resolved to a variable - Syntax error, insert "AssignmentOperator Expression" to complete Assignment - Syntax error, insert ";" to complete Statement but when i write the code like this with brackets: if (startAmount&gt;0)//create new cashier object with or without a start amount { Cashier newCashier = new Cashier(startAmount); } else{ Cashier newCashier = new Cashier();} it seems to be okay, no compile errors. can someone help me understand why?
downvote count: 0
has answer: http://stackoverflow.com/a/22764089

http://stackoverflow.com/a/22789569
answers question: http://stackoverflow.com/q/22672858
score: 1
type: AcceptedAnswer
downvote count: 0
accepted answer of: http://stackoverflow.com/q/22672858
type: Answer
has body: I managed to get this working using Spring LDAP 2.0.1.RELEASE. The Object Directory Mapper is now managed within the LdapTemplate. I used the a custom ContextMapper to execute a search on the directory. The mapper and the method are listed below. Create Custom ContextMapper class. public class UserContextMapper implements ContextMapper { private static ApplicationContext appContext = new ClassPathXmlApplicationContext(new String[]{"spring-config.xml"}); public Object mapFromContext(Object ctx) { Class&lt;User&gt; clazz = User.class; LdapTemplate ldapTemplate = (LdapTemplate) appContext.getBean("ldapTemplate"); User user = ldapTemplate.getObjectDirectoryMapper().mapFromLdapDataEntry((DirContextOperations) ctx, clazz); return user; } } Create a method that creates an LdapOperationsCallback and pages the results public List&lt;User&gt; getLdapQueryResult(final LdapName dn, final Filter filter) throws NamingException { final PagedResultsDirContextProcessor processor = new PagedResultsDirContextProcessor(getPageSize()); final SearchControls searchControls = new SearchControls(); final UserContextMapper ucm = new UserContextMapper(); searchControls.setSearchScope(SearchControls.SUBTREE_SCOPE); return SingleContextSource.doWithSingleContext( ldapTemplate.getContextSource(), new LdapOperationsCallback&lt;List&lt;User&gt;&gt;() { @Override public List&lt;User&gt; doWithLdapOperations(LdapOperations operations) { List&lt;User&gt; result = new LinkedList&lt;User&gt;(); do { List&lt;User&gt; oneResult = operations.search(dn, filter.encode(), searchControls, ucm, processor); result.addAll(oneResult); } while (processor.hasMore()); return result; } }); }
upvote count: 1

http://stackoverflow.com/q/22778480
has answer: http://stackoverflow.com/a/23052931
has comment: http://stackoverflow.com/comment/34729322
upvote count: 2
score: 0
has comment: http://stackoverflow.com/comment/34729001
downvote count: 2
has comment: http://stackoverflow.com/comment/34729290
has title: SubethaSmtp working example
answer count: 1
tagged with: email
has comment: http://stackoverflow.com/comment/34728774
favorite count: 0
has comment: http://stackoverflow.com/comment/34729766
type: UnansweredQuestion
tagged with: inbox
has body: Can you please tell me how to use SubethaSmtp library? I just want to retrieve the mails from my Gmail inbox and display them or one of them in console window. I studied most of the API doc but I'm not being able to put the pieces together to get the things working. Can you please tell me about a working example? I wrote this code to build a grails application. You may find some bad code habits but it's okey for a sample application. Here is the code in src/groovy folder : class MessageHandlerFactoryImpl implements MessageHandlerFactory { @Override MessageHandler create(MessageContext ctx) { return new MessageHandlerImpl(ctx) } } class MessageHandlerImpl implements MessageHandler { MessageContext context MessageHandlerImpl(MessageContext context) { this.context = context } @Override void from(String from) { println "FROM: ${from}" } @Override void recipient(String recipient) { println "RECIPIENT: ${recipient}" } @Override void data(InputStream data) { println "DATA" println "-------------------" BufferedReader reader = new BufferedReader(new InputStreamReader(data)) StringBuilder builder = new StringBuilder() String line while ((line = reader.readLine()) != null) { builder.append(line + "\n") } println builder.toString() } @Override void done() { println "DONE" } } class SimpleMessageListenerImpl implements SimpleMessageListener { @Override boolean accept(String from, String recipient) { println "accept: ${from} \n&gt;&gt; ${recipient}" return false } @Override void deliver(String from, String recipient, InputStream data) { try { println "deliver: ${from} \n&gt;&gt; ${recipient} \n&gt;&gt;&gt; ${data.read()}" } catch (TooMuchDataException e) { println "TooMuchDataException: ${e.message}" } catch (IOException e) { println "IOException: ${e.message}" } } } class UsernamePasswordValidatorImpl implements UsernamePasswordValidator { @Override void login(String username, String password) { try { println "LOGIN:::::::" } catch(LoginFailedException e) { println "LoginFailed…
tagged with: gmail
tagged with: java
type: Question
has comment: http://stackoverflow.com/comment/34729140

http://stackoverflow.com/q/22722383
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/22739335
tagged with: spss
tagged with: java
type: Question
has title: Generate SPSS File using PL/SQL
tagged with: plsql
has comment: http://stackoverflow.com/comment/34630796
score: 0
tagged with: oracle-database
tagged with: http://stackoverflow.com/tag/csv
answer count: 1
has body: Problem: I am looking for a way to generate a SPSS file using PL/ SQL. Currently, I am able to generate a .csv file with roughly 300-400 columns. I have tried to google and didn't have any luck in finding a way to generate SPSS file using PL/SQL. Expected Solution: Either generate a SPSS file directly OR use some kind of java class like one this program SPSS Writer uses to convert the .csv file into SPSS. My understanding is that we would need to provide the metadata file in order to convert the csv file into SPSS. Any suggestions would be much appreciated.
has comment: http://stackoverflow.com/comment/34702907
has comment: http://stackoverflow.com/comment/34710281

http://stackoverflow.com/a/22768643
has comment: http://stackoverflow.com/comment/34712165
accepted answer of: http://stackoverflow.com/q/22768025
answers question: http://stackoverflow.com/q/22768025
has body: Use RegExp import java.util.Scanner; import java.util.regex.Matcher; import java.util.regex.Pattern; public class TestDigits { static Scanner console = new Scanner(System.in); public static void main(String[] args) { // Validate Input String number = console.nextLine(); Pattern p = Pattern.compile("(-?[0-9]{1})+"); Matcher m = p.matcher(number); if (!m.matches()) { throw new IllegalArgumentException("Invalid Numbers"); } // Calculate p = Pattern.compile("-?[0-9]{1}+"); m = p.matcher(number); int result = 0; System.out.print("The digits of the number are: "); while (m.find()) { System.out.print(m.group() + " "); result += Integer.valueOf(m.group()); } System.out.println(""); System.out.println("Result " + result); } }
score: 0
type: AcceptedAnswer
type: Answer

http://stackoverflow.com/comment/34682737
comment on: http://stackoverflow.com/q/22752834
type: Comment
type: QuestionComment
score: 1
has text: @OldProgrammer - You can see that the code snippet above doesn't work. It's just a rough sketch of how Kyle thinks this should be done. And he's roughly right - he just needs some help.

http://stackoverflow.com/q/22769594
has answer: http://stackoverflow.com/a/22827454
type: Question
has title: Storing game data in TurnBasedMatch bytearray
tagged with: java
tagged with: google-play-services
score: 0
has body: Is there a preffered way of storing game data in the match data bytearray you can use in a turn based match? For example: We are making a board game with 16 game tiles. Each of the tiles has to have a certain value associated with it. Our idea is to simply use 16 fields in the byte array to represent each of these tiles. Another example: We also need to store information on up to four players. We will store positional data, movement points and some other stuff. Lets look at the positional data: Each player will have an x and y coordinate. Since we will have up to four players, we are thinking of setting aside 8 fields in the byte array for this positional data. Both of these examples will work, but is there a "good practice" way of doing this?
tagged with: arrays
answer count: 1
type: UnansweredQuestion
tagged with: android

http://stackoverflow.com/comment/34721513
type: QuestionComment
comment on: http://stackoverflow.com/q/22774048
has text: Try adding it as the last line of your `onCreate()` method.
score: 0
type: Comment

http://stackoverflow.com/a/22743333
upvote count: 2
has body: Here is how you would do that using Files. First, create a FileVisitor. Extend SimpleFileVisitor since it is enough for your needs: public final class AudioFileCollector extends SimpleFileVisitor&lt;Path&gt; { private final List&lt;Path&gt; fileList; public AudioFileCollector(final List&lt;Path&gt; fileList) { this.fileList = fileList; } @Override public FileVisitResult visitFile(Path file, BasicFileAttributes attrs) throws IOException { // We know this is a regular file here, so now we just need to check the type switch (Files.probeContentType(file)) { case "audio/x-wav": // wav file case "audio/mpeg": // mp3 fileList.add(file); default: } return FileVisitResult.CONTINUE; } @Override public FileVisitResult postVisitDirectory(Path dir, IOException e) throws IOException { if (e != null) throw e; return FileVisitResult.CONTINUE; } Then walk your directory with this visitor: final Path baseDir = Paths.get("..."); final List&lt;Path&gt; fileList = new ArrayList&lt;&gt;(); final FileVisitor&lt;Path&gt; collector = new AudioFileCollector(fileList); Files.walkFileTree(baseDir, collector); Done! Note the use of Files.probeContentType(). Solution with Java 8 (I guess it could be better): public final class Main { public static void main(final String... args) throws IOException { final List&lt;String&gt; extensions = Arrays.asList(".mp3", ".wav"); final Path start = Paths.get("..."); Files.walk(start).map(Object::toString) .filter(s -&gt; extensions.stream().anyMatch(s::endsWith)) .forEach(System.out::println); } } If you want to collect in a list, replace .forEach() with .collect(Collectors.toList()).
has comment: http://stackoverflow.com/comment/34665253
score: 2
downvote count: 0
type: Answer
answers question: http://stackoverflow.com/q/22743091

http://stackoverflow.com/a/22833321
accepted answer of: http://stackoverflow.com/q/22787260
score: 0
type: AcceptedAnswer
has body: Thanks to Kamil Mikolajczyk, I was able to research MVC with Java and found a pretty nice example via this link. Again, thank you for your help Kamil Mikolajczyk.
type: Answer
answers question: http://stackoverflow.com/q/22787260

http://stackoverflow.com/a/22797434
answers question: http://stackoverflow.com/q/22797382
score: 0
has body: You can do it like ... String s = "122.32,20.543"; String[] splitted = s.split(","); for(String value: splitted){ Log.w("Activity",Double.parseDouble(value)); }
type: Answer

text
tags question: http://stackoverflow.com/q/22786893
type: Tag
tags question: http://stackoverflow.com/q/22648461
tags question: http://stackoverflow.com/q/22741772
tags question: http://stackoverflow.com/q/22716293
tags question: http://stackoverflow.com/q/22695553
tags question: http://stackoverflow.com/q/22764868
tags question: http://stackoverflow.com/q/22694623
tag name: text
tags question: http://stackoverflow.com/q/22781683
tags question: http://stackoverflow.com/q/22700159
tags question: http://stackoverflow.com/q/22652357
tags question: http://stackoverflow.com/q/22772109
tags question: http://stackoverflow.com/q/22765326

http://stackoverflow.com/comment/34578952
comment on: http://stackoverflow.com/a/22694694
has text: Also probably need a defensive check if the `String` is null.
score: 0
type: AnswerComment
type: Comment

http://stackoverflow.com/comment/34552122
type: QuestionComment
score: 0
comment on: http://stackoverflow.com/q/22680262
has text: I understand that, because of autoboxing, "Integer[] returnVal = {1,2}" compiles with no error. What I would like to know is if "int[] =" is actually compiled exactly like "Integer[] =" (and that there is no actual thing like array of values.)
type: Comment

http://stackoverflow.com/q/22698770
tagged with: android
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/22699101
tagged with: java
possible better answer: http://stackoverflow.com/a/22698944
tagged with: authentication
has answer: http://stackoverflow.com/a/22698944
tagged with: http
type: Question
score: 0
answer count: 2
has answer: http://stackoverflow.com/a/22699101
has title: Login to a website with HTTP Basic Authentication from Android app
has body: I've already searched for many ways to do this, but i can't find any working way. I want to login to this site: http://www.besselgymnasium.de/fileadmin/Vertretung/Vertretungsplan_Schueler/subst_001.htm which uses HTTP Basic Authentication using my android app to read out the source code, but i don't know how i could let my app login automatically. Could somebody tell me how this can be achieved? The last thing i tried was: @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.main); quellcode = (TextView) findViewById(com.example.MainActivity.R.id.TextView01); geschichte = (TextView) findViewById(com.example.MainActivity.R.id.geschichte); datum1 = (TextView) findViewById(com.example.MainActivity.R.id.datum1); datum1.setText("25.03.2014"); readWebpage(quellcode); } @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; } private class DownloadWebPageTask extends AsyncTask&lt;String, Void, String&gt; { @Override protected String doInBackground(String... urls) { String credentials = "username" + ":" + "password"; Base64.encodeToString(credentials.getBytes(), Base64.DEFAULT); String response = ""; for (String url : urls) { DefaultHttpClient client = new DefaultHttpClient(); HttpGet httpGet = new HttpGet(url); httpGet.setHeader("Authorization", "Basic "+credentials); try { HttpResponse execute = client.execute(httpGet); InputStream content = execute.getEntity().getContent(); BufferedReader buffer = new BufferedReader(new InputStreamReader(content)); String s = ""; while ((s = buffer.readLine()) != null) { response += s; } } catch (Exception e) { e.printStackTrace(); } } return response; } //END OF READING @Override protected void onPostExecute(String result) { quellcode.setText(result); } } public void readWebpage(View view) { DownloadWebPageTask task = new DownloadWeb…

http://stackoverflow.com/comment/34549957
comment on: http://stackoverflow.com/q/22678998
has text: Sorry, no factory in test2(), a typo, have modified it.
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/a/22728476
downvote count: 0
has body: I was under the impression that when hashSet.add(n2) is called, it invokes Node.equals to see if a duplicate of n2 is already in the set, but I was wrong!. Actually, you were correct (sort of). It invokes the boolean equals(Object) method. But you have created a overloaded equals method with boolean equals(Node&lt;T&gt;) ... and that method will not be called by HashSet methods. Write the equals method like this: @Override boolean equals(Object node) { ... } And since you have overloaded equals you also need to overload int hashcode() ... or your hashset instance will break.
upvote count: 2
answers question: http://stackoverflow.com/q/22728124
type: Answer
has comment: http://stackoverflow.com/comment/34639173
score: 2

http://stackoverflow.com/comment/34553123
has text: the o/p should be 3 in both cases....
comment on: http://stackoverflow.com/q/22680851
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/q/22667457
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/22667769
tagged with: java
has comment: http://stackoverflow.com/comment/34529079
type: Question
has title: Delete last entered value
has comment: http://stackoverflow.com/comment/34529077
accepted answer: http://stackoverflow.com/a/22667769
has comment: http://stackoverflow.com/comment/34529076
has body: I save the value in a text file (.txt) with java. I do it with a do while loop until I find the symbol *. The problem is that when I print the content of the file, the ultimate value correspond to *, and I would delete this. How can I do that? Also, I would like to check if a value exist in the text file, you can use the equals? This is my code: public void In() throws IOException { do { System.out.println("Enter place"); place = t.readLine(); if(place == "*") { break; } else { fOUT.writeObject(place); } }while(!place.equals("*")); }
score: 0
has comment: http://stackoverflow.com/comment/34529431
answer count: 1
has comment: http://stackoverflow.com/comment/34529372
has comment: http://stackoverflow.com/comment/34529595

http://stackoverflow.com/comment/34560704
score: 0
has text: maybe do it the other way round, go from i =0...n, j=0...n, and trying to add go i=0...n, j=i+1....n, and have subarray from 0 to i and from j to n
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/22685451

http://stackoverflow.com/a/22789674
has comment: http://stackoverflow.com/comment/34784167
has body: You should take a look at the official SonarQube IntelliJ plugin which allows you to run SonarQube analysis within IntelliJ - whatever the rules you've configured on your SonarQube instance (SonarQube rules, Checkstyle, PMD, Findbugs).
has comment: http://stackoverflow.com/comment/34752378
has comment: http://stackoverflow.com/comment/34752757
has comment: http://stackoverflow.com/comment/34753030
has comment: http://stackoverflow.com/comment/34792891
score: 0
has comment: http://stackoverflow.com/comment/34774636
has comment: http://stackoverflow.com/comment/34783873
has comment: http://stackoverflow.com/comment/34786367
type: Answer
answers question: http://stackoverflow.com/q/22782202

http://stackoverflow.com/comment/34599608
type: Comment
comment on: http://stackoverflow.com/a/22706554
type: AnswerComment
has text: This project has missing classes
score: 0

http://stackoverflow.com/comment/34613116
type: QuestionComment
score: 1
has text: please provide some stack trace.
comment on: http://stackoverflow.com/q/22714090
type: Comment

http://stackoverflow.com/q/22693459
favorite count: 0
tagged with: vm-implementation
tagged with: heap-memory
possible better answer: http://stackoverflow.com/a/22693678
upvote count: 4
has answer: http://stackoverflow.com/a/22693869
has answer: http://stackoverflow.com/a/22693678
accepted answer: http://stackoverflow.com/a/22693869
downvote count: 0
has body: In Java the virtual machine pre-allocates a memory heap which cannot be expanded at runtime. The developer can increase the size of the heap with the -Xmx switch when the VM loads, but there is no way to increase the maximum size of the heap at runtime. Why is this?
type: AnsweredQuestion
tagged with: java
has answer: http://stackoverflow.com/a/22693736
has title: Why does Java use a static heap rather than allow an arbitrary amount of memory?
score: 4
tagged with: memory
type: Question
answer count: 3
tagged with: jvm

http://stackoverflow.com/a/22701351
score: 0
has body: One can attach java source code for debugging. Then one can debug into the map. Or try the expression evaluation within the debugger.
answers question: http://stackoverflow.com/q/22701182
type: Answer

http://stackoverflow.com/comment/34570651
comment on: http://stackoverflow.com/q/22690723
type: Comment
type: QuestionComment
has text: Are you sure that the thread in question is the thread with `main()`, not some other thread started by one of your Spring beans?
score: 1

http://stackoverflow.com/comment/34510947
has text: Stack Overflow is a question and answer site for professional and enthusiast programmers. Questions must **demonstrate a minimal understanding of the problem being solved**. Tell us what you've tried to do, why it didn't work, and how it _should_ work. See also: [Stack Overflow question checklist](http://meta.stackexchange.com/questions/156810/stack-overflow-question-checklist).
comment on: http://stackoverflow.com/q/22656899
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/q/22720125
accepted answer: http://stackoverflow.com/a/22722765
tagged with: mongodb
answer count: 1
score: 0
has comment: http://stackoverflow.com/comment/34625294
has title: Retrieving long values from MongoDB in Java
has body: I have a bunch of fields stored in MongoDB as Longs. When I query my collection, they are returned as Longs. However, when I perform a MapReduce into a new collection and retrieve the data from there, it comes back as floats. It seems awkward to have to cast everything to a float and then grab the Long value - is there a better way? A sample object: { "_id" : 2836.0 , "value" : { "friends_count" : 788.0 , "followers_count" : 910.0 , "tweet_count" : 7791.0 , "screen_name" : "zzzzz" , "collected_at" : { "$date" : "2014-01-01T14:47:41.000Z"}}} Here are my map and reduce functions: I need both the id and all of the numeric values (other than date) to be Longs: String map = "function() { " + "emit( this.user_id, { 'friends_count': this.friends_count, 'followers_count': this.followers_count, " + "'tweet_count': this.tweet_count, 'screen_name': this.screen_name, 'collected_at': this.collected_at} );}"; String reduce = "function(key, values) { " + "var retval = values[0]; " + "var latest = 0; "+ "for(var i in values){ " + "if(values[i].collected_at &gt; latest) { " + "latest = values[i].collected_at; "+ "retval = values[i]; "+ " }} "+ "return retval;}";
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/34624645
has comment: http://stackoverflow.com/comment/34628903
tagged with: java
tagged with: http://stackoverflow.com/tag/json
tagged with: mapreduce
has answer: http://stackoverflow.com/a/22722765
type: Question

http://stackoverflow.com/a/22798636
type: AcceptedAnswer
downvote count: 0
upvote count: 8
type: Answer
accepted answer of: http://stackoverflow.com/q/22798345
score: 8
answers question: http://stackoverflow.com/q/22798345
has body: Tempo is a 3-byte big-endian integer and Bits Per Minute is calculated as BPM = 60,000,000 / (tt tt tt) byte[] data = mm.getData(); int tempo = (data[0] &amp; 0xff) &lt;&lt; 16 | (data[1] &amp; 0xff) &lt;&lt; 8 | (data[2] &amp; 0xff); int bpm = 60000000 / tempo;

http://stackoverflow.com/q/22668462
score: 1
tagged with: java
type: Question
tagged with: jodatime
possible better answer: http://stackoverflow.com/a/22669789
has title: Use Joda-Time to Calculate the next Day of the Week with Time
has answer: http://stackoverflow.com/a/22669789
downvote count: 0
has answer: http://stackoverflow.com/a/22670599
has comment: http://stackoverflow.com/comment/34534704
has body: I'm about to write lines of some simple math and wanted to make sure that there wasn't some simple high level construct in Joda-Time to do this already. I have an object that represents a day of the week, an hour of the day, and a minute of the hour. For example "Wednesday at 10:14am". I want to calculate the number of milliseconds until the next occurrence. For example if now is Thursday at 10:14 it would be 6 days worth of milliseconds. This is because Wednesday has already passed so it will take 6 days to get to the next Wednesday. If now is Wednesday at 10:13.0001 it will be 999. Is there a high level construct in Joda-Time so I can do this in one or two lines of code or do I need to do the math myself (including edge cases to wrap on stuff like DOW &lt; DOW_NOW). Thanks! Here's my novice try that does not yet work to give you some reference: public MutableDateTime getDateTime() { MutableDateTime date = MutableDateTime.now(); date.setDayOfWeek(this.day); date.setHourOfDay(this.hour); return date; } public long getTimeUntilNextFrom( DateTime from ) { MutableDateTime to = getDateTime(); if (to.isBefore( from )) { to.setWeekOfWeekyear(from.getWeekOfWeekyear() + 1); } return new Interval(from, to).toDurationMillis(); }
has comment: http://stackoverflow.com/comment/34531018
has answer: http://stackoverflow.com/a/22670538
has comment: http://stackoverflow.com/comment/34531216
answer count: 4
favorite count: 0
has comment: http://stackoverflow.com/comment/34533070
accepted answer: http://stackoverflow.com/a/22670599
upvote count: 1
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/22670165
has comment: http://stackoverflow.com/comment/34531250

http://stackoverflow.com/comment/34632220
type: Comment
type: QuestionComment
score: 0
has text: @Braj From the descripth problem (and sample code), the componet is already focusable, as the OP can click the componet and activate the key listener...
comment on: http://stackoverflow.com/q/22724286

http://stackoverflow.com/comment/34716056
score: 0
type: AnswerComment
has text: can I see an example so I understand it better? Is it like this: ourDatabase.update(DATABASE_TABLE, cv, KEY_LOCKERNUMBER + "=?", new String[] { lockerNumber });
type: Comment
comment on: http://stackoverflow.com/a/22771061

http://stackoverflow.com/a/56387218
answers question: http://stackoverflow.com/q/22734767
score: 0
has body: I solved this problem copying this 2 JARs below. from (assuming you are using Maven to manage your dependecies): .m2/repository/org/slf4j/slf4f-api/N.N.NN/slf4j-api-N.N.NN.jar .m2/repository/org/slf4j/slf4f-log4j12/N.N.NN/slf4j-log4j12-N.N.NN.jar to (apache installation folder): apache-tomcat-M.M.MM/lib
type: Answer

http://stackoverflow.com/comment/34744220
score: 1
type: Comment
comment on: http://stackoverflow.com/a/22787110
type: AnswerComment
has text: Could you please explain briefly why it is not recommended?

http://stackoverflow.com/q/22770547
has comment: http://stackoverflow.com/comment/34715150
tagged with: spring
tagged with: java
has title: Ehcache not work in Spring 3.2
has comment: http://stackoverflow.com/comment/34715341
has body: This is my actual approach. When I refresh my app second by second the Date param always is update. The controller @Controller public class MainController implements ToCache { @RequestMapping(value = {"/", "/index"}) @Cacheable(value = "main", key = "#root.method.name") public String showHome(HttpServletRequest request) { request.setAttribute("now", new Date()); request.setAttribute("tmp", System.getProperty("java.io.tmpdir")); return "index"; } } The interface public interface ToCache { String showHome(HttpServletRequest request); } Ehcache-servlet.xml <mvc:annotation-driven /> <context:component-scan base-package="com.pjcom.**" /> Ehcache integration with Spring applicationContext.xml <property name="cacheManager" ref="ehcache"/> <property name="configLocation" value="classpath:ehcache.xml"/> <property name="shared" value="true"/> <cache:annotation-driven mode="proxy" proxy-target-class="true" cache-manager="cacheManager" key-generator="enhancedDefaultKeyGenerator"/> Ehcache configuration <?xml version="1.0" encoding="UTF-8"?> <diskStore path="java.io.tmpdir"/> <cache name="main" maxBytesLocalHeap="100M" eternal="false" t imeToIdleSeconds="10" timeToLiveSeconds="10" overflowToDisk="true" maxElementsOnDisk="1000" memoryStoreEvictionPolicy="LRU"/> The runtime log, deploy and refresh. 31-Mar-2014 21:33:20.881 INFO [http-nio-8084-exec-52] org.apache.catalina.startup.HostConfig.undeploy Repliegue (undeploy) de la aplicación web que tiene como trayectoria de contexto /springehcache 31-Mar-2014 21:33:20.917 INFO [http-nio-8084-exec-53] org.apache.catalina.startup.HostConfig.deployDescriptor Desplieque del descriptor de configuración C:\...\springehcache.xml 31-Mar-2014 21:33:20.919 WARNING [http-nio-8084-exec-53] org.apache.catalina.startup.SetContextPropertiesRule.begin [SetContextPropertiesRule]{Context} Setting property 'antiJARLocking' to 'true' did not find a matching property. log4j:WARN No appenders could be found for logger (org.springframework.web.context.Contex…
type: Question
has comment: http://stackoverflow.com/comment/34715254
has comment: http://stackoverflow.com/comment/34714964
score: 0
has comment: http://stackoverflow.com/comment/34715729
tagged with: ehcache
answer count: 0
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/34715800

http://stackoverflow.com/comment/34677890
type: QuestionComment
has text: thanks for answer, there are two different option about istanbul, **Asia/Istanbul** and **Europe/Istanbul** , but they are both same time, are they different for *java* which one I select?
comment on: http://stackoverflow.com/q/22750080
score: 0
type: Comment

http://stackoverflow.com/comment/34717073
comment on: http://stackoverflow.com/q/22771488
type: Comment
type: QuestionComment
has text: did you actually read the error before asking your question ?
score: 1

http://stackoverflow.com/comment/34613924
type: Comment
type: QuestionComment
has text: Wait, you write that you use the `mvn install` command. Did you perform a `mvn clean` since switching to java 1.7? If not you may be mixing java 1.6 and 1.7 classes.
score: 0
comment on: http://stackoverflow.com/q/22707510

http://stackoverflow.com/comment/34547606
type: QuestionComment
score: 0
comment on: http://stackoverflow.com/q/22677825
has text: This looks like a reasonable implementation. What's actually going wrong?
type: Comment

http://stackoverflow.com/a/22769387
answers question: http://stackoverflow.com/q/22769202
downvote count: 0
type: Answer
has body: Add the items to an array (first come first serve) then traverse the array in reverse for (into I = array.length; i &gt;= 0; i--) { //print array[i] } Alternatively you can use an ArrayList if you don't know the number of lines in the document
score: 1
upvote count: 1

http://stackoverflow.com/a/22716389
answers question: http://stackoverflow.com/q/22716265
type: Answer
upvote count: 1
downvote count: 1
score: 0
has body: 1.char tmp has to be declared outside the block as shown below. char tmp; if (i == 0) { tmp = 'n'; } if (i == 1) { tmp = 'r'; } Same with clavier, has to be declared outside do to be used in the while condition. char clavier do{ 2.Same with the second program. declare the tmp values outside and then use them.

http://stackoverflow.com/comment/34584001
type: QuestionComment
has text: I think you're missing a catch for `NumberFormatException`
score: 0
comment on: http://stackoverflow.com/q/22697932
type: Comment

http://stackoverflow.com/q/22748822
score: 1
favorite count: 0
tagged with: netbeans
has comment: http://stackoverflow.com/comment/34675922
type: Question
has comment: http://stackoverflow.com/comment/34675568
has comment: http://stackoverflow.com/comment/34675817
has title: Resources in NetBeans
has comment: http://stackoverflow.com/comment/34675676
upvote count: 1
has comment: http://stackoverflow.com/comment/34675457
answer count: 1
has answer: http://stackoverflow.com/a/22749005
tagged with: java
has comment: http://stackoverflow.com/comment/34675857
has comment: http://stackoverflow.com/comment/34675663
has comment: http://stackoverflow.com/comment/34675631
tagged with: image
has comment: http://stackoverflow.com/comment/34675809
has body: Hi :) I have some problem with my resources in NetBeans. Already I add them into project, and when I run whole project in NetBeans, everything works fine :) But when I clean it and build, I have no idea where I should have those resources (app can't find my image). Every image and font are in my packages (example: com.project.resources.images), command which I used to get it is: ImageIO.read(this.getClass().getResource(path) If someone could help me it would be awesome.
tagged with: resources
has comment: http://stackoverflow.com/comment/34675525
has comment: http://stackoverflow.com/comment/34675734
downvote count: 0
type: UnansweredQuestion

http://stackoverflow.com/comment/34737076
type: Comment
type: QuestionComment
score: 2
has text: casting (of objects) in Java is not like casting in C. Cast succeeds only when the object is actually of the needed type (or its subtype)
comment on: http://stackoverflow.com/q/22783024

http://stackoverflow.com/a/22723008
has body: 1I would suggest using String.format for this. Then you get some nice formatting along with it. System.out.println(String.format("%-10s%-10s%-10s", "Name", "Used Sales", "New Sales")); for(int x = 0; x &lt; numemployees; x++) { System.out.println(String.format("%8.2f%8.2f%8.2f", names[x], sales[x][0], sales[x][1])); }
type: Answer
answers question: http://stackoverflow.com/q/22721103
score: 0

http://stackoverflow.com/a/22737179
score: 2
accepted answer of: http://stackoverflow.com/q/22736918
downvote count: 0
answers question: http://stackoverflow.com/q/22736918
has body: Neo4j 2.0 introduced a new "transactional HTTP endpoint". One of its capabilities is to pass in multiple cypher statements and multiple parameter sets. It's very well documented, so I suggest giving it a try. Alternatively you can use batch operations to aggregate multiple calls to the "old" endpoint (/db/data/cypher). However I'd suggest the first approach.
upvote count: 2
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/34661998
has comment: http://stackoverflow.com/comment/34658509
type: Answer

http://stackoverflow.com/comment/34588152
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/22699880
score: 0
has text: Its kind of hard to put this into a general realm, because I can't really get general about this question. I understand what you're saying.

http://stackoverflow.com/comment/34580314
score: 1
has text: You can't decode arbitrary binary (raw 32-bit integer) as UTF-8. Instead of putting the message length into a `String`, put the message and header into a `byte[]`.
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/22693878

http://stackoverflow.com/comment/34677478
has text: Give some reasonable package name , com.example.MainActivity :)
score: 0
comment on: http://stackoverflow.com/q/22748171
type: QuestionComment
type: Comment

http://stackoverflow.com/q/22794945
has title: Restful service not returning right object
has answer: http://stackoverflow.com/a/22795191
has body: I have a Java Restful web service , which when called by postman returns an object which is missing attributes. The JSON objects can be seen below. The image below that shows the object just before it is returned in the rest function. As you can see, there are the days of the week with a value in them which are not showing up in postman. The backAbsence entity can be view at the end of this post. The SAbsence is a list of the backAbsence entity's. What I am wondering is why when i return the SAbsenece are the full models not received in postman and how do I resolve it? [ { "name": "King sean", "classidClass": 0, "studentidStudent": 1, "week": 14 }, { "name": "Sean king", "classidClass": 0, "studentidStudent": 2, "week": 14 } ] Rest function Part: @GET @Produces({"application/xml","application/json"}) @Path("{id}/{option}") public List&lt;BackAbsence&gt; findbyClass(@PathParam("id")int id, @PathParam("option")int option) { List&lt;BackAbsence&gt; SAbsence = new ArrayList&lt;&gt;(); // code here fills list. The Image above shows the object with valid attributes return SAbsence; } } BackAbsnece Entity: public class BackAbsence { private String name; public String getName() { return name; } public void setName(String name) { this.name = name; } private int classidClass; private int studentidStudent; private int monday = 0, tuesday = 0, wednesday = 0, thursday = 0, friday = 0; private int week; public BackAbsence() { } public BackAbsence(int idstudent, String name) { this.studentidStudent = idstudent; this.name = name; } public BackAbsence(int classidClass, int studentidStudent, int monday, int tuesday, int wednesday, int thursday, int friday,int week) { this.classidClass = classidClass; this.studentidStudent = studentidStudent; this.monday = monday; this.tuesday = tuesday; this.wednesday = wednesday; this.thursday = thursday; this.week = week; } public int isMonday() { return monday; } public void setMonday(int monday) { this.monday = monday; } public int isTuesday() { …
tagged with: java
has answer: http://stackoverflow.com/a/22795155
accepted answer: http://stackoverflow.com/a/22795155
tagged with: web-services
type: Question
type: AnsweredQuestion
possible better answer: http://stackoverflow.com/a/22795191
score: 0
answer count: 2
tagged with: jax-rs
tagged with: rest

http://stackoverflow.com/comment/66229071
score: 0
type: Comment
has text: if the method 2 can be followed how to track the status of the virus scan ?.through the antivirus UI ?
comment on: http://stackoverflow.com/a/22652589
type: AnswerComment

http://stackoverflow.com/q/22713287
upvote count: 1
type: Question
has answer: http://stackoverflow.com/a/22740640
has title: Spring Web Application context is not returning Struts2 Action methods if proxy advice is created around the action classes
has body: I'm trying to intercept the Struts2's action class's method using Spring AOP but it didn't work. The bean returned from the Spring web Application context, doesn't simply has the Action classes's method (checked using Reflection). But it has only the methods of ActionSupport class(Struts API) which our Action classes extends from. I could see in the log : 16:55:20,328 DEBUG [org.springframework.aop.aspectj.autoproxy.AspectJAwareAdvisorAutoProxyCreator] (http-01h3463916-172.20.211.235-8543-5) Creating implicit proxy for bean 'deviceAction' with 0 common interceptors and 2 specific interceptors 16:55:20,328 DEBUG [org.springframework.aop.framework.JdkDynamicAopProxy] (http-01h3463916-172.20.211.235-8543-5) Creating JDK dynamic proxy: target source is SingletonTargetSource for target object [com.tcs.oss.tims.deviceManagement.action.DeviceAction@70103f6e] 16:55:20,332 DEBUG [org.springframework.beans.factory.support.DefaultListableBeanFactory] (http-01h3463916-172.20.211.235-8543-5) Finished creating instance of bean 'deviceAction' And the action bean object returned is of type: class com.sun.proxy.$Proxy36 Interestingly, other beans(not the action bean) even though they are adviced by spring AOP, the returned proxy object includes all the methods of the bean declared classes. Any help is appreciated...
tagged with: aop
tagged with: struts2
answer count: 1
downvote count: 0
favorite count: 0
tagged with: interceptor
tagged with: spring
type: UnansweredQuestion
score: 1
tagged with: java

http://stackoverflow.com/a/22663621
has comment: http://stackoverflow.com/comment/34521909
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/34522190
has comment: http://stackoverflow.com/comment/34522224
has comment: http://stackoverflow.com/comment/34521973
type: Answer
has body: sub getAClass { return new AClass(); } But why do my $o = AClass-&gt;getAClass(); instead of my $o = AClass-&gt;new();
accepted answer of: http://stackoverflow.com/q/22663545
score: 0
answers question: http://stackoverflow.com/q/22663545

http://stackoverflow.com/comment/73512384
score: 0
comment on: http://stackoverflow.com/a/32235314
type: Comment
has text: I would like to make an addendum, if possible. I believe that [my answer](http://stackoverflow.com/a/43220700/3542189) may help in understanding your answer. Conceptually saying.
type: AnswerComment

http://stackoverflow.com/comment/34675749
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/22748689
type: Comment
has text: @FeatheredOrcian http://docs.oracle.com/javase/7/docs/api/java/lang/Thread.html#setDaemon(boolean) java.lang.Thread

http://stackoverflow.com/q/22648682
favorite count: 0
has body: I have a fully functional Android App (Java) that is missing an Algorithm. I coded this Algorithm in Matlab. I read on another part of this site, that Matlab had the ability to convert Matlab code into C code (up to a certain extent). My question: Is it possible to integrate this with my already functioning java code? Is the Android NDK for starting codes off from C/C++? Is there anyway for me to connect a initialized value from my code to the code in C? Thank you.
tagged with: android
has title: Matlab to C to Android
tagged with: matlab
tagged with: c++
type: AnsweredQuestion
score: 3
downvote count: 0
tagged with: java
tagged with: android-ndk
type: Question
accepted answer: http://stackoverflow.com/a/22656948
has comment: http://stackoverflow.com/comment/34498324
upvote count: 3
answer count: 1
has answer: http://stackoverflow.com/a/22656948

http://stackoverflow.com/comment/34591903
type: Comment
type: QuestionComment
has text: Random note - modifying the for-loop variable inside the loop itself typically makes for rather unreadable, difficult to follow code - it would probably be best to get rid of the while-loop completely. And you can just say `int t = s.charAt(i) - 97;` - there's no need to separate that into 2 lines. And please use `'a'` instead of `97`, as most people don't memorize character codes.
score: 1
comment on: http://stackoverflow.com/q/22701891

http://stackoverflow.com/q/22690066
has title: OpenGL got black screen with glOrtho lwjgl
has comment: http://stackoverflow.com/comment/34584508
has comment: http://stackoverflow.com/comment/34571070
accepted answer: http://stackoverflow.com/a/22702535
score: 0
answer count: 2
possible better answer: http://stackoverflow.com/a/22725761
has answer: http://stackoverflow.com/a/22725761
has comment: http://stackoverflow.com/comment/34570787
has body: So, i making a 2d platformer. I got the texture, controls and everything fine until i decided to make the game to have a scrolling camera. I've read somewhere that said to use glOrtho to move and zoom the camera but when i call glOrtho my screen turns black i know i did something wrong but don't know what to do. I got this before the game loop: glLoadIdentity(); glMatrixMode(GL_PROJECTION); glViewport(0, 0, WINDOW_WIDTH, WINDOW_HEIGHT); glOrtho(0, GAME_WIDTH, GAME_HEIGHT, 0, 1, -1); glMatrixMode(GL_MODELVIEW); *enabling texture_2d and others and i got this on the game loop to make the camera follows the player: glClear(GL_COLOR_BUFFER_BIT); xOff = player.x - GAME.WIDTH / 2; yOff = player.y - GAME.HEIGHT / 2; glOrtho(xOff, xOff + GAME_WIDTH, yOff + GAME_HEIGHT, yOff, 1, -1); But it gives me black screen.. it is fine when i change the values on the first call of glOrtho though.. i already search this prob on google but can't find any help? EDIT: here's the main class package com.org.Game; import static org.lwjgl.opengl.GL11.*; import org.lwjgl.LWJGLException; import org.lwjgl.Sys; import org.lwjgl.input.Keyboard; import org.lwjgl.opengl.Display; import org.lwjgl.opengl.DisplayMode; import com.org.Game.Graphics.Draw; import com.org.Game.Graphics.Sprite; import com.org.Game.Graphics.Spritesheet; import com.org.Game.Level.Level; import com.org.Game.Level.Entity.Mob.Player; public class Main { private static String title = "Platformer"; private static int WINDOW_WIDTH = 800, WINDOW_HEIGHT = 600; private static int GAME_WIDTH = 320, GAME_HEIGHT = 240; private boolean exit = false; private long lastFPS; private int fps; private long lastFrame; private long delta; private boolean fpscap = true; private Level lvl; private Player player; private int xOff, yOff; public Main() { try { Display.setDisplayMode(new DisplayMode(WINDOW_WIDTH, WINDOW_HEIGHT)); Display.setTitle(title); Display.setVSyncEnabled(true); DisplayMode[] modes = Display.getAvailableDisplayModes(); for (int i = …
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/22702535
tagged with: opengl
tagged with: java
tagged with: lwjgl
has comment: http://stackoverflow.com/comment/34633873
type: Question

http://stackoverflow.com/q/22681899
favorite count: 0
possible better answer: http://stackoverflow.com/a/22688499
has title: Google App Engine New Free SNI SSL service Clarification
tagged with: google-app-engine
has comment: http://stackoverflow.com/comment/34554515
type: AnsweredQuestion
tagged with: java
type: Question
has answer: http://stackoverflow.com/a/22733054
tagged with: ssl
score: 4
accepted answer: http://stackoverflow.com/a/22733054
upvote count: 4
answer count: 2
has answer: http://stackoverflow.com/a/22688499
tagged with: google-cloud-platform
downvote count: 0
has body: In the Google Cloud Platform Live Event, Google announced that App Engine prices are reduced; and in their blog site, they mentioned that App Engine SNI SSL Certificate are free with no charges. Questions: Does that mean that SSL for App Engine custom domain is free? If so, how can I add it? Currently, Google Apps console requires me to purchase 5 slots for adding SSL. Thanks!

http://stackoverflow.com/comment/34545234
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/22676405
score: 3
has text: Did you try compiling and running your code?

http://stackoverflow.com/q/22696976
has body: The goal of this project is to create four classes: a Student class, a GradStudent class, a Manager class, and a GUI class. Within the GUI there are two radio buttons: one for Student and one for GradStudent. Depending on which one is selected, the Manager class is supposed to be responsible for creating and storing the Student or GradStudent objects by use of two arrays. I have also added a button to my GUI which is supposed to print the Student array to the JTextArea, however that is where I am running into issues. I get the error "Cannot invoke toString() on the primitive type int". I understand why this is happening, but I don't how to work around it. Any help would be greatly appreciated. Thanks! GUI class import java.awt.GridLayout; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import javax.swing.JButton; import javax.swing.JFrame; import javax.swing.JLabel; import javax.swing.JPanel; import javax.swing.JTextArea; import javax.swing.JTextField; import javax.swing.JRadioButton; import javax.swing.ButtonGroup; public class GUI extends JFrame { private JRadioButton jrbStudent = new JRadioButton("Student"); private JRadioButton jrbGraduate = new JRadioButton("Graduate"); private JTextField name = new JTextField(20); private JTextField address = new JTextField(20); private JTextField balance = new JTextField(20); private JTextField major = new JTextField(20); private JButton jbtSubmit = new JButton("Submit"); private JTextArea echoStudent = new JTextArea(); private JButton printStudentNames = new JButton("Print Student's Names"); private JButton printGradStudentNames = new JButton( "Print Graduate Student's Names"); private JButton calcBalance = new JButton( "Calculate Average Balance of All Students"); private JButton compSciMajor = new JButton( "Displays Computer Science Major Students"); private Manager m1 = new Manager(); public GUI() { // Creates panel P1 and adds the components JPanel p1 = new JPanel(new GridLayout(9, 1, 10, 10)); p…
tagged with: arrays
type: UnansweredQuestion
type: Question
has answer: http://stackoverflow.com/a/22696987
score: 0
answer count: 2
tagged with: swing
tagged with: tostring
tagged with: actionlistener
has title: Trouble printing an array to a JTextArea
has answer: http://stackoverflow.com/a/22697065
tagged with: java

http://stackoverflow.com/comment/34682380
has text: @EGHDK There is no need to put the same inside Activity. Just get rid of static keyword
comment on: http://stackoverflow.com/a/22752625
type: Comment
type: AnswerComment
score: 0

http://stackoverflow.com/comment/34725651
type: Comment
comment on: http://stackoverflow.com/a/22776670
score: 0
type: AnswerComment
has text: So is there a way I can the super method? If not I guessI have to put some logic in the subclass play to call the higher one

oauth-2.0
tags question: http://stackoverflow.com/q/22789625
tag name: oauth-2.0
tags question: http://stackoverflow.com/q/22763934
tags question: http://stackoverflow.com/q/22764556
tags question: http://stackoverflow.com/q/22791863
type: Tag
tags question: http://stackoverflow.com/q/22769467
tags question: http://stackoverflow.com/q/22695870

http://stackoverflow.com/comment/34668680
has text: @JonSkeet I know you can help me! :P
type: Comment
comment on: http://stackoverflow.com/q/22698658
score: 0
type: QuestionComment

http://stackoverflow.com/a/22807582
upvote count: 2
answers question: http://stackoverflow.com/q/22807449
has body: ... and everything else I can think just makes it less readable Depending on whether you prefer readability over correctness or not, you could consider public double foo(Double a, Double b) { if (a == null) { if (b == null) { return 0; } return 999999; } if (b == null) { return 999999; } return b - a; } BTW: This 999999 looks suspicious. Maybe this should rather be Double.POSITIVE_INFINITY or Double.MAX_VALUE or so, but sure it depends on the intended usage.
has comment: http://stackoverflow.com/comment/34780995
score: 2
downvote count: 0
type: Answer
has comment: http://stackoverflow.com/comment/34781101

http://stackoverflow.com/comment/34749777
type: AnswerComment
score: 0
comment on: http://stackoverflow.com/a/22786474
type: Comment
has text: What I'm saying is that `abs(a % b) != abs(a) % abs(b)`. The latter is mathematically correct but the former isn't.

http://stackoverflow.com/q/22745390
has comment: http://stackoverflow.com/comment/34668966
type: Question
has body: Note: feel free to edit/comment if this wait and notify uses incorrect syntax. You have a class that has a calculation that is only done by a different thread: class Foo{ public Foo() { //so thread 2 can know about us. So much for design patterns. synchronized(GlobalStuff) {GlobalStuff.threadpool.add(this);} } Bar b; public Bar emptyBar() { //called by thread #1 ("your" thread). synchronized(this) { b = new Bar(); return b; } } public void makeTest() { //Thread #2 periodically runs this block of code. synchronized(this) { if (b==null) {return;} //do nothing if it is still null. if (b.hasBeenMadeIntoExam();) {return;} //do nothing if it is done already. b.makeMeAnAnnoyingExam(); .... this.notifyAll(); //do we even need the "this"? } } } Here is how you wait for it: //thread 1 runs this block of code. Foo fooey = new Foo(); Bar b = fooey.emptyBar(); while( b.equals(fooey.emptyBar()) ) { //some statement to check whether it is done or not try { //mandatory try catch statements to keep Java verbose. fooey.makeTest(); fooey.wait(); //wait, and fooey will free us when it calls notifyAll() } catch (InterruptedException ex) {} } .... //more code that depends on the exam being made. My concern is that b's fields are not volatile (even if we changed b to be volatile), so when thread #2 updates them, they don't immediately appear for thread 1. Remember, synchronizing and notify are not "deep" so they don't meticulously update the state of all sub-classes. Do I need to worry about it? Is there a way to fix this without manually sticking "volatile" everywhere?
tagged with: java
tagged with: concurrency
tagged with: notify
score: 0
answer count: 2
tagged with: wait
has title: Java sub-class updateting with wait-notify
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/22824501
has answer: http://stackoverflow.com/a/22745558

http://stackoverflow.com/q/22688713
has comment: http://stackoverflow.com/comment/34566724
score: 6
has title: Jackson ObjectMapper DeserializationConfig.Feature.ACCEPT_EMPTY_STRING_AS_NULL_OBJECT
tagged with: json-deserialization
tagged with: java
tagged with: http://stackoverflow.com/tag/json
has answer: http://stackoverflow.com/a/22694272
type: Question
answer count: 1
downvote count: 1
tagged with: jackson
favorite count: 0
has comment: http://stackoverflow.com/comment/55641375
upvote count: 7
linked to: http://stackoverflow.com/q/30841981
has body: I am using Jackson for JSON serialization/deserialization in my Jersey application. I want to read the empty strings in JSON to null value in my java POJO property. I tried to set the DeserializationConfig.Feature.ACCEPT_EMPTY_STRING_AS_NULL_OBJECT on Object Mapper but it is not working. Here is the code below import java.io.IOException; import org.codehaus.jackson.JsonParseException; import org.codehaus.jackson.map.DeserializationConfig; import org.codehaus.jackson.map.JsonMappingException; import org.codehaus.jackson.map.ObjectMapper; public class TestMapper { /** * @param args */ public static void main(String[] args) { TestMapper.testJson(); } public static void testJson(){ String jsonString = "{\"name\":\"First Name\",\"phone\":\"\",\"unknown\":\"test\"}"; ObjectMapper result = new ObjectMapper(); //result.setDeserializationConfig(result.getDeserializationConfig().with(DeserializationConfig.Feature.ACCEPT_EMPTY_STRING_AS_NULL_OBJECT)); //result.enable(DeserializationConfig.Feature.ACCEPT_EMPTY_STRING_AS_NULL_OBJECT); /*DeserializationConfig deserializeConfig = result.getDeserializationConfig(); deserializeConfig.with(DeserializationConfig.Feature.ACCEPT_EMPTY_STRING_AS_NULL_OBJECT);*/ result.configure(DeserializationConfig.Feature.ACCEPT_EMPTY_STRING_AS_NULL_OBJECT, true); result.configure(DeserializationConfig.Feature.FAIL_ON_UNKNOWN_PROPERTIES, false); try { TestBean testBean = result.readValue(jsonString, TestBean.class); if(testBean.getPhone()!=null&amp;&amp; testBean.getPhone().equals("")){ System.out.print("Phone Number is empty string"); }else{ System.out.print("Phone Number is null"); } } catch (JsonParseException e) { // TODO Auto-generated catch block e.printStackTrace(); } catch (JsonMappingException e) { // TODO Auto-generated catch block e.printStackTrace(); } catch (IOException e) { // TODO Auto-generated catch block e.printStackTrace(); } } } The bean is as below public class TestBean { private String name; private String phone; public String get…
type: UnansweredQuestion

http://stackoverflow.com/a/37946471
has body: Maven dependency The first thing you need to do is to set up the following Hibernate Types Maven dependency in your project pom.xml configuration file: com.vladmihalcea hibernate-types-52 ${hibernate-types.version} Domain model Now, if you are using PostgreSQL, you need to use the JsonType from Hibernate Types. In order to use it in your entities, you will have to declare it on either class level or in a package-info.java package-level descriptor, like this: @TypeDef(name = "json", typeClass = JsonType.class) And, the entity mapping will look like this: @Type(type = "json") @Column(columnDefinition = "json") private Location location; If you're using Hibernate 5 or later, then the JSON type is registered automatically by the Postgre92Dialect. Otherwise, you need to register it yourself: public class PostgreSQLDialect extends PostgreSQL91Dialect { public PostgreSQL92Dialect() { super(); this.registerColumnType( Types.JAVA_OBJECT, "json" ); } } The JsonType works with Oracle, SQL Server, PostgreSQL, MySQL, and H2 as well. Check out the project page for more details about how you can map JSON column types on various relational database systems.
downvote count: 0
type: Answer
has comment: http://stackoverflow.com/comment/76223588
upvote count: 7
has comment: http://stackoverflow.com/comment/76224207
score: 7
answers question: http://stackoverflow.com/q/22729740

http://stackoverflow.com/a/22679120
has body: If you want to list as view you should extend listview instead list activity and manage according to requirement. you can make customize row in xml for list view
type: Answer
answers question: http://stackoverflow.com/q/22677143
score: 0

http://stackoverflow.com/a/45939277
type: Answer
downvote count: 0
has body: If you are on ec2 and wanted to do mvn build then use -T option which tells maven to use number of threads while doing build eg:mvn -T 10 clean package
score: 3
upvote count: 3
answers question: http://stackoverflow.com/q/22805552

http://stackoverflow.com/q/22730138
tagged with: client
favorite count: 0
tagged with: multithreading
upvote count: 1
has answer: http://stackoverflow.com/a/22730388
type: AnsweredQuestion
tagged with: network-programming
score: 1
tagged with: java
type: Question
accepted answer: http://stackoverflow.com/a/22730388
downvote count: 0
has title: Thread server/client stops after 2nd client joins
has body: I have a server which uses multiple threads to accept multiple clients. I have it at the moment that when a client types something, it appears on the server as Client: text This works fine for 1 client. However the problem is when a second client joins. They join fine and they can type fine. But the first client can only type 1 more thing then they stop, i.e their messages doesn't appear on the server. I presume they can do 1 as the method has been started but doesn't repeat. I've tried a while (true) loop (as seen in the code) and recalling the method at the end, neither work. I'm new to programming so don't have much expertise in this. Please find the code below :) (Note, indention is correct, just hasn't copied across properly) Server: package dod; import java.net.*; import java.util.*; import java.util.concurrent.atomic.AtomicInteger; import java.io.*; public class Server implements Runnable { PrintWriter out; BufferedReader in; Socket clientSocket; ServerSocket serverSocket; int portNumber; AtomicInteger numClients = new AtomicInteger(0); public static void main(String[] args) { Server s = new Server(); s.startup(); } public void run() {} /** * Start the server on the user picked port */ public void startup() { try { System.out.println("Enter a port"); Scanner dif = new Scanner(System.in); portNumber = Integer.parseInt(dif.nextLine()); dif.close(); serverSocket = new ServerSocket(portNumber); newThread(); } catch (IOException e) { System.out.println("Error"); System.exit(0); } } public void newThread() { Thread thread =new Thread("C"+numClients.getAndIncrement()) { public void run() { accept(); } }; thread.start(); } public void accept() { try { clientSocket = serverSocket.accept(); System.out.println("A new client has just connected."); } catch(IOException e) { System.out.println("error"); System.exit(0); } newThread(); listenCommand(); } public void listenCommand() { while (true) { try { out = new PrintWriter(clientSocket.getOutputStream(), true); in = new Bu…
answer count: 1

http://stackoverflow.com/a/22699034
has comment: http://stackoverflow.com/comment/34586088
answers question: http://stackoverflow.com/q/22698954
has body: Simply create a file arrays.xml under the res/values directory. Then you can add in your elements like: lorem ipsum dolor sit amet You can then access this as R.array.items
score: 0
has comment: http://stackoverflow.com/comment/34586224
type: Answer
has comment: http://stackoverflow.com/comment/34586510

http://stackoverflow.com/comment/34583910
type: QuestionComment
score: 0
has text: Are you trying to get the value of `#{zoo.cat.weight}` from a ManagedBean? If is the case, you only need have declare your cat and getWeight and only do reference from your bean
comment on: http://stackoverflow.com/q/22697935
type: Comment

http://stackoverflow.com/a/50534923
has body: In my project we use chained accessors across the board, so setting chain=false was not an option. I ended up writing my own introspector, which is similar to the one recommended by @mthielcke, and may be registered in the same way. Introspector import org.apache.commons.beanutils.BeanIntrospector; import org.apache.commons.beanutils.IntrospectionContext; import java.beans.IntrospectionException; import java.beans.Introspector; import java.beans.PropertyDescriptor; import java.lang.reflect.Method; import java.lang.reflect.Modifier; import java.util.HashMap; import java.util.Locale; import java.util.Map; import java.util.stream.Stream; import lombok.extern.slf4j.Slf4j; /** * Allows {@link org.apache.commons.beanutils.BeanUtils#copyProperties(Object, Object)} to copy properties across beans whose * properties have been made fluent through Lombok * {@link lombok.experimental.Accessors}, {@link lombok.Setter} and {@link lombok.Getter} annotations. * * @author izilotti */ @Slf4j public class LombokPropertyBeanIntrospector implements BeanIntrospector { /** * Performs introspection. This method scans the current class's methods for property write and read methods which have been * created by the Lombok annotations. * * @param context The introspection context. */ @Override public void introspect(final IntrospectionContext context) { getLombokMethods(context).forEach((propertyName, methods) -> { if (methods[0] != null && methods[1] != null) { final PropertyDescriptor pd = context.getPropertyDescriptor(propertyName); try { if (pd == null) { PropertyDescriptor descriptor = new PropertyDescriptor(propertyName, methods[1], methods[0]); context.addPropertyDescriptor(descriptor); } } catch (final IntrospectionException e) { log.error("Error creating PropertyDescriptor for {}. Ignoring this property.", propertyName, e); } } }); } private Map<String, Method[]> getLombokMethods(IntrospectionContext context) { Map<String, Method[]> lombokPropertyMethods = new HashMap<>(); // property…
answers question: http://stackoverflow.com/q/22743765
downvote count: 0
type: Answer
score: 2
upvote count: 2

http://stackoverflow.com/q/22768882
has comment: http://stackoverflow.com/comment/34711655
has comment: http://stackoverflow.com/comment/34726967
score: 0
has body: I have created a project with eclipse and I have used selenium to access a FireFox driver and find specific url-s by searching in the html. I have managed to successfully execute the app in my Windows computer, and I get the correct url that I was searching for. But when I export the project and try to execute the project on a Mac, the app doesn't find any web element. My code is: List&lt;WebElement&gt; urls = driver.findElements(By.xpath("//ul[@class='classname']//li[starts-with(@data-key,'month')]//a")); Is XPath system dependent? How can I modify this code in order to execute it on a Mac computer? Thanks in advance!
answer count: 0
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/34727555
tagged with: selenium-webdriver
has comment: http://stackoverflow.com/comment/34758711
tagged with: java
tagged with: eclipse
has comment: http://stackoverflow.com/comment/34722401
type: Question
has title: Is XPath to find Web Elements with selenium dependent on system where they are executed?
has comment: http://stackoverflow.com/comment/34711727

http://stackoverflow.com/comment/50454318
has text: this is fine work to me.
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/22691468
score: 0

http://stackoverflow.com/comment/34726206
comment on: http://stackoverflow.com/q/22776968
score: 0
type: Comment
type: QuestionComment
has text: @SotiriosDelimanolis java -version java version "1.8.0" Java(TM) SE Runtime Environment (build 1.8.0-b132) Java HotSpot(TM) 64-Bit Server VM (build 25.0-b70, mixed mode)

http://stackoverflow.com/comment/34777553
type: QuestionComment
comment on: http://stackoverflow.com/q/22805324
score: 0
has text: Set the layout manager of the bottom panel to BorderLayout, add the second to it, probably also using a BorderLayout
type: Comment

http://stackoverflow.com/comment/78832158
type: Comment
has text: Hi, what is the schema for hj namespace? I am asking because I would like to add these binding settings directly into XSD schema itself.
type: AnswerComment
score: 0
comment on: http://stackoverflow.com/a/22747610

http://stackoverflow.com/q/22697315
has answer: http://stackoverflow.com/a/33880002
has title: Calling python module from Java
downvote count: 1
has comment: http://stackoverflow.com/comment/34585808
tagged with: java
score: 10
type: Question
has comment: http://stackoverflow.com/comment/34588423
answer count: 1
has body: I want to call a function from a python module from Java using "PythonInterpreter" and here's my Java code PythonInterpreter interpreter = new PythonInterpreter(); interpreter.exec("import sys\nsys.path.append('C:\\Python27\\Lib\\site-packages')\nimport helloworld"); PyObject someFunc = interpreter.get("helloworld.getName"); PyObject result = someFunc.__call__(); String realResult = (String) result.__tojava__(String.class); System.out.println(realResult); and the Python code (helloworld.py) is below: from faker import Factory fake = Factory.create() def getName(): name = fake.name() return name The problem I'm facing is while I'm calling interpreter.get when it returns a null PyObject. Any idea what's going wrong? The python code runs fine from IDLE EDIT I just did a bit of change in the code as below PythonInterpreter interpreter = new PythonInterpreter(); interpreter.exec("import sys\nsys.path.append('C:\\Python27\\Lib\\site-packages')\nimport helloworld"); PyInstance wrapper = (PyInstance)interpreter.eval("helloworld" + "(" + ")"); PyObject result = wrapper.invoke("getName()"); String realResult = (String) result.__tojava__(String.class); System.out.println(realResult); and I introduced a class in my python module from faker import Factory class helloworld: def init(self): fake = Factory.create() def getName(): name = fake.name() return name Now am getting the error below Exception in thread "main" Traceback (innermost last): File "&lt;string&gt;", line 1, in ? TypeError: call of non-function (java package 'helloworld')
has comment: http://stackoverflow.com/comment/34588453
has comment: http://stackoverflow.com/comment/34585568
tagged with: python
upvote count: 11
favorite count: 0
type: UnansweredQuestion

http://stackoverflow.com/a/22703831
accepted answer of: http://stackoverflow.com/q/22702788
answers question: http://stackoverflow.com/q/22702788
has body: I found the solution, just when I get rid of cometd and simply transfer JSON string to JSONObject, it throws Exception. It turns out that the library commons-lang-1.0.1.jar I imported was too old. After I import commons-lang-2.6.jar and delete commons-lang-1.0.1.jar, everything's fine. Note that though I have imported commons-lang3-3.0.1.jar earlier, it still won't work at all. I think it's because the comman-lang after 3.0 use a different package as Apache Commons said: Note that Lang 3.0 (and subsequent versions) use a different package (org.apache.commons.lang3) than the previous versions (org.apache.commons.lang), allowing it to be used at the same time as an earlier version. However, it's weird that it didn't throw any Exception while integrated with cometd, maybe it's catched by glassfish?
type: AcceptedAnswer
score: 0
type: Answer

http://stackoverflow.com/a/22788573
accepted answer of: http://stackoverflow.com/q/22785956
score: 0
type: AcceptedAnswer
has body: android:textCursorDrawable="@drawable/my_cursor"
answers question: http://stackoverflow.com/q/22785956
type: Answer

http://stackoverflow.com/q/22674995
has answer: http://stackoverflow.com/a/22675091
upvote count: 1
has title: CraftBukkit Plugin Coding Error
accepted answer: http://stackoverflow.com/a/22675091
type: AnsweredQuestion
score: 1
tagged with: java
tagged with: bukkit
tagged with: eclipse
type: Question
answer count: 1
downvote count: 0
tagged with: minecraft
has body: I am making a simple /heal Bukkit plugin for CraftBukkit Beta Build 1.7.2 R0.3. (I'm new to java.) I am programming in Eclipse. I'm getting an error that says: Here is my code: public boolean onCommand_heal(CommandSender sender, Command cmd, String commandLabel, String[] args){ Player player = (Player) sender; if(commandLabel.equalsIgnoreCase("heal")){ if(args.length == 0){ player.setHealth(20); player.setFireTicks(0); player.sendMessage(ChatColor.GOLD + "You are healed!"); }else if(args.length == 1){ if(player.getServer().getPlayer(args[0]) !=null){ Player targetPlayer = player.getServer().getPlayer(args[0]); targetPlayer.setHealth(20); player.sendMessage(ChatColor.GOLD + "Player Healed!"); }else{ player.sendMessage(ChatColor.RED + "PLAYER NOT ONLINE!"); } } } return false; }
favorite count: 0

http://stackoverflow.com/q/22683576
has answer: http://stackoverflow.com/a/29188715
has answer: http://stackoverflow.com/a/22683868
type: UnansweredQuestion
has title: Memory Requirement of Commons Math: The Apache Commons Mathematics Library
tagged with: apache-commons
score: 0
tagged with: java
tagged with: apache-commons-math
has comment: http://stackoverflow.com/comment/34557923
type: Question
answer count: 2
has body: I would like to know if all the operations in Apache Commons Math are in memory operations. I am particularly interested in OLSMultipleLinearRegression and using this for big data. Also is there any existing JAVA API for running regression on big data.

http://stackoverflow.com/comment/34762326
comment on: http://stackoverflow.com/q/22796884
type: Comment
score: 1
type: QuestionComment
has text: If you're going to use bracketless `if` statements, you should at least put the statement close to the `if` statement lest you accidentally enter another statement in between the `if` and the `System.out.println` later on because it's not clearly in brackets. It's generally a good habit to always use brackets with if statements in Java. I don't sometimes, but I make sure it's very clear. Spreading it out makes it even more confusing/unsightly.

http://stackoverflow.com/comment/34769642
type: AnswerComment
score: 0
type: Comment
comment on: http://stackoverflow.com/a/22801086
has text: I can, but step 1 is on a different thread. So that thread keeps on running , and keeps accepting the messages. So the client reply from Step 3 is received on that thread. Where as I want this reply specifically to step 3. I am sorry if my question was not clear.

http://stackoverflow.com/a/22677519
score: 2
answers question: http://stackoverflow.com/q/22677450
downvote count: 0
has body: These are not called inner classes but "static nested classes". They are declared static within their outer class, which means that they can exist without an instantiation of the outer class. They are really just a normal class that is defined inside another class in order to make the code easier to read and better grouped. For more information, see Java's documentation
upvote count: 2
type: Answer

http://stackoverflow.com/a/22679350
has comment: http://stackoverflow.com/comment/34550845
has comment: http://stackoverflow.com/comment/34550482
answers question: http://stackoverflow.com/q/22679052
has body: What you can do is to create a variable string, store the file name, and pass that string into the File file=new File(string);
score: 0
has comment: http://stackoverflow.com/comment/34551258
type: Answer
upvote count: 2
has comment: http://stackoverflow.com/comment/34550318
has comment: http://stackoverflow.com/comment/34551150
downvote count: 2

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

http://stackoverflow.com/comment/78161308
score: 0
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/45567437
has text: The discrepancy can vary from 0 to about 3% depending on the tempo. You can work it out if you look at the bit pattern. A tempo of 120 bpm represents an mpq of 500000. This in binary is 001111010000100100000. If you split this into three groups of seven bits and convert to decimal you get 30 66 32. If you have this tempo in your program and do System.out.println(data[0] + " " + data[1] + " " + data[2]); you will get 30 66 32. I can't find anything in the Midi specification that says binary variables should be signed or unsigned but it does look like Java is using signed variables.

http://stackoverflow.com/q/22759281
answer count: 4
has comment: http://stackoverflow.com/comment/34694689
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/22759311
tagged with: java
tagged with: multithreading
has answer: http://stackoverflow.com/a/22759400
type: Question
has answer: http://stackoverflow.com/a/22759317
accepted answer: http://stackoverflow.com/a/22759311
has body: Hi, I'm a novice java programmer towards thread. And I'm stuck on this simple Java program public class Multi extends Thread{ public void run() { try{ System.out.println("running..."); } catch(Exception e){ System.out.print(e); } } public static void main(String[] args){ Multi t1=new Multi(); t1.run();//fine, but does not start a separate call stack } }
score: 0
possible better answer: http://stackoverflow.com/a/22759370
has answer: http://stackoverflow.com/a/22759370
has title: Simple thread program doesn't work
linked to: http://stackoverflow.com/q/541487

http://stackoverflow.com/q/22698231
has comment: http://stackoverflow.com/comment/34584544
score: 0
answer count: 1
tagged with: arrays
has comment: http://stackoverflow.com/comment/34584792
has comment: http://stackoverflow.com/comment/34590074
tagged with: rest
has body: I has an ios app which sends a http request to a REST service I have running on a local server. The server gets some information from the Twitter api and then sends it back to the ios app. I have put the data I want to send back in a JSONArray. How do I go about sending this array back as a response to the request. I have included the method that receives the request and which initially sent back a string. I would like to change so it sends back the "returnedArray" array instead. @Path("/hello") public class HelloResource { @GET @Produces(MediaType.TEXT_PLAIN) public String sayHello() throws JSONException { String convert = null; JSONArray returnedArray = new JSONArray(); try { returnedArray = TweetUsingTwitter4jExample.getTweets(); } catch (IOException e) { // TODO Auto-generated catch block e.printStackTrace(); } catch (TwitterException e) { // TODO Auto-generated catch block e.printStackTrace(); } return convert; } }
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/34589375
has comment: http://stackoverflow.com/comment/34591011
tagged with: java
has comment: http://stackoverflow.com/comment/34584551
has title: How to return a JSON Array from java server to ios app
type: Question
has comment: http://stackoverflow.com/comment/34590257
has answer: http://stackoverflow.com/a/22698336
tagged with: ios
tagged with: http://stackoverflow.com/tag/json

http://stackoverflow.com/a/22781315
answers question: http://stackoverflow.com/q/22780997
has comment: http://stackoverflow.com/comment/34738005
has comment: http://stackoverflow.com/comment/34737796
has comment: http://stackoverflow.com/comment/34735496
has comment: http://stackoverflow.com/comment/34734672
has comment: http://stackoverflow.com/comment/34733922
has body: Edited >>>>> Tested this Working fine Make sure your views fit into the screen if(first_set.getVisibility()!= View.VISIBLE){ zoomed_image.setVisibility(View.GONE); first_set.setVisibility(View.VISIBLE); }else if(zoomed_image.getVisibility() != View.VISIBLE){ first_set.setVisibility(View.GONE); zoomed_image.setVisibility(View.VISIBLE); }
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/34735634
score: 0
has comment: http://stackoverflow.com/comment/34734803
accepted answer of: http://stackoverflow.com/q/22780997
type: Answer

http://stackoverflow.com/comment/34679167
comment on: http://stackoverflow.com/a/22750674
type: Comment
score: 2
type: AnswerComment
has text: But it's in a do-while loop. catLevel is set on the next line, the line below the if block. If what you're saying is true, why does rest get called when you run the program? I agree that catLevel is ***initially*** null, but only when the while loop runs the first time. After that it is always non-null. Again, re-read the code, or even better, put a SOP in the rest method and see that it in fact prints out.

http://stackoverflow.com/comment/34578704
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/22694596
has text: @Sam I updated the question at 'The output is' part (added some prints in the code).
score: 0

http://stackoverflow.com/q/22686297
has comment: http://stackoverflow.com/comment/34565800
score: 0
answer count: 1
tagged with: string
tagged with: byte
type: UnansweredQuestion
has body: I am trying to convert a byte array to a java string using the following codes: //strInput is a binary string byte[] bval = new BigInteger(strInput, 2).toByteArray(); strOutput = new String(bval, "UTF-8"); I encounter no problem when the target output contains alphanumeric or symbols (e.g. % &amp; * $) only. However, I keep getting an extra NULL character at the beginning of the output when it contains pure japanese characters. My first guess was maybe it has something to do with signed/unsigned bytes. But when I tried to get the 2s complement of the input, I get garbage characters as output. Do you guys have other ideas about where that extra NULL character comes from? ------- UPDATE ------ I read somewhere here in stackoverflow that trim() also removes NUL characters aside from whitespace, so I tried that. It has worked well so far for other inputs with japanese characters. Is this safe to use? Or should I really just find an alternative to using BigInteger? Thanks!
has title: Converting bytes to java string (possibly kanji)
has comment: http://stackoverflow.com/comment/34564496
tagged with: java
has comment: http://stackoverflow.com/comment/34564994
type: Question
has comment: http://stackoverflow.com/comment/34562186
has comment: http://stackoverflow.com/comment/34566014
has answer: http://stackoverflow.com/a/22686356
has comment: http://stackoverflow.com/comment/34566502
has comment: http://stackoverflow.com/comment/34562182

http://stackoverflow.com/comment/34541513
comment on: http://stackoverflow.com/q/22673705
type: QuestionComment
has text: Oops, misunderstood, apologies, it's been deleted
score: 0
type: Comment

http://stackoverflow.com/q/22761994
has title: Change last fragment to another layout
type: Question
has comment: http://stackoverflow.com/comment/34699546
score: 0
tagged with: android
answer count: 0
type: UnansweredQuestion
tagged with: fragment
has comment: http://stackoverflow.com/comment/34700203
tagged with: android-layout
tagged with: android-fragments
tagged with: java
has body: I have made fragments dynamically, it depends on number of questions, for example a test have 10 questions, there will be 10 fragments, but I want to make a final fragment after the questions are done, to see the score of those questions, I want to know how to put another fragment after this questions Fragment are done This is my getItem() method @Override public Fragment getItem(int i) { List&lt;Question&gt; questions = currentTest.getQuestions(); FragmentQuestion myfragment; currentQ = questions.get(i); myfragment = new FragmentQuestion(); myfragment.setCurrentTest(currentTest); myfragment.setCurrentQuestion(currentQ); return myfragment; }

http://stackoverflow.com/comment/34604325
type: AnswerComment
type: Comment
has text: Note: I didn't say it wasn't “more exact”. I said it was exact for a different set of numbers than `double` (`double` is exact for lots of numbers and it is possible to do long sequences of exact `double` computations if you know what you are doing), and that “If you need an exact result, you should look into BigDecimal” was a mischaracterization. Let me put it this way: I would like the exact result of 1 divided by 3. It is a waste of time to “look into BigDecimal” for this elementary operation. It won't work.
comment on: http://stackoverflow.com/a/22707998
score: 0

http://stackoverflow.com/comment/34750151
has text: Check your java class's file name.Is it OutputToAFileBrocEast.java?
comment on: http://stackoverflow.com/q/22790368
score: 0
type: QuestionComment
type: Comment

http://stackoverflow.com/comment/34702803
type: QuestionComment
score: 0
comment on: http://stackoverflow.com/q/22763757
has text: Do not use variable names `a` and `c`. Use meaningful variable names like `frontNode` and `currentUser`
type: Comment

http://stackoverflow.com/comment/34728819
has text: This is the best way to do this. Don't mess with inserting a button as a child component of a text field, it's very difficult to get it right, and has virtually no benefits. This answer is very complete and explanatory, I would have voted it up twice if I could :-) Way to go !
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/22778391
type: Comment

http://stackoverflow.com/comment/53889355
type: AnswerComment
has text: @bcody Yes see also: http://stackoverflow.com/questions/25391656/serialization-of-a-lambda-after-its-creation
comment on: http://stackoverflow.com/a/22808112
type: Comment
score: 3

http://stackoverflow.com/a/22795051
score: 7
type: AcceptedAnswer
downvote count: 0
type: Answer
answers question: http://stackoverflow.com/q/22671897
upvote count: 7
has body: I figured it out! It looks like this! String payLoadLogin = "blahblahblah" HttpPost httppost = new HttpPost(postAddress); httppost.setHeader("X-GWT-Permutation", "3DE824138FE65400740EC1816A73CACC"); httppost.setHeader("Content-Type", "text/x-gwt-rpc; charset=UTF-8"); StringEntity se = new StringEntity(payLoadLogin ); httppost.setEntity(se);
accepted answer of: http://stackoverflow.com/q/22671897

http://stackoverflow.com/q/22694804
answer count: 2
upvote count: 0
has answer: http://stackoverflow.com/a/22695005
favorite count: 0
has comment: http://stackoverflow.com/comment/34578012
has comment: http://stackoverflow.com/comment/34579144
has comment: http://stackoverflow.com/comment/34578033
has comment: http://stackoverflow.com/comment/34578091
type: UnansweredQuestion
downvote count: 1
has body: i have to problems trying to shuffle the values of an array and returning them. I have to ask the user if it wants to shuffle using a loop, if the users answers "y" then display the shuffle values if the answers is "n" then get out of the loop. I would appreciate any help. Here is what i have so far. Main class package lab4b; import java.util.Scanner; public class Lab4B { public static void main(String[] args) { final int size = 15; char q = 'y'; boolean flag = false; Shuffler myShuffler = new Shuffler(size); myShuffler.display(); System.out.println(); Scanner input = new Scanner(System.in); System.out.printf("Do you wish to shuffle this numbers? "); String input2 = input.next(); myShuffler.shuffle(); myShuffler.display(); System.out.printf("Do you wish to shuffle this numbers? "); input.close(); } } Shuffler class package lab4b; import java.util.Random; public class Shuffler { private int[] data; public Shuffler(int size) { data = new int[size]; for (int i = 0; i &lt; size; i++) { data[i] = i + 1; } } public void shuffle() { for (int i = 0; i &lt; data.length; i++) { Random r = new Random(15); int second = r.nextInt(15) + 1; int temp = data[i]; data[i] = data[second]; data[second] = temp; } } public void display() { String values = ""; for (int i = 0; i &lt; data.length; i++) { if (i &lt; 15) { values += (i + 1); if (i &lt; 14) { values += ", "; } } } System.out.printf("Array Contents: %s \n", values); } }
type: Question
tagged with: java
score: -1
has answer: http://stackoverflow.com/a/22694900
has title: Array shuffle java

http://stackoverflow.com/a/22754988
has body: Here is a good example for JSON parsing with Jackson JsonParser: http://www.mkyong.com/java/jackson-streaming-api-to-read-and-write-json/ I just parse the users into objects and put them with the id as the key into a hashmap. Afterwards I parse the posts. If I get to an ID, I get the user object by the id as the key from the hashmap. It's not as simple as using the ObjectMapper, but it works and is really fast.
score: 0
type: Answer
answers question: http://stackoverflow.com/q/22657409

http://stackoverflow.com/comment/34641336
type: Comment
score: 4
has text: Don't use a Reader to read bytes. Use an InputStream. Reader/Writer are for characters. InputStream/OutputStream are for bytes.
type: QuestionComment
comment on: http://stackoverflow.com/q/22729692

http://stackoverflow.com/q/22768063
answer count: 1
downvote count: 0
score: 1
accepted answer: http://stackoverflow.com/a/22768445
favorite count: 0
has body: i write a custom spring scope base on FacesContext Logique, public class DynamicScope implements Scope{ @Override public Object get(String name, ObjectFactory&lt;?&gt; objectFactory) { AbsErpFolder erpFolder = null; if (FacesContext.getCurrentInstance()!=null) erpFolder = (AbsErpFolder)FacesUtils.getExternalContext(). getRequestMap().get( ErpFolderKey ); ............ } Now i need to instanciate a bean in FileServlet Filter using WebApplicationContext wsc = WebApplicationContextUtils.getWebApplicationContext(config.getServletContext()); IGenericService erpFileService = (IGenericService) wsc.getBean("erpFileService"); The problem is during the execution my ServletFile the current FacesContext is null (the dynamic scope can't work ) so how to get the current request ?
upvote count: 1
tagged with: request
tagged with: spring
type: AnsweredQuestion
tagged with: jsf
has title: Get current request in Custom Spring Scope
tagged with: java
type: Question
has answer: http://stackoverflow.com/a/22768445
tagged with: servlets

http://stackoverflow.com/comment/43240284
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/26588822
score: 1
has text: Thanx David, I stumbled upon exactly this need ;) But this is the first version, I need a version which computes the cartesian product of variable size list of Observables. Trickier.

http://stackoverflow.com/comment/34543959
score: 2
comment on: http://stackoverflow.com/q/22675651
has text: Yes, there is a way. (I'm going to assume that doesn't help very much. Don't ask questions backwards. You really mean: 'How do you...?')
type: QuestionComment
type: Comment

http-redirect
tags question: http://stackoverflow.com/q/22694559
tags question: http://stackoverflow.com/q/22791863
type: Tag
tags question: http://stackoverflow.com/q/22766879
tags question: http://stackoverflow.com/q/22802837
tag name: http-redirect
tags question: http://stackoverflow.com/q/22707757

http://stackoverflow.com/comment/34600121
score: 1
comment on: http://stackoverflow.com/q/22706483
type: Comment
type: QuestionComment
has text: what JRE version you are using?

http://stackoverflow.com/comment/34670442
type: Comment
score: 0
comment on: http://stackoverflow.com/a/22746043
type: AnswerComment
has text: yes when you synchronize the class. It will be used by one thread irrespective of instances. but in your case though it will be used by one thread at a time. Each thread will modify it's own instance's i. because i is not shared.

jsp
tags question: http://stackoverflow.com/q/22754494
tags question: http://stackoverflow.com/q/22790214
tags question: http://stackoverflow.com/q/22785447
tags question: http://stackoverflow.com/q/22777111
tags question: http://stackoverflow.com/q/22798338
tags question: http://stackoverflow.com/q/22804721
tags question: http://stackoverflow.com/q/22751696
tags question: http://stackoverflow.com/q/22703079
tags question: http://stackoverflow.com/q/22696988
tags question: http://stackoverflow.com/q/22707514
tags question: http://stackoverflow.com/q/22683341
tags question: http://stackoverflow.com/q/22768620
tags question: http://stackoverflow.com/q/22782026
tags question: http://stackoverflow.com/q/22676950
tags question: http://stackoverflow.com/q/22651075
tags question: http://stackoverflow.com/q/22727804
tags question: http://stackoverflow.com/q/22704117
tags question: http://stackoverflow.com/q/22764299
tags question: http://stackoverflow.com/q/22663917
tags question: http://stackoverflow.com/q/22709357
tags question: http://stackoverflow.com/q/22656241
tags question: http://stackoverflow.com/q/22659114
tags question: http://stackoverflow.com/q/22685742
tags question: http://stackoverflow.com/q/22735014
tags question: http://stackoverflow.com/q/22654521
tags question: http://stackoverflow.com/q/22755795
tags question: http://stackoverflow.com/q/22723962
tags question: http://stackoverflow.com/q/22745704
tags question: http://stackoverflow.com/q/22758227
tags question: http://stackoverflow.com/q/22762492
tags question: http://stackoverflow.com/q/22755456
tags question: http://stackoverflow.com/q/22758420
tags question: http://stackoverflow.com/q/22802121
tags question: http://stackoverflow.com/q/22708288
tags question: http://stackoverflow.com/q/22679261
tags question: http://stackoverflow.com/q/22718104
tags question: http://stackoverflow.com/q/22791446
tags question: http://stackoverflow.com/q/22751888
tags question: http://stackoverflow.com/q/22731159
tags question: http://stackoverflow.com/q/22685243
tags question: http://stackoverflow.com/q/22806346
tags question: http://stackoverflow.com/q/22691230
tags question: http://stackoverflow.com/q/22679712
tags question: http://stackoverflow.com/q/22651670
tags question: http://stackoverflow.com/q/22705107
tags question: http://stackoverflow.com/q/22690163
tags question: http://stackoverflow.com/q/22654350
tags question: http://stackoverflow.com/q/22787412
tags question: http://stackoverflow.com/q/22686210
tags question: http://stackoverflow.com/q/22756186
tags question: http://stackoverflow.com/q/22664157
tags question: http://stackoverflow.com/q/22691732
tags question: http://stackoverflow.com/q/22694899
type: Tag
tags question: http://stackoverflow.com/q/22685651
tags question: http://stackoverflow.com/q/22705188
tags question: http://stackoverflow.com/q/22749024
tags question: http://stackoverflow.com/q/22807565
tags question: http://stackoverflow.com/q/22745050
tags question: http://stackoverflow.com/q/22797521
tags question: http://stackoverflow.com/q/22797980
tags question: http://stackoverflow.com/q/22790312
tags question: http://stackoverflow.com/q/22783407
tags question: http://stackoverflow.com/q/22676472
tags question: http://stackoverflow.com/q/22670323
tags question: http://stackoverflow.com/q/22754329
tags question: http://stackoverflow.com/q/22690957
tags question: http://stackoverflow.com/q/22728129
tags question: http://stackoverflow.com/q/22793452
tags question: http://stackoverflow.com/q/22783212
tags question: http://stackoverflow.com/q/22697390
tags question: http://stackoverflow.com/q/22698737
tags question: http://stackoverflow.com/q/22704288
tag name: jsp
tags question: http://stackoverflow.com/q/22756153
tags question: http://stackoverflow.com/q/22700863
tags question: http://stackoverflow.com/q/22742016
tags question: http://stackoverflow.com/q/22731157
tags question: http://stackoverflow.com/q/22703522
tags question: http://stackoverflow.com/q/22771347

http://stackoverflow.com/q/22762763
score: 0
answer count: 2
accepted answer: http://stackoverflow.com/a/22813304
tagged with: lotus
tagged with: xpages
tagged with: email
tagged with: lotus-notes
has body: Hello Domino programmers! I work on a lotus database + XPages and i ran into a following problematic situation: I receive mails in form of "Memo" documents directly to my database. I would like to separate attachments and body of mail (with embedded images) into two richtext fields. To achieve this I made a java agent. Idea seems fine for my solution, but every time I try to copy a Richtextitem "Body" from mail to another document, a created item contains Richtext elements instead of MIME parts. It would be fine, but through this a whole message seems to lose the formatting.. I know there exists a "switch" that should prevent this from happening - session.setConvertMime(false). I used it before accessing a source document but without any effect - my Richtext fields are blank instead. So I have a bunch of questions: Is there a way to copy body of a Memo document to store a content of email formatted? I'm interested in possibility to review email from XPages. When I use a FileDownload, FileUpload and RichTextControl - is it recommendable to keep content of a message and attachments in the same field on back-end document? Any help will be appreciated. // I use 9.0 designer and 9.0 development server. // Here is a code i currently use Session session = getSession(); String TMPSAVE_PATH = System.getProperty("java.io.tmpdir"); Database db = session.getCurrentDatabase(); View v = db.getView("Inbox"); ViewEntryCollection vec = v.getAllEntries(); ViewEntry entry = vec.getFirstEntry(); while(entry!=null) { Document mailDoc = entry.getDocument(); Document newDoc = db.createDocument(); newDoc.replaceItemValue("Form", "Ticket"); newDoc.replaceItemValue("Title","[MAIL] " + mailDoc.getItemValueString("Subject")); newDoc.replaceItemValue("Status", "0"); newDoc.computeWithForm(true, true); newDoc.save(false,true); RichTextItem rtiOLD = (RichTextItem)mailDoc.getFirstItem("Body"); newDoc.removeItem("Description"); RichTextItem rtiDESC = newDoc.createRichTextItem("Description"); rtiDES…
has answer: http://stackoverflow.com/a/22813304
type: Question
type: AnsweredQuestion
has title: Copy MIME parts from mail to another document - converting MIME <-> Richtext
has answer: http://stackoverflow.com/a/22766060
tagged with: java
possible better answer: http://stackoverflow.com/a/22766060
has comment: http://stackoverflow.com/comment/34702825

http://stackoverflow.com/a/22796514
type: Answer
score: 4
has comment: http://stackoverflow.com/comment/57992641
has comment: http://stackoverflow.com/comment/34762268
accepted answer of: http://stackoverflow.com/q/22796137
has body: Think of it this way: the transformation that is specified later is closer to the drawing primitive that follows and therefore applied first. This sequence makes it simpler to apply a transformation to a complex drawing. Suppose you have a method that draws some complex figure and uses itself also transformations. You want the figure to appear twice in different sizes. You can first set the scaling transformation and then call your method. For the second appearance you set another scaling and then call your method again. This would not be possible, if the transformations are specified in the other order.
answers question: http://stackoverflow.com/q/22796137
upvote count: 4
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/34762225

http://stackoverflow.com/comment/34785415
has text: then you have to create a `GOval ball` ball property in you ball class. and in your bounce method you could do `this.ball.move(dx,dy)`
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/22808685
type: Comment

http://stackoverflow.com/a/22759494
type: Answer
answers question: http://stackoverflow.com/q/22759412
score: 0
has body: There is no reason to start at 0 or -1. If you want to verify MIN/Max values, try it like this: class range { public static void main(String [] args) { long i; for(i=Long.MAX_VALUE;;i++) { long c= (long)(i+1); if(i&gt;c) //upper_limit+1=lower_limit break; // hence, at i=upper_limit c(=i+1) &lt; i } System.out.println("upper ="+i); for(i=Long.MIN_VALUE;;i--) { long c=(long)(i-1); if(i&lt;c) //lowerlimit-1=upperlimit break; //hence at i=lowerlimit c(=i-1)&gt;i } System.out.println("lower ="+i); } }

http://stackoverflow.com/comment/34779726
type: AnswerComment
has text: `44:07:50.152 [ERROR] Multi-dimensional arrays are not yet supported`
comment on: http://stackoverflow.com/a/22791066
score: 0
type: Comment

nodelist
type: Tag
tags question: http://stackoverflow.com/q/22658457
tag name: nodelist

http://stackoverflow.com/q/22804177
tagged with: java
has answer: http://stackoverflow.com/a/22806839
downvote count: 1
has title: Algorithmic complexity of naive code for processing all consecutive subsequences of a list: n^2 or n^3?
type: Question
has answer: http://stackoverflow.com/a/22804352
tagged with: algorithm
has answer: http://stackoverflow.com/a/22811511
has answer: http://stackoverflow.com/a/22804492
linked to: http://stackoverflow.com/q/13621550
has body: I'm studying for a test and found this question: I can't really determine the complexity, I figured it's either O(n2) or O(n3) and I'm leaning towards O(n3). Can someone tell me what it is and why? My idea that it's O(n2) is because in the j loop, j = i which gives a triangle shape, and then the k loop goes from i + 1 to j, which I think is the other half of the triangle. public static int what(int[] arr) { int m = arr[0]; for (int i=0; i&lt;arr.length; i++) { for (int j=i; j&lt;arr.length;j++) { int s = arr[i]; for (int k=i+1; k&lt;=j; k++) s += arr[k]; if (s &gt; m) m = s; } } return m; } Also if you can tell me what it does? I figured it returns the addition of positive integers or the biggest integer in the array. But for arrays like {99, -3, 0, 1} it returns 99, which I think is because it's buggy. If not than I have no Idea what it does: {99, 1} =&gt; returns 100 {-1, -2, -3} =&gt; return -1 {-1, 5, -2} =&gt; returns 5 {99, -3, 0, 1} =&gt; returns 99 ???
has answer: http://stackoverflow.com/a/22804706
has answer: http://stackoverflow.com/a/22817845
tagged with: time-complexity
has comment: http://stackoverflow.com/comment/34795907
has answer: http://stackoverflow.com/a/22813288
favorite count: 0
tagged with: big-o
answer count: 9
possible better answer: http://stackoverflow.com/a/22804344
accepted answer: http://stackoverflow.com/a/22811511
upvote count: 30
has comment: http://stackoverflow.com/comment/48182047
has answer: http://stackoverflow.com/a/22804999
has answer: http://stackoverflow.com/a/22804344
has comment: http://stackoverflow.com/comment/34793242
score: 29
has comment: http://stackoverflow.com/comment/34792811
has comment: http://stackoverflow.com/comment/34931780
has comment: http://stackoverflow.com/comment/34815444
type: AnsweredQuestion

http://stackoverflow.com/a/22759455
has body: The rules don't exist as Java code. However, you can use the Guvnor REST API to download the DRL source code for the rules and then upload it again. However, it sounds like you want to support round trips between rules modified in Guvnor, loaded into your UI, modified and then uploaded back to Guvnor. I can't think of a way of doing this, which would not be extremely fragile. Certainly if you are new to Drools, I would recommend staying well away from trying to implement this. If you want to work with a completely custom UI instead of using the Guvnor rule management functionality, you would be better off storing the rules in your own domain model in a database and generating the DRL from that model. This may make Guvnor redundant in your environment. If you have other rules which still need to be managed in Guvnor, then you could generate the DRL and upload it to Guvnor using the REST API.
type: Answer
upvote count: 1
score: 1
downvote count: 0
answers question: http://stackoverflow.com/q/22715751

http://stackoverflow.com/a/22776707
has comment: http://stackoverflow.com/comment/34752280
has comment: http://stackoverflow.com/comment/34756478
has comment: http://stackoverflow.com/comment/34982255
score: 1
answers question: http://stackoverflow.com/q/22737943
has comment: http://stackoverflow.com/comment/34756205
downvote count: 0
has comment: http://stackoverflow.com/comment/34761784
has comment: http://stackoverflow.com/comment/34762904
has comment: http://stackoverflow.com/comment/34762616
has comment: http://stackoverflow.com/comment/34758447
has body: The first thing to check is that gs.getRemainingLines() actually has lines remaining. A separate problem is that you are adding every line to the GameState g to check. You either need to remove each added line after calling evaluate or put the clone inside the loop at the top such as int minscore = -1; Line lnew = null; List&lt;Line&gt; l = gs.getRemainingLines(); for (Line l2 : l) { GameState g = gs.clone(); g.addLine(l2); if (evaluate(g) &gt; minscore) { minscore = (evaluate(g)); lnew = l2; } } or int minscore = -1; GameState g = gs.clone(); Line lnew = null; List&lt;Line&gt; l = gs.getRemainingLines(); for (Line l2 : l) { g.addLine(l2); if (evaluate(g) &gt; minscore) { minscore = (evaluate(g)); lnew = l2; } g.removeLine(l2); } However if you are trying to use minimax (http://en.wikipedia.org/wiki/Minimax) then you will need to change your code to recursively call makeMove (unless you modify the algorithm to do determine the min-max using loop constructs). public GameState makeMove(GameState gs) { if (gs.getRemainingLines().size() == 1) { GameState g = gs.clone(); g.addLine(gs.getRemainingLines().get(0)); return g; } if (gs.getPlayer() == 1) { GameState g = gs.clone(); g.setPlayer(2); int bestValue = -1; Line lbest = null; List&lt;Line&gt; lines = gs.getRemainingLines(); for (Line line : lines) { g.addLine(line); GameState val = makeMove(g); g.removeLine(line); if (evaluate(val) &gt; bestValue) { bestValue = evaluate(g); lbest = line; } } g.addLine(lbest); return g; } else { GameState g = gs.clone(); g.setPlayer(1); int bestValue = 999; Line lbest = null; List&lt;Line&gt; lines = gs.getRemainingLines(); for (Line line : lines) { g.addLine(line); GameState val = makeMove(g); g.removeLine(line); if (evaluate(val) &lt; bestValue) { bestValue = evaluate(g); lbest = line; } } g.addLine(lbest); return g; } }
type: Answer
upvote count: 1
has comment: http://stackoverflow.com/comment/34763052

http://stackoverflow.com/a/22664494
has comment: http://stackoverflow.com/comment/34540969
type: AcceptedAnswer
downvote count: 0
has body: What is then the purpose of creating a Session object at all? The session is the context of how you are going to interact with the mail host. This includes but not limited to debugging output from the mail host, timeouts, and authentication mechanisms. If you want to interact with the same mail host in different ways then the session is the object that holds this information. If a single JVM needs to connect to multiple mail servers you need two different sessions. This is explained in detail in the JavaMail FAQ: If some other code in the same JVM (e.g., in the same app server) has already created the default Session with their properties, you may end up using their Session and your properties will be ignored. This often explains why your property settings seem to be ignored. Always use Session.getInstance to avoid this problem. Most JavaMail examples fail the common mistakes test. Try to reference the JavaMail API sample programs Session.getDefaultInstance is rarely the right choice for any code. Most code should use Session.getInstance. Including a default constructor for MimeMessage would just encourage wrong behavior.
type: Answer
accepted answer of: http://stackoverflow.com/q/22657918
answers question: http://stackoverflow.com/q/22657918
score: 15
upvote count: 15

http://stackoverflow.com/comment/34723552
type: QuestionComment
score: 0
comment on: http://stackoverflow.com/q/22775255
type: Comment
has text: Oh yeah, I'm just lazy. Easy = Good

http://stackoverflow.com/comment/34718954
type: QuestionComment
type: Comment
has text: Do some Googling, you will find plenty of info
comment on: http://stackoverflow.com/q/22772781
score: 0

http://stackoverflow.com/comment/34769340
has text: That still didn't fix anything or even change it
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/22800866

http://stackoverflow.com/q/22743724
tagged with: java
type: Question
has title: Using HttpClient To Login To https://id.wsj.com/access/50f57264bd7fb2d2f6629af6/latest/login_standalone.html
score: 0
has body: guys am trying to login to the URL https://id.wsj.com/access/50f57264bd7fb2d2f6629af6/latest/login_standalone.html using HttpClient. But the client does not load the css from http://a248.e.akamai.net:443 when calling via code. I debugged the code using Fiddler. My code : public void getRequest() throws ClientProtocolException, IOException { try { HttpHost proxy = new HttpHost("127.0.0.1", 8888); HttpClient httpclient = HttpClientBuilder.create().setProxy(proxy).setUserAgent("").build(); HttpContext localContext = new BasicHttpContext(); try { BasicCookieStore cookieStore = new BasicCookieStore(); localContext.setAttribute(HttpClientContext.COOKIE_STORE, cookieStore); HttpHost target = new HttpHost("id.wsj.com", 443, "https"); HttpGet req = new HttpGet("/access/50f57264bd7fb2d2f6629af6/latest/login_standalone.html"); req.addHeader("Accept", "text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8"); req.addHeader("User-Agent", "Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/33.0.1750.154 Safari/537.36"); System.out.println("executing request to " + target + " via " + proxy); HttpResponse rsp = httpclient.execute(target, req, localContext); System.out.println("Status Code" + rsp.getStatusLine().getStatusCode()); printHeaders(rsp.getAllHeaders()); printCookies(cookieStore); } finally { httpclient.getConnectionManager().shutdown(); } } catch (IOException e) { e.printStackTrace(); } } Fiddler Snapshot via Java http://s3.postimg.org/qimqrxo2q/using_httpclient.jpg Snapshot via chrome http://s17.postimg.org/u6dpmvuam/via_chrome.jpg Am new to this, so please help experts! Thanks!
tagged with: apache
answer count: 1
tagged with: httpclient
tagged with: apache-httpclient-4.x
has answer: http://stackoverflow.com/a/22744520
type: UnansweredQuestion

http://stackoverflow.com/q/22733757
accepted answer: http://stackoverflow.com/a/22735160
tagged with: java
has body: Is it possible to store three string values added into an array (studentName), and store that into a different array so it can be found later? Basically my main goal is to store a name, user id, and a balance (fullName, idName, 300). And add that into a "super(?)" array so when people type down, it finds the fullName and pulls the information from there.
answer count: 2
has comment: http://stackoverflow.com/comment/34648494
tagged with: arrays
favorite count: 0
tagged with: arraylist
has title: Java: Storing an Array into an Array?
has comment: http://stackoverflow.com/comment/34648561
has answer: http://stackoverflow.com/a/22735160
score: -1
has comment: http://stackoverflow.com/comment/34648761
has comment: http://stackoverflow.com/comment/34648686
has comment: http://stackoverflow.com/comment/34648602
type: AnsweredQuestion
tagged with: java.util.scanner
downvote count: 2
upvote count: 1
possible better answer: http://stackoverflow.com/a/22733891
type: Question
has answer: http://stackoverflow.com/a/22733891

http://stackoverflow.com/comment/34683250
score: 0
type: Comment
comment on: http://stackoverflow.com/q/22752810
type: QuestionComment
has text: As Raghunandan said, you have problem in your *coding* logic. That said, your logic might be fine, but implemented wrongly in coding. One thing, if you want your app to run manually, remove `while-loop`. Then, you just need to initialize `OnClickListener` once, and put most of your code there.

rtmp
tag name: rtmp
tags question: http://stackoverflow.com/q/22702941
type: Tag

opennlp
type: Tag
tags question: http://stackoverflow.com/q/22785942
tag name: opennlp
tags question: http://stackoverflow.com/q/22662082

http://stackoverflow.com/q/22666373
tagged with: list
possible better answer: http://stackoverflow.com/a/22676287
tagged with: jsf
linked to: http://stackoverflow.com/q/6848970
has answer: http://stackoverflow.com/a/22676287
duplicate of: http://stackoverflow.com/q/6848970
type: Question
has title: Cannot show an extended property from list (in bean) - JSF using Bean
tagged with: java
has answer: http://stackoverflow.com/a/22671546
score: 0
answer count: 2
accepted answer: http://stackoverflow.com/a/22671546
tagged with: javabeans
has body: i'm learning JSF and beans. I've the following code: public class Example { private List&lt;ExampleObject&gt; listExampleObject; //Get and set from list... } public class ExampleObject extends ExampleObjectExtend { private String exampleAttribute; //Get and set from attribute. } public class ExampleObjectExtend { private String extendedAttribute; //Get and set from extendedAttribute.. } I need to display a selectList with itemLabel=exampleAttribute and itemValue=extendedAttribute. I did the following: &lt;h:selectOneMenu id="listExample"&gt; &lt;f:selectItems value="#{myBean.listExampleObject}" var="example" itemValue="#{example.extendedAttribute}" itemLabel="#{example.exampleAttribute}"/&gt; &lt;/h:selectOneMenu&gt; The point is that the itemLabel is being shown properly, but the value attribute from the option control is being shown as like this: com.package.example.web.Example@5a05a935 (i check this value by chrome debugger and firebug) Why could this happen? Thank you UPDATE: I've implemented the provided solution by Jitesh and the system now works. Thank you so much!
type: AnsweredQuestion

http://stackoverflow.com/a/22729528
answers question: http://stackoverflow.com/q/22729407
score: 0
type: Answer
has body: I think your problem lays in here: public DeepAndShallowCopyConstructor(DeepAndShallowCopyConstructor other){ DeepAndShallowCopyConstructor test = new DeepAndShallowCopyConstructor(); this.Stringtest = test.Stringtest; } You probably wanted public DeepAndShallowCopyConstructor(DeepAndShallowCopyConstructor other){ this(); this.Stringtest = other.Stringtest; } (though it's hard to guess your intention, the original code makes no sense to me.) Then again, Stringtest should have small s, otherwise it's against the Java naming conventions, and the super-long names are making the code hard to read (even for you).

http://stackoverflow.com/comment/34648354
has text: Action Settings
score: 0
type: Comment
comment on: http://stackoverflow.com/a/22733596
type: AnswerComment

python
tags question: http://stackoverflow.com/q/22748370
tags question: http://stackoverflow.com/q/22691451
tag name: python
tags question: http://stackoverflow.com/q/22665304
tags question: http://stackoverflow.com/q/22750148
tags question: http://stackoverflow.com/q/22686339
tags question: http://stackoverflow.com/q/22771891
tags question: http://stackoverflow.com/q/22697315
tags question: http://stackoverflow.com/q/22747235
tags question: http://stackoverflow.com/q/22706909
type: Tag
tags question: http://stackoverflow.com/q/22656656
tags question: http://stackoverflow.com/q/22691634
tags question: http://stackoverflow.com/q/22770709
tags question: http://stackoverflow.com/q/22710921
tags question: http://stackoverflow.com/q/22693878

http://stackoverflow.com/a/22672764
type: Answer
has comment: http://stackoverflow.com/comment/34541946
has comment: http://stackoverflow.com/comment/34569950
has comment: http://stackoverflow.com/comment/34541867
has comment: http://stackoverflow.com/comment/34538809
has comment: http://stackoverflow.com/comment/34542413
has comment: http://stackoverflow.com/comment/34539053
has comment: http://stackoverflow.com/comment/34569880
has comment: http://stackoverflow.com/comment/34539480
has comment: http://stackoverflow.com/comment/34539391
has comment: http://stackoverflow.com/comment/34555373
has comment: http://stackoverflow.com/comment/34541711
has comment: http://stackoverflow.com/comment/34541262
score: 0
has comment: http://stackoverflow.com/comment/34541357
has comment: http://stackoverflow.com/comment/34539721
has comment: http://stackoverflow.com/comment/34540965
answers question: http://stackoverflow.com/q/22672580
has comment: http://stackoverflow.com/comment/34569926
has comment: http://stackoverflow.com/comment/34538947
has comment: http://stackoverflow.com/comment/34539268
has body: After looking into your code i found you did not specify the port number for database connection jdbc:sqlserver://localhost; databaseName=Test There should be a port number if your trying to connect on your local machine for an example please refer following line jdbc:sqlserver://localhost:1433;DatabaseName=syv Please check and let me know ...if there is any further issue Ok here i am sending you the basic hibernate configuration : - STEP 1 :- *Create a Java File “AddStudent” and paste the below code into that.* //package code; import java.sql.*; import java.io.*; import org.hibernate.*; import org.hibernate.cfg.*; public class AddStudent { private static SessionFactory sessionFactory; public static void main(String args[]) throws Exception { DataInputStream d = new DataInputStream(System.in); System.out.println("ENTER YOUR NAME"); String name = d.readLine(); System.out.println("ENTER YOUR DEGREE"); String degree = d.readLine(); System.out.println("ENTER YOUR PHONE"); String phone = d.readLine(); System.out.println("Name: " + name); System.out.println("Degree: " + degree); System.out.println("Phone: " + phone); if ((name.equals("") || degree.equals("") || phone.equals(""))) { System.out.println("All informations are Required"); } else { try { // begin try sessionFactory = new Configuration().configure() .buildSessionFactory(); } catch (Exception e) { System.out.println(e.getMessage()); System.err.println("Initial SessionFactory creation failed." + e); } Session s = sessionFactory.openSession(); Transaction tx = s.beginTransaction(); Student stu = new Student(); stu.setName(name); stu.setDegree(degree); stu.setPhone(phone); s.save(stu); tx.commit(); System.out.println("Added to Database"); if (s != null) s.close(); } } } STEP 2 : Create a Java File “Student” paste the below code into that. //package code; import java.io.*; public class Student implements Serializable { private long id; private String name; private String degree; private String phone; public long getI…
has comment: http://stackoverflow.com/comment/34539194

http://stackoverflow.com/comment/34718760
comment on: http://stackoverflow.com/a/22760219
has text: any exception? what's reading out of @FormDataParam("name1") InputStream helloInput?
score: 0
type: AnswerComment
type: Comment

http://stackoverflow.com/comment/42341235
comment on: http://stackoverflow.com/a/22695943
has text: Can one get HATEOAS formatted responses from sling? I haven't seen how it's possible to include child and parent references in sling json responses.
score: 0
type: AnswerComment
type: Comment

http://stackoverflow.com/q/22737789
has comment: http://stackoverflow.com/comment/34655531
tagged with: arraylist
score: 0
has comment: http://stackoverflow.com/comment/34655901
answer count: 1
has body: I'm writing a class that will build a SQL table create statement. what I'd like to do is call a method something like createTable(String tableName ColAndTypes... ct ). When I write the method I don't get any compile errors. I'm having trouble passing the values into the method when I call it though and I think it's because my syntax is wrong and I'm not sure how to fix it. I was wondering if you could look at the example I have provided and let me know what I need to do to fix it. Thanks so much for your help! import java.util.*; public class foo { public class bar{ public String sBar1, sBar2; public bar(){ sBar1 = "null"; sBar2 = "null"; } public bar(String sBar1, String sBar2){ this.sBar1 = sBar1; this.sBar2 = sBar2; } } String sFoo; List&lt;bar&gt; bi; public foo(){ sFoo = "null"; bi = new bar(); } public foo(Strinf sFoo, bar bi){ this.sFoo = sFoo; this.bi = bi; } public void runFooBar(String sFoo, bar... barArgs) { this.sFoo = sFoo; for(bar x:barArgs){System.out.Println(bi.get(x).sBar1 + ":" + bi.get(x).sBar2);} } public static void main(String[] args) { foo fi = new foo(); fi.runFooBar("foo 1", ("1 sBar1","1 sBar2"),("2 sBar1 ","2 sBar2")) }//end main }//end class
tagged with: constructor
has comment: http://stackoverflow.com/comment/34655561
tagged with: parameters
type: AnsweredQuestion
tagged with: java
tagged with: methods
has answer: http://stackoverflow.com/a/22737885
accepted answer: http://stackoverflow.com/a/22737885
has title: use a constructor as a method parameter
type: Question

http://stackoverflow.com/a/22720404
type: Answer
answers question: http://stackoverflow.com/q/22719976
has body: The problem is that JPanels come with a default FlowLayout that in turn come equipped with default 5 pixel gaps. If you change the gaps to 0, you won't see it centerFrame.setLayout(new FlowLayout(FlowLayout.CENTER, 0, 0)); -Or- centerFrame.setBorder(new LineBorder(Color.BLUE, 6)); FlowLayout flow = (FlowLayout)centerFrame.getLayout(); flow.setHgap(0); flow.setVgap(0); See the FlowLayout API
has comment: http://stackoverflow.com/comment/34625076
has comment: http://stackoverflow.com/comment/34626420
upvote count: 3
accepted answer of: http://stackoverflow.com/q/22719976
score: 3
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/34625053

http://stackoverflow.com/q/22675679
has body: Can someone please help explain to me the differences between the two? The URL instance seems simple enough to me, but I am having trouble doing the same thing with a local file.
has comment: http://stackoverflow.com/comment/34544086
tagged with: get
accepted answer: http://stackoverflow.com/a/22675746
answer count: 2
has comment: http://stackoverflow.com/comment/34544270
favorite count: 0
has title: Difference between using HTTP GET request on URL vs Local .html file?
upvote count: 2
has comment: http://stackoverflow.com/comment/34544018
has comment: http://stackoverflow.com/comment/34544150
has comment: http://stackoverflow.com/comment/34544222
has answer: http://stackoverflow.com/a/22675739
type: AnsweredQuestion
score: 2
tagged with: java
has comment: http://stackoverflow.com/comment/34544064
possible better answer: http://stackoverflow.com/a/22675739
tagged with: http
type: Question
has answer: http://stackoverflow.com/a/22675746
downvote count: 0

http://stackoverflow.com/q/22730117
accepted answer: http://stackoverflow.com/a/22730238
type: AnsweredQuestion
score: 1
tagged with: java
tagged with: ssl
has body: I published a standalone web service with java in a http://my-IP/ and it works. import javax.xml.ws.Endpoint; public class Publisher { public static void main(String[] args) throws Exception { Endpoint.publish("http://172.16.58.13/", new TicketQueryImpl()); System.out.println("UP"); } } now I want to make it in SSL and publish it on https://my-IP/. I searched a lot but i didn't find any good sample or help. most of them were not for standalone and used Tomcat or other servers. any body could help me please!
type: Question
has answer: http://stackoverflow.com/a/22730238
answer count: 1
downvote count: 0
favorite count: 0
has title: standalone ssl web service in java
upvote count: 1
tagged with: web-services

http://stackoverflow.com/comment/34749556
has text: Check if you have a bean definition for a session factory
comment on: http://stackoverflow.com/a/22789672
score: 0
type: AnswerComment
type: Comment

http://stackoverflow.com/q/22669452
has body: Im using the following code for xml node extraction , But im getting the nullpointer exception &lt;root&gt; &lt;place &gt; &lt;city&gt; aaaaaa &lt;/city&gt; &lt;state / &gt; &lt;country&gt; zzzzzzzz &lt;/country&gt; &lt;place&gt; &lt;/root&gt; I have tried the following code NodeList nodeList = (NodeList)xPath1.compile(temp).evaluate(xmlDocument,XPathConstants.NODESET); TempFlat = nodeList.item(0).getFirstChild().getNodeValue(); and i have googled and got this NodeList nodeList = (NodeList)xPath1.compile(temp).evaluate(xmlDocument,XPathConstants.NODESET); Node nValue = (Node) nodeList.getFirstChild(); where temp is my xpath . Which is readable from a file. example /root/place/city /root/place/city /root/place/city but for this im getting the following error E:\Work\java\test.java:80: cannot find symbol symbol : method getFirstChild() location: interface org.w3c.dom.NodeList Node nValue = (Node) nodeList.getFirstChild(); ^ 1 error I found that , this is because &lt;state / &gt; is empty . How can i solve this . Can anyone help me NOTE : I have found the reason for the 2nd error i have posted , But i need to solve the Null Pointer exception
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/22669822
tagged with: java
tagged with: dom
type: Question
has comment: http://stackoverflow.com/comment/34532863
answer count: 2
has answer: http://stackoverflow.com/a/22669665
has title: null pointer exception in DOM Java
accepted answer: http://stackoverflow.com/a/22669665
score: 0
has comment: http://stackoverflow.com/comment/34533229
tagged with: http://stackoverflow.com/tag/xml
possible better answer: http://stackoverflow.com/a/22669822

storage
tag name: storage
tags question: http://stackoverflow.com/q/22763213
type: Tag

http://stackoverflow.com/comment/34513940
has text: sorry i didnt understand. "Kill process logic in tear down part" when to add that logic/where is this part. please tell
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/22652938
type: Comment

http://stackoverflow.com/q/22707188
tagged with: java
upvote count: 1
downvote count: 1
type: Question
linked to: http://stackoverflow.com/q/9137782
has answer: http://stackoverflow.com/a/22707603
has comment: http://stackoverflow.com/comment/34600630
has comment: http://stackoverflow.com/comment/34601059
has answer: http://stackoverflow.com/a/22708186
score: 0
answer count: 3
has comment: http://stackoverflow.com/comment/34600694
has answer: http://stackoverflow.com/a/22719007
has body: I'm on my work machine, and our team pulls artifacts from a corporate repository. I'm trying to pull com.sun.jersey jersey-client 1.18.1 and for whatever reason, maven is not searching any public repositories. To my POM, I've added: java.net https://maven.java.net/content/repositories/public/ As suggested by hellboy, there is a mention of my corporate repository in the settings.xml file: artifactory * http://corporate-network-domain/nexus/content/groups/public Artifactory my understanding was that this configuration means that when Maven attempts to retrieve artifacts, it will search the repository specified in the settings.xml file, followed by the repo specified in the POM file. Is there something that I'm mistaken on? there appears to be the suggestion that the tag < mirrorOf> directs all traffic to the corporate network and the solution lies here: http://maven.apache.org/guides/mini/guide-mirror-settings.html However, I'm still reading and trying to understand what to do. Solution which indicates how to search the corporate repo first then the public next, provided below will be rewarded!
has title: Maven pulling from corporate repo instead of publicly available
favorite count: 0
has comment: http://stackoverflow.com/comment/34601173
has comment: http://stackoverflow.com/comment/34600753
type: UnansweredQuestion
tagged with: maven

http://stackoverflow.com/a/22729666
type: Answer
has body: Fragments should have no arg constructor public Tab1(Context context) { mContext = context; } Remove the above And change this return new Tab1(mContext); to return new Tab1(); Similarly for others. If you want Context in Framgent use getActivity(). You also need to move this &lt;uses-permission android:name="android.permission.INTERNET"/&gt; before application tag in manifest file Edit: A suggestion get rid of LinearLayout in activity_tab1.xml. RelativeLayout is enough. Also use match_parent instead of fill_parent Edit 2: Change this View mainView = (View) inflater.inflate(R.layout.activity_main, container, false); to View mainView = (View) inflater.inflate(R.layout.activity_tab1, container, false);
downvote count: 0
has comment: http://stackoverflow.com/comment/34642418
score: 1
has comment: http://stackoverflow.com/comment/34642699
accepted answer of: http://stackoverflow.com/q/22729649
answers question: http://stackoverflow.com/q/22729649
upvote count: 1
type: AcceptedAnswer

parsing
tags question: http://stackoverflow.com/q/22679554
tags question: http://stackoverflow.com/q/22763190
tags question: http://stackoverflow.com/q/22703083
tags question: http://stackoverflow.com/q/22726061
tag name: parsing
tags question: http://stackoverflow.com/q/22729099
tags question: http://stackoverflow.com/q/22668443
tags question: http://stackoverflow.com/q/22691406
tags question: http://stackoverflow.com/q/22717130
tags question: http://stackoverflow.com/q/22777109
tags question: http://stackoverflow.com/q/22769253
tags question: http://stackoverflow.com/q/22708933
type: Tag
tags question: http://stackoverflow.com/q/22806318
tags question: http://stackoverflow.com/q/22724871
tags question: http://stackoverflow.com/q/22701308
tags question: http://stackoverflow.com/q/22781856
tags question: http://stackoverflow.com/q/22660070
tags question: http://stackoverflow.com/q/22790807
tags question: http://stackoverflow.com/q/22680149
tags question: http://stackoverflow.com/q/22713977
tags question: http://stackoverflow.com/q/22808404
tags question: http://stackoverflow.com/q/22752633
tags question: http://stackoverflow.com/q/22762789
tags question: http://stackoverflow.com/q/22725992

http://stackoverflow.com/comment/35121291
type: Comment
has text: Can you also explain how would I go about doing web server version? What I am doing, is creating an application which can create events according to some specifications(start time, end time, number of events, event length, etc.) and before I add those events, I need to get ics file from iCal software on Mac, use it and then create a new ics which can be imported with all new events in there. I can kind of do the creation, but I am unable to perform CANCEL and UPDATE functions, I don't know the process.
comment on: http://stackoverflow.com/a/22707535
score: 0
type: AnswerComment

http://stackoverflow.com/comment/34609380
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/22712131
has text: How are you executing the code - from the command line or in an IDE?
score: 0

http://stackoverflow.com/a/22727971
downvote count: 0
score: 1
has body: Apache Camel uses Spring JMS in the camel-jms component, so it support what JMS can do. So if Oracle AMQ has a limitation about 4000 bytes or something, its something you need to handle on the Oracle side. Basically Camel uses JMS and you need to dive into the Oracle AMQ docs to figure out its JMS interop. JMS has different message types: Text, Bytes, Map, Object etc. For XML you may need to use either Bytes or Text. You can configure the jmsMessageType on the JMS endpoint in Camel to force a specific type. If not then Camel picks the most appropriate based on the message body type. Eg string => Text etc. There are other users of Apache Camel that has integrated with Oracle AMQ so it should be possible.
upvote count: 1
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/22717249
answers question: http://stackoverflow.com/q/22717249
type: Answer

http://stackoverflow.com/q/22702906
answer count: 1
type: UnansweredQuestion
tagged with: swing
tagged with: miglayout
tagged with: java
has comment: http://stackoverflow.com/comment/34632083
type: Question
has answer: http://stackoverflow.com/a/22703169
has body: So my end goal with what I am creating is to have a JPanel with nice tabbed buttons (think JTabbedPane except people will like how it looks). To accomplish this I create a JPanel, then I have a method called addContent(String name, JPanel jp). The point of this method is to... add new Content. It's basically adding a tab and JPanel to the mix. And that's where I need your help. I want to be able to add JButtons *infinitely* to my JPanel. I'm using MigLayout, and since I'm not too great with it, I came up with this: this.add(button, "w 40%!, h 50!, x 0%, y (0% + last.y2), wrap, id last"); It's atrocious, I know. But what it's trying to accomplish is reference the y2 of the previously made button, then set the button 'that is being added' to the 'previously made' button. Just to clarify, I have set the encompassing JPanel to MigLayout, and this is more of a schematics problem.
has comment: http://stackoverflow.com/comment/34599224
has title: How to reference previously added components in Swing with MigLayout?
score: 0

http://stackoverflow.com/q/22679689
has title: Decrypt Content Encryption Key in JSON Web Encryption
linked to: http://stackoverflow.com/q/858980
tagged with: jwe
type: Question
score: 0
tagged with: encryption
has body: I am using OpenSSL RSA1_5 for decrypting the CEK (Content Encryption Key). My aim is to decrypt the JWK (JSON Web Key) by which I will be getting CEK, so by using CEK I can decrypt my ciphertext which is actually the encrypted data. After using Base64Decode, JWE Header is {"alg":"RSA1_5","enc":"A128CBC-HS256","typ":"JOSE"} where "alg" is the algorithm used to decrypt the CEK. Please help me decrypting the CEK first, after this I need to decrypt the Cipher. My Java class is: package com.decryption; import java.io.*; import java.math.BigInteger; import java.security.*; import java.security.spec.*; import java.security.interfaces.*; import javax.crypto.*; import javax.crypto.spec.*; import javax.crypto.interfaces.*; public class RSADecrypt { public RSADecrypt(String inFileName, String outFileName) { try { System.out.println("Inside TRY"); /* Get the encrypted message from file. */ FileInputStream cipherfile = new FileInputStream(inFileName); byte[] ciphertext = new byte[cipherfile.available()]; cipherfile.read(ciphertext); cipherfile.close(); System.out.println("Inside 1"); /* Get the private key from file. */ //PrivateKey privatekey = readPrivateKey("D://sso//mmdevnopass.key"); PrivateKey privatekey = readPrivateKey("D://sso//mmdevJWE.key"); System.out.println("Inside 2"); /* Create cipher for decryption. */ Cipher decrypt_cipher = Cipher.getInstance("RSA/ECB/PKCS1Padding"); decrypt_cipher.init(Cipher.DECRYPT_MODE, privatekey); System.out.println("Inside 3"); /* Reconstruct the plaintext message. */ byte[] plaintext = decrypt_cipher.doFinal(ciphertext); FileOutputStream plainfile = new FileOutputStream(outFileName); plainfile.write(plaintext); plainfile.close(); } catch (Exception e) { System.out.println("catch1"); e.printStackTrace(); } } public static PrivateKey readPrivateKey(String filename) throws Exception { System.out.println("readPrivateKey()"); FileInputStream file = new FileInputStream(filename); byte[] bytes = new byte[file.available()]; file.read(bytes); f…
answer count: 1
tagged with: java
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/22686292

http://stackoverflow.com/q/22769016
answer count: 2
has body: I've updated my eclipse and ADT Plugin to the latest version recently and recognised some big changes. Whenever I create a new Android Application Project there appears a new appcompat_v7 library which wasn't present before and also a fragment_main.xml . Why is that? Why is the activity_main.xml file not preferred for activity layout directly anymore and why appcompat library is now included in every project ? I tried to remove eclipse/adt/sdk many times and remove the support library from sdk manager but got no result ! I realize it has something to do with actionbar but the problem is that whenever I create a new project a red exclamation mark shows up on both project's file and appcompat_v7 file and this prevents me from compiling/running the application or even sometimes appcompat_v7 file doesn't create and the only thing I get is damaged code here's a picture :https://i.sstatic.net/XJMfW.png so how can I remove this dependency and thanks
has answer: http://stackoverflow.com/a/22771094
downvote count: 0
possible better answer: http://stackoverflow.com/a/26352463
has answer: http://stackoverflow.com/a/26352463
has comment: http://stackoverflow.com/comment/34769675
tagged with: android
upvote count: 11
favorite count: 0
has comment: http://stackoverflow.com/comment/34715110
accepted answer: http://stackoverflow.com/a/22771094
score: 11
has title: How to remove support library (appcompat_v7) [Eclipse]
has comment: http://stackoverflow.com/comment/34711994
has comment: http://stackoverflow.com/comment/34712022
has comment: http://stackoverflow.com/comment/34712113
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/34711941
has comment: http://stackoverflow.com/comment/34715160
tagged with: java
tagged with: eclipse
has comment: http://stackoverflow.com/comment/34712049
type: Question

http://stackoverflow.com/q/22789838
has answer: http://stackoverflow.com/a/22790348
has comment: http://stackoverflow.com/comment/34749638
has body: Can someone please explain to me how can I get private fields of an abstract class while unit testing? It can be divided to two: how to create the class variable. how to get the private fields from it for testings. For example: public abstract class pclass{ private int toCheck = 0; public void change(){ toCheck++; } } How toCheck the change method (useful for a more complex method of course...) ?
type: UnansweredQuestion
type: Question
tagged with: java
has title: getDeclaredFields for an abstract class for testing
answer count: 1
tagged with: protected
tagged with: private
score: 0
tagged with: abstract
has comment: http://stackoverflow.com/comment/34749028

http://stackoverflow.com/a/22716644
type: Answer
score: 2
upvote count: 2
accepted answer of: http://stackoverflow.com/q/22716447
answers question: http://stackoverflow.com/q/22716447
type: AcceptedAnswer
has body: You could try : private static ScriptEngineManager mgr = null; private static ScriptEngine engine = null; mgr = new ScriptEngineManager(); engine = mgr.getEngineByName("JavaScript"); Object eval = engine.eval(s); // s is javascript code
downvote count: 0

http://stackoverflow.com/comment/34527860
type: QuestionComment
has text: Have you already went through [this](http://stackoverflow.com/questions/8846586/no-session-found-for-current-thread-spring-3-1-x-and-hibernate-4) and [this](http://stackoverflow.com/questions/20716939/spring-hibernate-no-session-found-for-current-thread)
score: 0
comment on: http://stackoverflow.com/q/22662928
type: Comment

http://stackoverflow.com/a/22782690
score: 16
answers question: http://stackoverflow.com/q/22782417
downvote count: 0
has body: Yes, it is possible. you can use the below code HashMap&lt;String,String&gt; instruments = new HashMap&lt;String, String&gt;() { { put("test","test"); put("test1","test1"); } };
type: Answer
upvote count: 16

http://stackoverflow.com/a/22651931
downvote count: 2
has comment: http://stackoverflow.com/comment/34503911
score: 0
has body: Use ConcurrentHashMap instead of HashMap. A hash table supporting full concurrency of retrievals and adjustable expected concurrency for updates. This class obeys the same functional specification as Hashtable, and includes versions of methods corresponding to each method of Hashtable. However, even though all operations are thread-safe, retrieval operations do not entail locking, and there is not any support for locking the entire table in a way that prevents all access. This class is fully interoperable with Hashtable in programs that rely on its thread safety but not on its synchronization details.
answers question: http://stackoverflow.com/q/22651763
type: Answer
has comment: http://stackoverflow.com/comment/34555589
upvote count: 2

http://stackoverflow.com/comment/34591858
has text: Get Eclipse to prompt for a workspace, by going to Preferences then to General -> Startup and Shutdown -> Workspaces. Check the box labelled "Prompt for workspace on startup". Restart, point to the new location for workspace and it *should* fix your problem.
comment on: http://stackoverflow.com/q/22701967
type: Comment
type: QuestionComment
score: 0

http://stackoverflow.com/a/22715291
upvote count: 2
has comment: http://stackoverflow.com/comment/34616537
has comment: http://stackoverflow.com/comment/34615747
answers question: http://stackoverflow.com/q/22715180
type: Answer
has comment: http://stackoverflow.com/comment/34615407
has comment: http://stackoverflow.com/comment/34824133
score: 2
downvote count: 0
has body: accept() is a blocking call. You can control how long it blocks for by setting http://download.java.net/jdk7/archive/b123/docs/api/java/net/ServerSocket.html#setSoTimeout(int) In your code you dispose of the Socket server_socket = server.accept(); as soon as you accept it. I hope that it is not the case and you actually start a thread to handle the connection
has comment: http://stackoverflow.com/comment/34835435
has comment: http://stackoverflow.com/comment/34835816
has comment: http://stackoverflow.com/comment/34841762
has comment: http://stackoverflow.com/comment/34616410

http://stackoverflow.com/comment/34640458
comment on: http://stackoverflow.com/a/22729235
score: 1
type: AnswerComment
type: Comment
has text: thank you a lot but when I tried to compile it it shows me this error: error: an enclosing instance that contains MyLinkedList.Element is required MyLinkedList.Element e1 = new MyLinkedList.Element(new String("any"), 4, null);

http://stackoverflow.com/comment/34647264
type: QuestionComment
comment on: http://stackoverflow.com/q/22733041
has text: This part can't be right: `new List<MyInterface>()` You can't instantiate the `List` interface
score: 0
type: Comment

jquery
tags question: http://stackoverflow.com/q/22672819
tags question: http://stackoverflow.com/q/22704740
tags question: http://stackoverflow.com/q/22656241
type: Tag
tags question: http://stackoverflow.com/q/22688743
tags question: http://stackoverflow.com/q/22690006
tags question: http://stackoverflow.com/q/22654350
tags question: http://stackoverflow.com/q/22656889
tags question: http://stackoverflow.com/q/22800382
tags question: http://stackoverflow.com/q/22770963
tags question: http://stackoverflow.com/q/22651549
tags question: http://stackoverflow.com/q/22727799
tags question: http://stackoverflow.com/q/22779912
tag name: jquery
tags question: http://stackoverflow.com/q/22654566
tags question: http://stackoverflow.com/q/22648261
tags question: http://stackoverflow.com/q/22804085
tags question: http://stackoverflow.com/q/22740572
tags question: http://stackoverflow.com/q/22710557
tags question: http://stackoverflow.com/q/22802889
tags question: http://stackoverflow.com/q/22729875
tags question: http://stackoverflow.com/q/22761980
tags question: http://stackoverflow.com/q/22787103
tags question: http://stackoverflow.com/q/22757001

http://stackoverflow.com/comment/34743220
has text: His condition is the perform-flag he uses. The problem is that he cannot change that once he is inside the loop running in the UI-thread. This answer will not solve his problem!
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/22786246
type: Comment

http://stackoverflow.com/comment/34538998
type: QuestionComment
type: Comment
has text: Arrays.toString(e.getKey()); Like that?
comment on: http://stackoverflow.com/q/22672690
score: 0

http://stackoverflow.com/comment/34509446
comment on: http://stackoverflow.com/q/22648799
score: 0
has text: what exactly is the problem? Grab all 4 answers and set them to 4 textfields ..
type: Comment
type: QuestionComment

http://stackoverflow.com/q/22703008
favorite count: 0
type: AnsweredQuestion
has title: compareTo() String / Merge sort
accepted answer: http://stackoverflow.com/a/22703089
upvote count: 1
type: Question
score: 1
tagged with: java
answer count: 1
tagged with: arrays
downvote count: 0
has answer: http://stackoverflow.com/a/22703089
has body: I'm having a problem printing out the descending order of my array. The array order goes like (Title,Studio,Year). I have the correct order but I can't print a ascending order it can only print a descending order. Example Movie2 a = new Movie2("The Muppets Take Manhattan","Columbia Tristar", 2001); Movie2 b = new Movie2("Mulan Special Edition","Disney", 2004); Movie2 c = new Movie2("Shrek2", "Dreamworks",2004); public static void sortTitles(Movie2[] a, int low, int high) { if ( low == high ) return; int mid = ( low + high ) / 2; mergeTitle( a, low, mid, high); } public static void mergeTitle( Movie2[] a, int low, int mid, int high ) { Movie2[] temp = new Movie2[ high - low + 1 ]; int i = low, j = mid + 1, n = 0; while ( i &lt;= mid || j &lt;= high ) { int result= a[ i ].getTitle().compareTo(a[ j ].getTitle()); int result2= a[ j ].getTitle().compareTo(a[ i ].getTitle()); if ( i &gt; mid ) { temp[ n ] = a[ j ]; j++; } else if ( j &gt; high ) { temp[ n ] = a[ i ]; i++; } else if ( result &lt; result2 ) { temp[ n ] = a[ i ]; i++; } else { temp[ n ] = a[ j ]; j++; } n++; } for ( int k = low ; k &lt;= high ; k++ ) a[ k ] = temp[ k - low ]; } // end of merge
tagged with: sorting

http://stackoverflow.com/q/22762127
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/22762191
type: Question
tagged with: android
favorite count: 0
accepted answer: http://stackoverflow.com/a/22762191
score: 0
answer count: 3
has answer: http://stackoverflow.com/a/22762430
has body: I'm trying to change the background of a Button which is in a listview implementing onClickListener but I'm getting this error: Here is the code: convertView = inflater.inflate(R.layout.item_quiz3, null); holder.textView1 = (TextView) convertView .findViewById(R.id.textView1); holder.textViewSim = (TextView) convertView .findViewById(R.id.Sim); holder.textViewNao = (TextView) convertView .findViewById(R.id.Nao); holder.btnSim = (ImageButton) convertView .findViewById(R.id.btnSim); holder.btnNao = (ImageButton) convertView .findViewById(R.id.btnNao); holder.btnNao.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { v.setBackground(R.drawable.rdb_on); } }; } return convertView; } }
upvote count: 1
downvote count: 1
has title: Button setOnClickListener in Listview
has answer: http://stackoverflow.com/a/22762370
tagged with: java
possible better answer: http://stackoverflow.com/a/22762370

http://stackoverflow.com/comment/34609915
comment on: http://stackoverflow.com/q/22712404
type: Comment
type: QuestionComment
has text: i guess `json` is null. Check that. What is line 106 in `LokoUtama.java`
score: 0

http://stackoverflow.com/a/22800138
upvote count: 1
score: 1
downvote count: 0
answers question: http://stackoverflow.com/q/22799929
type: Answer
has body: This is a recursive answer. Teachers love recursion. Recursion is risky when it is infinite or too long of a stack for the program to hold. public static int GCD(int n1, int n2){ if(a==0 || b==0) return a+b; return GCD(n2, n1%n2) } If you must do a loop, here is that implementation int n3; while(n != 0 || n2!= 0){ n3 = n2; n2 = n1%n2; n1 = n3; } return n1+n2;

http://stackoverflow.com/a/22649985
type: Answer
answers question: http://stackoverflow.com/q/22649351
score: 0
has body: You have to keep the Name of the files as a String. Assuming you are searching in a folder which doesn't contain any file with the same name. So maybe it is more easy to use HashSet or Map. They got contains() method and seek through the Table in O(1).

http://stackoverflow.com/q/22806474
upvote count: 7
type: Question
has title: how to get value from counter Column in cassandra with multiple row keys?
possible better answer: http://stackoverflow.com/a/26688524
has answer: http://stackoverflow.com/a/26688524
has answer: http://stackoverflow.com/a/22881976
has body: I have one column family that has multiple counter columns. Now I want to get their value behalf of different row keys, Means like RangeSlicesQuery or MultigetSliceQuery, I want to apply on counter column please give me way in counter column.
answer count: 2
downvote count: 0
favorite count: 0
accepted answer: http://stackoverflow.com/a/22881976
tagged with: hector
type: AnsweredQuestion
tagged with: cassandra-cli
tagged with: column-family
tagged with: scala
tagged with: java
score: 7

http://stackoverflow.com/a/22799721
downvote count: 0
type: Answer
answers question: http://stackoverflow.com/q/22799553
upvote count: 2
has body: Well the reason why .- is giving et instead of a is due to the way you're reading the string. Your code reads . and then looks up the table to determine whether it corresponds to any alpha character, in which case it does: e. Then you read a - and you look it up and you get a t. If your input is literally just .-.---.-.-.........-----.-.-.-.- You're pretty much stuck because you don't know when one ends and another begins. As another example, how should one distinguish between the following strings . .. ... .... They are all equally valid signals, but depending on how you interpret it, you get very different results. You can't say something like "I'll just take the longest matching string" because there is no reason why that is a valid rule. If the sample input I provided above does not match your input, you should indicate what your input is.
score: 2

http://stackoverflow.com/comment/34527853
comment on: http://stackoverflow.com/q/22665948
score: 0
type: Comment
type: QuestionComment
has text: Well you could still do a lot more... have you reproduced this *without* the first query at all? Just hard-code some data which makes sense. And the indentation is still broken.

http://stackoverflow.com/comment/34718584
comment on: http://stackoverflow.com/a/22772507
score: 0
type: AnswerComment
has text: Thanks for answer. Can I implement web service inside web application in Tomcat?
type: Comment

http://stackoverflow.com/a/22791263
downvote count: 0
type: Answer
score: 1
upvote count: 1
answers question: http://stackoverflow.com/q/22791101
has body: Do some refactoring by creating a utility method that captures the essence of the check: public static void putIfNotBlank(Map&lt;String, String&gt; map, String key, String value) { if (StringUtils.isNotBlank(value)) map.put(key, value); } Then call it for each attribute: putIfNotBlank(attributes, EMP_EMAIL_ATTR, employee.getEmail());

http://stackoverflow.com/q/22734508
type: Question
has comment: http://stackoverflow.com/comment/34650114
tagged with: google-maps
has comment: http://stackoverflow.com/comment/34649980
has body: In my App, if my LOCATION_SERVICE is off i am getting the NullPointerException. But i want an alertDialog that will prompt the user of activating LOCATION_SERVICE. Can anyone please just tell me how to handle this exception? package com.bddevs.ddbllocator; import android.location.Location; import android.location.LocationManager; import android.os.Bundle; import android.support.v7.app.ActionBarActivity; import android.view.Menu; import android.view.MenuItem; import android.widget.Toast; import com.google.android.gms.maps.CameraUpdateFactory; import com.google.android.gms.maps.GoogleMap; import com.google.android.gms.maps.SupportMapFragment; import com.google.android.gms.maps.model.LatLng; import com.google.android.gms.maps.model.MarkerOptions; public class MainActivity extends ActionBarActivity { private GoogleMap googleMap;; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); setUpMapIfNeeded(); } private void setUpMapIfNeeded() { if (googleMap == null) { googleMap = ((SupportMapFragment) getSupportFragmentManager() .findFragmentById(R.id.map)).getMap(); if (googleMap != null) { setUpMap(); } } } private void setUpMap() { googleMap.setMyLocationEnabled(true); LocationManager locationmanager = (LocationManager) getSystemService(LOCATION_SERVICE); String provider = LocationManager.NETWORK_PROVIDER; Location myLocation = locationmanager.getLastKnownLocation(provider); googleMap.setMapType(GoogleMap.MAP_TYPE_TERRAIN); double latitude = myLocation.getLatitude(); double longitude = myLocation.getLongitude(); LatLng latlng = new LatLng(latitude, longitude); googleMap.moveCamera(CameraUpdateFactory.newLatLng(latlng)); googleMap.animateCamera(CameraUpdateFactory.zoomTo(15)); } @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 boolea…
score: 0
tagged with: nullpointerexception
has comment: http://stackoverflow.com/comment/34649810
answer count: 1
has answer: http://stackoverflow.com/a/22739061
type: UnansweredQuestion
tagged with: android
tagged with: java
tagged with: eclipse
has title: How to avoid NullPointerException for LOCATION_SERVICE?

http://stackoverflow.com/q/22722930
has title: Adding 'Getters' and 'Setters' for the sake of unit testing?
tagged with: unit-testing
accepted answer: http://stackoverflow.com/a/22723081
type: AnsweredQuestion
tagged with: testing
tagged with: java
has comment: http://stackoverflow.com/comment/34629524
type: Question
score: 12
has comment: http://stackoverflow.com/comment/34630922
upvote count: 12
tagged with: mockito
tagged with: junit
downvote count: 0
has answer: http://stackoverflow.com/a/22723066
has answer: http://stackoverflow.com/a/22723063
has comment: http://stackoverflow.com/comment/34630715
answer count: 3
has body: I am currently working with some pretty iffy code. The code itself is not legacy, but the framework it uses is legacy and is pretty bad. I want to start writing some junit tests for a class (for a change!) but in order to do so effectively I would need to add some getters and setters. I need the setters so I can check the state of the private variables in the class (a kind of state machine design pattern going on here) and I need the getters to mock what the private variables in some methods are. Would you guys say its bad, good or simply acceptable to add getters and setters to a class for the sake of being able to write unit tests?
possible better answer: http://stackoverflow.com/a/22723066
favorite count: 0
has answer: http://stackoverflow.com/a/22723081

http://stackoverflow.com/a/22731933
type: Answer
score: 2
answers question: http://stackoverflow.com/q/22731887
downvote count: 0
upvote count: 2
has body: Arrays are very low-level structures that don't provide any method. You'd better use collections instead, which have a contains() method: Set&lt;String&gt; names = new HashSet&lt;&gt;(Arrays.asList(new String[] {"barry", "matty", "olly","joey"})); if (names.contains(name)) { ... } Since you don't seem to care about the order of the names, but only want to test if the collection contains a name or not, a HashSet is the best data structure: HashSet.contains() runs in constant time (O(1)), whereas List.contains(), for example, is O(n). Read the collections tutorial.

http://stackoverflow.com/q/22754930
type: Question
has title: Java Hibernate and XML not working
score: 0
has answer: http://stackoverflow.com/a/22755052
has comment: http://stackoverflow.com/comment/34686462
has body: I have this project in which I have to use hibernate, this is the first time I use, I don't really know many things about it and I get a bunch of exceptions when I run my program. I have installed the required libraries from hibernate in eclipse. But when I run I get this. I'm sorry that I paste all the errors here but I really have no idea how I could fix them and where to start. Could you please help me Mar 31, 2014 9:44:05 AM org.hibernate.annotations.common.Version &lt;clinit&gt; INFO: HCANN000001: Hibernate Commons Annotations {4.0.1.Final} Mar 31, 2014 9:44:05 AM org.hibernate.Version logVersion INFO: HHH000412: Hibernate Core {4.1.8.Final} Mar 31, 2014 9:44:05 AM org.hibernate.cfg.Environment &lt;clinit&gt; INFO: HHH000206: hibernate.properties not found Mar 31, 2014 9:44:05 AM org.hibernate.cfg.Environment buildBytecodeProvider INFO: HHH000021: Bytecode provider name : javassist Mar 31, 2014 9:44:05 AM org.hibernate.cfg.Configuration configure INFO: HHH000043: Configuring from resource: /hibernate.cfg.xml Mar 31, 2014 9:44:05 AM org.hibernate.cfg.Configuration getConfigurationInputStream INFO: HHH000040: Configuration resource: /hibernate.cfg.xml Mar 31, 2014 9:44:06 AM org.hibernate.cfg.Configuration addResource INFO: HHH000221: Reading mappings from resource: Book.hbm.xml Mar 31, 2014 9:44:06 AM org.hibernate.cfg.Configuration doConfigure INFO: HHH000041: Configured SessionFactory: null Mar 31, 2014 9:44:06 AM org.hibernate.service.jdbc.connections.internal.DriverManagerConnectionProviderImpl configure INFO: HHH000402: Using Hibernate built-in connection pool (not for production use!) Mar 31, 2014 9:44:06 AM org.hibernate.service.jdbc.connections.internal.DriverManagerConnectionProviderImpl configure INFO: HHH000115: Hibernate connection pool size: 20 Mar 31, 2014 9:44:06 AM org.hibernate.service.jdbc.connections.internal.DriverManagerConnectionProviderImpl configure INFO: HHH000006: Autocommit mode: false Mar 31, 2014 9:44:06 AM org.hibernate.service.jdbc…
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/22755228
answer count: 4
has answer: http://stackoverflow.com/a/22754957
has answer: http://stackoverflow.com/a/22754969
tagged with: java
tagged with: hibernate

http://stackoverflow.com/a/30161602
has body: Adding the Tomcat server in the server runtime will do the job: Project Properties → Target Runtimes → Select your Server from the list, "JBoss Runtime" → Finish In case of Apache you can select Apache Runtime.
upvote count: 26
score: 26
answers question: http://stackoverflow.com/q/22756153
downvote count: 0
type: Answer

http://stackoverflow.com/comment/34711279
comment on: http://stackoverflow.com/q/22768449
type: Comment
type: QuestionComment
has text: You make an Ajax request.
score: 1

http://stackoverflow.com/comment/34587062
type: Comment
type: QuestionComment
score: 2
has text: Is this server in some kind of container? Could you bind onto web-app lifecycle or servlet context lifecycle? Class loading lifecycle is.... not an awesomely well defined thing to try to work with.
comment on: http://stackoverflow.com/q/22699561

http://stackoverflow.com/comment/34551479
score: 0
has text: the use of arrays that I have is very limited to pre-defining the array block with integers and then calling them to run methods. I have tried to create a random num generator method in this but when i try to run the boolean and in count with it i cannot get it to produce the correct number of replies.
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/22680031

http://stackoverflow.com/q/22763757
tagged with: nodes
has comment: http://stackoverflow.com/comment/34702844
has answer: http://stackoverflow.com/a/22764434
type: Question
has answer: http://stackoverflow.com/a/22763970
downvote count: 0
has body: A segment of my code is triggering an infinite while loop, and I'm not sure why. I've used the loop itself before to add friends to a Linked List in this same program and it worked fine, so I do not understand why it is turning into an infinite loop now. while (!a.equals("*")){ curr = friendlist.getUsers().getFront(); while (curr!=null){ if (curr.getData().getName().equals(a)){ //why is it not removing friends? d.removeFriend(curr.getData()); } curr = curr.getNext(); } System.out.println("Add a friend by typing in their name. Enter * to end. "); a = in.nextLine(); } The above code accesses the following segment from another class: public void removeFriend(User u){ if (friendsList.isEmpty()){ System.out.println("Empty list, cannot remove."); } else{ Node c = friendsList.getFront(); while (c.getNext()!=null){ if (c.getNext().getData().equals(u)){ //condition: if the data is the same c.setNext(c.getNext().getNext()); //change the link c.getNext().setData(null); //set the next data to null (cut the link) friendsList.setSize(friendsList.size()-1); c = c.getNext(); } } } } Why is the code not running properly?
tagged with: while-loop
has answer: http://stackoverflow.com/a/22763985
has comment: http://stackoverflow.com/comment/34702803
favorite count: 0
upvote count: 2
type: UnansweredQuestion
has title: Loop Turning into an Infinite Loop
answer count: 4
score: 2
tagged with: linked-list
has comment: http://stackoverflow.com/comment/34708720
tagged with: java
has answer: http://stackoverflow.com/a/22763979

http://stackoverflow.com/q/22721115
has answer: http://stackoverflow.com/a/22726560
tagged with: google-mirror-api
type: AnsweredQuestion
has title: Mirror API in Eclipse
possible better answer: http://stackoverflow.com/a/22726560
tagged with: java
has body: I downloaded the glass-java-starter from github and followed all of the instructions on the glass developers site. I got it imported into Eclipse as a Maven existing project as instructed and I changed the oAuth file ID and Secret as specified. When I try to start the project or debug the project I am getting the following exception: Source not found for http://cwiki.apache.org/confluence/display/MAVEN/NoGoalSpecifiedException. The instructions give a command line command for running the project, $ mvn jetty, but nothing for Eclipse. How do I debug this project with Eclipse?
type: Question
tagged with: eclipse
has comment: http://stackoverflow.com/comment/34636074
score: 0
answer count: 3
upvote count: 1
downvote count: 1
favorite count: 0
tagged with: google-glass
has answer: http://stackoverflow.com/a/22722114
accepted answer: http://stackoverflow.com/a/22722114
linked to: http://stackoverflow.com/q/21099072
has answer: http://stackoverflow.com/a/22726579
tagged with: maven

http://stackoverflow.com/a/22667300
upvote count: 4
type: AcceptedAnswer
downvote count: 0
accepted answer of: http://stackoverflow.com/q/22665723
type: Answer
has body: Commenting out the APR listener in server.xml line:27 does the trick in Windows OS. Found the solution from http://java.dzone.com/articles/ssl-your-tomcat-7 The APR is a native library that you may install during Tomcat installation. It does tie your Tomcat to your OS but "provide superior scalability and performance". This is a good thing to do for your production environment. In other environments, I don't see the point.
answers question: http://stackoverflow.com/q/22665723
score: 4

http://stackoverflow.com/comment/71358773
type: AnswerComment
type: Comment
has text: Can you clarify if resolved means this now works on POST requests? The example in the linked thread uses GET.
comment on: http://stackoverflow.com/a/41032995
score: 0

http://stackoverflow.com/comment/34547194
type: AnswerComment
comment on: http://stackoverflow.com/a/22677472
type: Comment
has text: I do this all the time :P
score: 1

http://stackoverflow.com/comment/34750933
type: Comment
has text: That's right. The TestNG documentation is not really clear on this but all of the @Configuration methods can accept built-in optional arguments, such as what you see above, and so you can do some pretty amazing things in different parts of the test lifecycle.
comment on: http://stackoverflow.com/a/22776020
type: AnswerComment
score: 0

http://stackoverflow.com/q/22715707
type: AnsweredQuestion
tagged with: java
has comment: http://stackoverflow.com/comment/34618719
type: Question
has comment: http://stackoverflow.com/comment/34617582
tagged with: jtable
score: 0
answer count: 1
has answer: http://stackoverflow.com/a/22720052
accepted answer: http://stackoverflow.com/a/22720052
has title: JTable single click select entire line of selected cell, double click edit row
tagged with: swing
has body: I have a project where I have a JTable and : on single click on a row must select the entire line from jtable not only the clicked cell on double click on a cell that row must be editable I use Netbeans IDE, if relevant. The JTable code : public class ModelTabelAbonati extends AbstractTableModel { Abonat[] tabelAbonati = new Abonat[0]; public void Adauga (String nume, String prenume, String cnp, Integer telefon){ tabelAbonati= Arrays.copyOf(tabelAbonati, tabelAbonati.length+1); tabelAbonati[tabelAbonati.length-1]=new Abonat (nume,prenume, cnp, telefon); fireTableRowsInserted(tabelAbonati.length-1, tabelAbonati.length-1); } public void Adauga(String nume, String prenume, String cnp, int telefon){ tabelAbonati= Arrays.copyOf(tabelAbonati, tabelAbonati.length+1); tabelAbonati[tabelAbonati.length-1]=new Abonat (nume,prenume, cnp, telefon); fireTableRowsInserted(tabelAbonati.length-1, tabelAbonati.length-1); } @Override public String getColumnName(int column){ return new String[]{"Nr. ","Nume ","Prenume ","CNP ","Tel. Fix ","Tel. Mobil"}[column]; } @Override public int getRowCount() { return tabelAbonati.length; } @Override public int getColumnCount() { return 6; } @Override public Object getValueAt(int rowIndex, int columnIndex) { Abonat a= tabelAbonati[rowIndex]; switch (columnIndex){ case 0: return rowIndex+1; case 1: return a.getNume(); case 2: return a.getPrenume(); case 3: return a.getCnp(); case 4: return a.getTelefon().getTelFix(); case 5: return a.getTelefon().getTelMobil(); default: return "ERROR"; } } }
has comment: http://stackoverflow.com/comment/34632251

http://stackoverflow.com/comment/34754206
type: QuestionComment
type: Comment
has text: @ryvantage The author of `java.time` is the author of JodaTime. So I'd say that `java.time` is the spiritual successor of JodaTime.
score: 0
comment on: http://stackoverflow.com/q/22792509

http://stackoverflow.com/comment/34615478
type: QuestionComment
has text: http://codereview.stackexchange.com/ this site would be better suited for your needs
type: Comment
score: 1
comment on: http://stackoverflow.com/q/22715457

android-viewpager
tag name: android-viewpager
tags question: http://stackoverflow.com/q/22758816
type: Tag

http://stackoverflow.com/comment/34717062
comment on: http://stackoverflow.com/a/22768541
score: 1
has text: Thanks @donfuxx. I actually started reading the official documentation on fragments before I saw your comment and it helped. I will move all of my fragment-related code to within the fragment subclass. Many thanks!
type: AnswerComment
type: Comment

http://stackoverflow.com/comment/34647180
has text: Yes, it sounds right. It's OK for single tests to require many steps. However, the many steps required for a test suggest there may be some design problems with the code - perhaps the class is trying to do too much (cohesion) or store too much state etc. Again, consider breaking up the class into smaller classes each with tighter/narrower scope of concern and bring them together at a higher level. That way, you can test each of the parts separately, bring a few together at a time for some broader unit tests, and let system testing catch the big-picture tests.
comment on: http://stackoverflow.com/a/22731636
type: AnswerComment
type: Comment
score: 0

http://stackoverflow.com/comment/34543577
comment on: http://stackoverflow.com/q/22675242
score: 0
has text: to preload would I do something like image ii=new ImageIcon("star1.png"); ? Right now I'm just trying to push 'S' and have the star1.png image to appear at (300,300). Once I do that I plan on having it move away from my stick man. I've double checked all file names they are correct and present.
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/34792103
has text: @developerwjk Yeah, experience is great, it forms your own opinion.
score: 0
comment on: http://stackoverflow.com/q/22703079
type: QuestionComment
type: Comment

http://stackoverflow.com/comment/34779733
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/22806764
score: 1
has text: You mean iterations, not irritations :)

http://stackoverflow.com/comment/34556753
has text: No, i've tried Neo4j 2.0.1 and the milestone with actual(3.0.1) and previous release(2.3.5) of Spring Data
comment on: http://stackoverflow.com/q/22677382
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/34650892
score: 0
type: Comment
has text: Thanks for suggestion. I was about to try your first suggestion but got confused is the first line starting with `Type` correct? If yes, then what I am supposed to import for those? This is the first time, I am seeing `Type` and `TypeToken` so got confused
comment on: http://stackoverflow.com/a/22730361
type: AnswerComment

http://stackoverflow.com/comment/34787355
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/22796629
has text: Using the line fileOutputStream.write(1); writes a special character which looks like [] to the file.
score: 0

http://stackoverflow.com/comment/34541770
score: 0
comment on: http://stackoverflow.com/q/22674313
type: Comment
type: QuestionComment
has text: Count the number of times the word appears?

abstract-class
tags question: http://stackoverflow.com/q/22649908
type: Tag
tags question: http://stackoverflow.com/q/22803776
tags question: http://stackoverflow.com/q/22736724
tags question: http://stackoverflow.com/q/22799389
tag name: abstract-class
tags question: http://stackoverflow.com/q/22683464
tags question: http://stackoverflow.com/q/22721400
tags question: http://stackoverflow.com/q/22740770
tags question: http://stackoverflow.com/q/22790290

http://stackoverflow.com/comment/34675637
type: QuestionComment
has text: I guess I mean, *physical memory*. Virtual memory does abstractions based on disk too. So to understand it, I would like to know what happens. Does it write contents of memory to disk, and load them again, but creates a contiguous block of 300 units?
score: 0
comment on: http://stackoverflow.com/q/22748906
type: Comment

http://stackoverflow.com/comment/126972558
comment on: http://stackoverflow.com/a/22802295
score: 1
type: AnswerComment
has text: If `list` is created from `Arrays.asList()`, you will get a error of `UnsupportedOperationException`, just make the input as an `ArrayList` by `new ArrayList<>(Arrays.asList("one", "two", "three"));` will work, please refer: https://stackoverflow.com/questions/32929410/java-8-unsupportedoperationexception-on-sublist-clear
type: Comment

http://stackoverflow.com/a/22910723
type: Answer
has body: In GXT, every Field has a setOriginalValue(D originalValue) method which could help you in this matter too. You can always return to the original value by reset()ing the Field. Please keep in mind that reset() will clear the validation messages too! How to use it in situations like this? Set the original value when the entered value is validated fine Call Field.reset(), if anything went wrong to reload the last working value in your field.
answers question: http://stackoverflow.com/q/22659882
score: 0

http://stackoverflow.com/q/22695572
has comment: http://stackoverflow.com/comment/34580097
tagged with: spring
score: 1
tagged with: java
has body: I´m creating a @Component that will be a Service Layer in one of our artifacts, I want to wrap all the possible exception coming from this new component into an specific artifact Exception (just for given a name it will be ArtifactException). My question is how I can translate any exception that happens in this service layer or layers below to the ArtifactException. I´m looking for more elegant solution than: (Catch and re-throw) catch (NamingException ex){ //EXCEPTION WRAPPING throw new ArtifactException( "Config error with JNDI and datasource, for db " + Util.quote(dbConnString), ex ); } catch (SQLException ex ){ //EXCEPTION WRAPPING throw new ArtifactException( "Cannot get connection from datasource, for db " + Util.quote(dbConnString), ex ); } I was thinking in using @AfterThrowing with aspects but I want to be out of aspects to keep this simple. I know about @ExceptionHandler but this works with DispatcherServlet which are not implemented as we are working in the service layer, nothing to dowith spring-mvc There is any other option to handle this using Spring?, perhaps a new annotation that I did not know or any other method. I think what I'm looking is know as Exception Translator for Service Layer in Spring Thanks.
type: Question
has title: Exception Wrapper for Service Layer
has comment: http://stackoverflow.com/comment/34583102
downvote count: 0
favorite count: 0
tagged with: exception
tagged with: architecture
has comment: http://stackoverflow.com/comment/34582234
has comment: http://stackoverflow.com/comment/34579768
has comment: http://stackoverflow.com/comment/34580251
answer count: 0
type: UnansweredQuestion
upvote count: 1

http://stackoverflow.com/q/22806318
has title: How can I finish data stream to InputSource to parse it
score: 0
tagged with: parsing
tagged with: http://stackoverflow.com/tag/xml
answer count: 0
type: UnansweredQuestion
has body: I am trying to build combined SAX/DOM parser which would use SAX parser to determine blocks of data I need and forward these blocks one by one to DOM parser. For this I'm using XLMWriter, which writes blocks I need to InputSource using PipedInputStream/PipedOutputStream: public class CombinedReaderObserv { XMLOutputFactory output = null; XMLStreamWriter writer = null; PipedOutputStream out; PipedInputStream in; InputSource inpSourse; public CombinedReaderObserv () throws IOException, XMLStreamException { out = new PipedOutputStream(); in = new PipedInputStream(out); inpSourse = new InputSource(in); output = XMLOutputFactory.newInstance(); writer = output.createXMLStreamWriter(out); } @Override public void read(InputStream is) throws Exception { //Create SAX parser SAXParserFactory SAXfactory = SAXParserFactory.newInstance(); SAXParser parser = SAXfactory.newSAXParser(); SAXHandler handler = new SAXHandler(); parser.parse(is, handler); writer.close(); } private class SAXHandler extends DefaultHandler { @Override public void startElement(String URI, String localName, String qName, Attributes attributes) { try { //Enables data streaming if found Facility Site starting tag //element and starts streaming data to the InputSource switch (qName) { case "FacilitySite": write = true; writer.writeStartDocument(); writer.writeStartElement("root"); default: if (write == true) { writer.writeStartElement(qName); } } } catch (XMLStreamException ex) { ex.printStackTrace(); } } @Override public void endElement(String URI, String localName, String qName) { switch (qName) { //ends all XML elements and forvardsthe InputSource object //to parser if found facility site element closing tag case "FacilitySite": try { writer.writeEndElement(); writer.writeEndElement(); writer.writeEndDocument(); reader.read(inpSourse); writer.flush(); //Program stops here } catch (Exception ex) { ex.printStackTrace(); } write = false; break; default: if (write == true) { try { writer.writeEndElement(); } cat…
has comment: http://stackoverflow.com/comment/34781746
tagged with: java
has comment: http://stackoverflow.com/comment/34778999
type: Question

http://stackoverflow.com/comment/34637651
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/22713090
has text: DER encoding is binary, while PEM is base64 encoded (with a `-----BEGIN CERT-----` and friends). What do you have?

wildfly
tags question: http://stackoverflow.com/q/22729774
tags question: http://stackoverflow.com/q/22758645
type: Tag
tags question: http://stackoverflow.com/q/22748847
tags question: http://stackoverflow.com/q/22772480
tags question: http://stackoverflow.com/q/22680989
tags question: http://stackoverflow.com/q/22749570
tag name: wildfly
tags question: http://stackoverflow.com/q/22776107
tags question: http://stackoverflow.com/q/22673449
tags question: http://stackoverflow.com/q/22764262

http://stackoverflow.com/a/22674888
has body: In response to the question "Could I still use this generator?" from the comment: You could still use it to create a complete bipartite graph, and then randomly remove some edges. But a more straightforward approach would be to simply generate two sets of vertices and insert some random edges between them. In fact, this is so easy that I have to assume that there are additional constraints that you did not mention until now. I inserted another method where it is made sure that the bipartite graph does not contain isolated vertices (my crystal ball told be to do so...) import java.util.ArrayList; import java.util.List; import java.util.Random; import org.jgrapht.Graph; import org.jgrapht.UndirectedGraph; import org.jgrapht.VertexFactory; import org.jgrapht.graph.DefaultEdge; import org.jgrapht.graph.SimpleGraph; public class BipartiteGraphTest { public static void main(String[] args) { UndirectedGraph&lt;String, DefaultEdge&gt; graph = new SimpleGraph&lt;String, DefaultEdge&gt;(DefaultEdge.class); VertexFactory&lt;String&gt; vertexFactory = new VertexFactory&lt;String&gt;() { int n = 0; @Override public String createVertex() { String s = String.valueOf(n); n++; return s; } }; int numVertices0 = 10; int numVertices1 = 15; int numEdges = 20; generateGraph(graph, numVertices0, numVertices1, numEdges, vertexFactory); System.out.println(graph); } // Creates a bipartite graph with the given numbers // of vertices and edges public static &lt;V, E&gt; void generateGraph(Graph&lt;V, E&gt; graph, int numVertices0, int numVertices1, int numEdges, final VertexFactory&lt;V&gt; vertexFactory) { List&lt;V&gt; vertices0 = new ArrayList&lt;V&gt;(); for (int i = 0; i &lt; numVertices0; i++) { V v = vertexFactory.createVertex(); graph.addVertex(v); vertices0.add(v); } List&lt;V&gt; vertices1 = new ArrayList&lt;V&gt;(); for (int i = 0; i &lt; numVertices1; i++) { V v = vertexFactory.createVertex(); graph.addVertex(v); vertices1.add(v); } // Create edges between random vertices Random ra…
accepted answer of: http://stackoverflow.com/q/22669614
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/34556244
has comment: http://stackoverflow.com/comment/34595149
has comment: http://stackoverflow.com/comment/34543844
type: Answer
answers question: http://stackoverflow.com/q/22669614
score: 1
upvote count: 1

pdfbox
tag name: pdfbox
type: Tag
tags question: http://stackoverflow.com/q/22806794
tags question: http://stackoverflow.com/q/22774668

http://stackoverflow.com/comment/34576496
type: AnswerComment
score: 0
comment on: http://stackoverflow.com/a/22693873
type: Comment
has text: what I am trying to do is to load a block of the file into memory, pass that block to a thread that will be executed on a different device and so on till I load the whole file, this is an exercise in a parallel programming course

http://stackoverflow.com/comment/34611613
type: Comment
score: 0
type: QuestionComment
has text: I am just learning how to use Joda-Time, how would you use the `Interval` object?
comment on: http://stackoverflow.com/q/22713288

embedded-tomcat-7
type: Tag
tag name: embedded-tomcat-7
tags question: http://stackoverflow.com/q/22690905

http://stackoverflow.com/comment/34729008
type: Comment
type: QuestionComment
has text: Yes dev server is localhost (and it works), but the remote server has a dns. I'll edit and post some code
comment on: http://stackoverflow.com/q/22763934
score: 0

http://stackoverflow.com/q/22661538
has answer: http://stackoverflow.com/a/22661901
has body: I create a few textViews with onClickListeners at run time. But I get a NullPointer... I think the reason is the View, he dosnt know where the textView should be. How could I solve this? The interesting lines of the class ShowSomething: textView.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { Toast.makeText(ShowSomething.this, textView.getText().toString(), Toast.LENGTH_LONG).show(); } }); layout.addView(t); Full class ShowSomething: public class ShowSomething extends Activity { public void showData(final String[][] array, final int i, int j, LinearLayout layout, final TextView t, TextView t2, int color) { String Text = null; int size = 12; int top = 0; int bot = 0; if (j == 0) { size = 14; Text = array[j][i]; top = 5; bot = 0; } if (j == 1) { size = 10; Text = " " + array[j][i]; top = 5; bot = 5; } t.setTextSize(TypedValue.COMPLEX_UNIT_DIP, size); t.setTextColor(color); t.setPadding(0, top, 0, bot); t.setClickable(false); t.setText(Text); t.setId(j + i); t.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { Toast.makeText(ShowSomething.this, t.getText().toString(), Toast.LENGTH_LONG).show(); } }); layout.addView(t); } } The interesting lines of the class ProjectsActivity: setContentView(R.layout.activity_projects); int j = 0; //result for (i = 0; i &lt; array[0].length; i++) { while (j &lt;2) { LinearLayout layout = (LinearLayout) findViewById(R.id.mainLayout); final TextView t = new TextView(getApplicationContext()); final TextView t2 = new TextView(getApplicationContext()); ShowSomething.showData(array, i, j, layout, t, t2, color); Full class ProjectsActivity: public class ProjectsActivity extends Activity { public String[][] array = null; public int i = 0; int color; ShowSomething show = new ShowSomething(); @SuppressLint("NewApi") @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_projects); int j = 0; array = Connec…
has title: New onClickListener with NullPointerException (Android)
type: Question
has comment: http://stackoverflow.com/comment/34518061
has comment: http://stackoverflow.com/comment/34518392
has answer: http://stackoverflow.com/a/22662268
accepted answer: http://stackoverflow.com/a/22662268
has comment: http://stackoverflow.com/comment/34519479
score: 0
has comment: http://stackoverflow.com/comment/34518121
possible better answer: http://stackoverflow.com/a/22662662
tagged with: android
has comment: http://stackoverflow.com/comment/34518899
has comment: http://stackoverflow.com/comment/34518894
has comment: http://stackoverflow.com/comment/34518079
linked to: http://stackoverflow.com/q/2091465
has comment: http://stackoverflow.com/comment/34520252
answer count: 4
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/22662662
has comment: http://stackoverflow.com/comment/34519864
has answer: http://stackoverflow.com/a/22662648
tagged with: java
has comment: http://stackoverflow.com/comment/34518383

http://stackoverflow.com/a/22785945
type: Answer
has body: This is the problem: str.charAt(i)+count+"," That's performing a char + int conversion, which is just integer arithmetic, because + is left-associative. The resulting integer is then converted to a string when "," is concatenated with it. So this: finalString+=str.charAt(i)+count+","; is equivalent to: int tmp1 = str.charAt(i)+count; String tmp2 = tmp1 + ","; finalString += tmp2; I suggest you use: String.valueOf(str.charAt(i)) + count to force string concatenation. Better yet, use a StringBuilder: builder.append(str.charAt(i)).append(count).append(","); That's clearer and more efficient :)
score: 2
upvote count: 2
answers question: http://stackoverflow.com/q/22785878
downvote count: 0

http://stackoverflow.com/a/22803392
downvote count: 0
has comment: http://stackoverflow.com/comment/34777038
accepted answer of: http://stackoverflow.com/q/22803122
type: Answer
answers question: http://stackoverflow.com/q/22803122
has body: Im not sure if that is, what you are looking for. It sounds like, you want to be able to restore a hidden (frame1.setVisible(false);) window from within another class. To do that, you have to provide access to a reference to your frame1. Then you are able to restore the the window as is. Your main window: public class Window1 extends JFrame { private final String username; private final String password; public Window1 (final String username, final String password) { this.username = username; this.password = password; // do initial stuff for you frame here this.setVisible(true); } // have to implement actual button action listener here private onButtonClick() { final Window2 = new Window2(this); this.setVisible(false); } } Your second window (maybe a dialog or something?): public class Window2 extends JFrame { private final JFrame firstWindow; public Window2(final JFrame firstWindow) { if (firstWindow == null) throw new IllegalArgumentException("No main window specified"); this.firstWindow = firstWindow; // do initial stuff for your temp window here this.setVisible(true); } // have to implement actual button action listener here private onButtonClick() { firstWindow.setVisible(true); this.dispose(); } }
score: 2
has comment: http://stackoverflow.com/comment/34775891
has comment: http://stackoverflow.com/comment/34774996
has comment: http://stackoverflow.com/comment/34774736
has comment: http://stackoverflow.com/comment/34774857
has comment: http://stackoverflow.com/comment/34774658
has comment: http://stackoverflow.com/comment/34774133
upvote count: 2
type: AcceptedAnswer

http://stackoverflow.com/comment/34672873
type: Comment
type: QuestionComment
has text: what is the output of `java -version` command
comment on: http://stackoverflow.com/q/22747459
score: 0

http://stackoverflow.com/comment/34646157
type: Comment
has text: CREATE TABLE `demo1`.`tbl2` ( `id` INTEGER UNSIGNED NOT NULL AUTO_INCREMENT, `id_tbl1` INTEGER UNSIGNED NOT NULL, `hobbies` VARCHAR(45) NOT NULL, PRIMARY KEY (`id_tbl2`), CONSTRAINT `FK_tbl4_1` FOREIGN KEY `FK_tbl4_1` (`id_tbl1`) REFERENCES `tbl1` (`id`) ON DELETE RESTRICT ON UPDATE RESTRICT ) ENGINE = InnoDB; INSERT INTO tbl2(id_tbl1,hobibes) values('1','tennis'),('1','football'),('2','carrom'),('2','cricket'),('3','rugby'),('4','reading');
type: AnswerComment
score: 0
comment on: http://stackoverflow.com/a/22731433

http://stackoverflow.com/q/22671024
type: Question
has comment: http://stackoverflow.com/comment/34535573
answer count: 1
tagged with: tomcat
score: 0
has body: Okay, I need some guidance, guys. I'm trying to do a small project that is going to basically create something like "doctor's office software" in which you create a desktop app that can create and manage profiles of people/things. These things would need to be placed from the app into an online db to be accessed from anywhere by signing in on the app. I'm relatively new, and I know it may be ambitious, but I'd like to give it a go. Can you guide me a bit in setting up a web based db for a desktop app? I know nothing about it, basically. I'm programming in java. Thanks!
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/22671160
tagged with: java
tagged with: mysql
has title: How do I connect a desktop java app to an online database (for dummies)?
tagged with: desktop

http://stackoverflow.com/comment/34780157
score: 0
type: Comment
has text: if there is no "Some" in String pool, than it will be created and added to the pool, right?
comment on: http://stackoverflow.com/a/22806725
type: AnswerComment

http://stackoverflow.com/comment/34825654
type: Comment
comment on: http://stackoverflow.com/q/22787412
type: QuestionComment
has text: Well first you need to know what is the expected date format for excel and then parse date from java.
score: 0

http://stackoverflow.com/comment/34596821
comment on: http://stackoverflow.com/a/22704967
score: 0
type: AnswerComment
type: Comment
has text: if it works, for you, please don't forget to vote this answer so that others will find answers easily related with the heap space out of memory problem.

http://stackoverflow.com/comment/34535209
has text: Have you looked tried changing the order? Also have you looked at similar errors like: http://stackoverflow.com/questions/14556050/error-in-weblogic-xml-cvc-complex-type-2-4-a-invalid-content-was-found-starti http://stackoverflow.com/questions/12893675/invalid-deployment-descriptors-in-deployment-descriptor-file-web-inf-web-xml-in
score: 0
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/22662696

http://stackoverflow.com/comment/34780510
type: AnswerComment
comment on: http://stackoverflow.com/a/22804578
type: Comment
has text: Thanks for your answer. However I don't have control over the test client's source code. I have reworked my question so that I need some -D switch or else.
score: 0

http://stackoverflow.com/comment/34680034
type: Comment
comment on: http://stackoverflow.com/q/22751281
type: QuestionComment
has text: right so what do I do? get the value of the textfield then pass to string?
score: 0

http://stackoverflow.com/comment/34838120
score: 0
has text: I have updated my questions showing what the requirements are and I would post the result If I am able to find a solution...
type: Comment
comment on: http://stackoverflow.com/q/22794473
type: QuestionComment

http://stackoverflow.com/a/22770738
answers question: http://stackoverflow.com/q/22769904
has comment: http://stackoverflow.com/comment/34729301
type: Answer
has body: Yes, it is possible, but why? Read: Java GUI frameworks. What to choose? Swing, SWT, AWT, SwingX, JGoodies, JavaFX, Apache Pivot? here you will be able to find many others GUI frameworks which could be useful for you.
has comment: http://stackoverflow.com/comment/34727734
score: 0

http://stackoverflow.com/comment/34568538
comment on: http://stackoverflow.com/q/22689772
score: 3
has text: Are you using `java.awt.List`? You should be using `java.util.List` instead.
type: QuestionComment
type: Comment

http://stackoverflow.com/q/22744406
has body: I'm retrieving user input such as "tea, coffee, latte" from a JTextField, the following input is then queried to a particular result that includes the strings "tea, coffee, latte" within the database: public void actionPerformed(ActionEvent e) { try { String abc = field.getText(); StringTokenizer str = new StringTokenizer(abc); while (str.hasMoreTokens()) { str.nextToken((", ")).trim(); } Class.forName("com.mysql.jdbc.Driver"); Connection con = DriverManager.getConnection("jdbc:mysql://localhost:3306/intelli_db", "root", "root"); PreparedStatement st1 = con.prepareStatement("SELECT * FROM SHOP WHERE DRINKS LIKE '%" + abc + "%' OR '%" + abc + "%' OR '%" + abc + "%' OR '%" + abc + "%'"); ResultSet rs = st1.executeQuery(); if (rs.next()) { String s = rs.getString(1); String s1 = rs.getString(2); String s2 = rs.getString(3); //Sets Records in TextFields. field6.setText(s2); } else { JOptionPane.showMessageDialog(null, "No such input found"); } //Create Exception Handler } catch (Exception ex) { System.out.println(ex); } } however, I wish it to find the result of any combination of these strings, so "coffee, latte, tea" would also give the same result as ""tea, coffee, latte" would. The database structure: Menu_ID -------- 1 Drinks ------- tea, coffee, latte Hot_Drinks_Description ------------------------ There are various hot drinks available, including Earl Grey tea, white or black coffee or a Latte. Thus if the user types in either, tea or coffee or latte or a combination - separated by comma's, the result would display the description of the hot drinks available.
tagged with: string
linked to: http://stackoverflow.com/q/17842211
has comment: http://stackoverflow.com/comment/34667332
has title: Retrieving a result by different combination's using StringTokenizer and MYSQL
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/22745908
tagged with: java
tagged with: stringtokenizer
has comment: http://stackoverflow.com/comment/34667119
type: Question
has comment: http://stackoverflow.com/comment/34667765
accepted answer: http://stackoverflow.com/a/22745908
score: 0
has comment: http://stackoverflow.com/comment/34667914
answer count: 1
has comment: http://stackoverflow.com/comment/34667995

preferences
tags question: http://stackoverflow.com/q/22722093
tags question: http://stackoverflow.com/q/22788439
type: Tag
tag name: preferences
tags question: http://stackoverflow.com/q/22715623

http://stackoverflow.com/comment/43944297
score: 0
type: Comment
has text: Is there any possible way to get the predicates means what user defined startsWith or Contains or whatever conditions that has been defined.
type: AnswerComment
comment on: http://stackoverflow.com/a/22736179

http://stackoverflow.com/a/22795771
has body: There has to have been a incoding error or something, wrote the same code another time and it worked.
type: Answer
answers question: http://stackoverflow.com/q/22725146
score: 0

http://stackoverflow.com/q/22732722
downvote count: 1
tagged with: coding-style
possible better answer: http://stackoverflow.com/a/22977787
tagged with: java
answer count: 5
has body: How do I configure Android Studio (or Intellij generally) to correctly generate getters and setters for member variables with prefixes? If I have a class public class Foo{ int mBar; } I want it to create getBar() instead of getMBar when I do Refactor-&gt;Encapsulate or Generate EDIT I found the way to do it per-project basis: You just go File-&gt;Settings-&gt;Project Settings-&gt;Code Style But it created a settings file somewhere in my project directory. I want a solution which allows me to do it once for all projects, present and future.
has answer: http://stackoverflow.com/a/28228793
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/34646860
tagged with: intellij-idea
has comment: http://stackoverflow.com/comment/34646847
has answer: http://stackoverflow.com/a/51259315
favorite count: 0
type: Question
has title: Intellij (Android studio) member variable prefix
accepted answer: http://stackoverflow.com/a/28228793
tagged with: android-studio
has answer: http://stackoverflow.com/a/55753736
upvote count: 77
has answer: http://stackoverflow.com/a/22977787
has comment: http://stackoverflow.com/comment/34646677
has answer: http://stackoverflow.com/a/40001913
has comment: http://stackoverflow.com/comment/34646726
score: 76

http://stackoverflow.com/a/22726748
has body: This sounds like a timezone issue. Maybe you should set the timezone for the date format to UTC.
downvote count: 0
has comment: http://stackoverflow.com/comment/34637074
type: Answer
has comment: http://stackoverflow.com/comment/34637219
answers question: http://stackoverflow.com/q/22726570
score: 1
upvote count: 1

http://stackoverflow.com/q/22650176
answer count: 1
has body: I have a CellTable and I wanna do a rowspan and colspan, but CellTable don't give methods for this. In my ui.xml I have my CellTable. &lt;b:CellTable ui:field="groupViewTable&gt;&lt;/b:CellTable&gt; Java Code Celltable: public CellTable&lt;String&gt; createGroupViewTable() { groupViewTable = new CellTable&lt;String&gt;(); groupViewTable.setLoadingIndicator(null); List&lt;String&gt; listObjects = new ArrayList&lt;String&gt;(); listObjects.add("Revenue"); listObjects.add("Teste"); TextColumn conceptColumn = new TextColumn() { @Override public String getValue(Object object) { return "Concept"; } }; groupViewTable.addColumn(conceptColumn, "Concept"); TextColumn proposalColumn = new TextColumn() { @Override public String getValue(Object object) { return "Proposal"; } }; groupViewTable.addColumn(conceptColumn, "Proposal"); TextColumn eurColumn = new TextColumn() { @Override public String getValue(Object object) { return "EUR"; } }; groupViewTable.addColumn(conceptColumn, "EUR"); TextColumn hoursColumn = new TextColumn() { @Override public String getValue(Object object) { return "Hours"; } }; groupViewTable.addColumn(conceptColumn, "Hours"); TextColumn lastEurColumn = new TextColumn() { @Override public String getValue(Object object) { return "EUR"; } }; groupViewTable.addColumn(lastEurColumn, "EUR"); groupViewTable.setRowCount(listObjects.size(), true); groupViewTable.setRowData(0, listObjects); return groupViewTable; } This CellTable is a just test. Its show a header with only one row, but I would like some similar this: http://www.w3.org/TR/html401/images/mergedcells.gif How can I do this? Thanks for attention.
has answer: http://stackoverflow.com/a/22650501
tagged with: gwt-bootstrap
type: AnsweredQuestion
tagged with: java
type: Question
has comment: http://stackoverflow.com/comment/34532713
tagged with: gwt
has title: CellTable - How can I do rowspan and colspan
linked to: http://stackoverflow.com/q/14879353
accepted answer: http://stackoverflow.com/a/22650501
score: 0

http://stackoverflow.com/comment/34499186
type: Comment
type: QuestionComment
score: 2
has text: 1) Where's the `foreach` loop? 2) What's the error?
comment on: http://stackoverflow.com/q/22650444

http://stackoverflow.com/q/22782347
tagged with: android-listview
tagged with: android
has body: I'm developing a simple android application. I want to display listview attributes using another activity when clicking the list item. But I stucked in the above error. This is my java class, import android.app.ListActivity; import android.content.Intent; import android.database.Cursor; import android.os.Bundle; import android.view.View; import android.widget.AdapterView; import android.widget.AdapterView.OnItemClickListener; import android.widget.ListView; import android.widget.TextView; // Main class for creating job_id lists public class TourNumberList extends ListActivity{ TourNumberListAdapter tourNumberListAdapter; public void onCreate(Bundle savedInstanceState){ super.onCreate(savedInstanceState); setContentView(R.layout.tour_list); TourInfoDatabaseHelper jobInfoDatabaseHelper = new TourInfoDatabaseHelper(this); Cursor cursorTourNumberInfo = jobInfoDatabaseHelper.getAllJobInfoRecords(); if(cursorTourNumberInfo.moveToFirst()){ do{ String jobId = cursorTourNumberInfo.getString(0); String startLocation = cursorTourNumberInfo.getString(1); String endLocation = cursorTourNumberInfo.getString(2); String type = cursorTourNumberInfo.getString(3); String tourNumber = cursorTourNumberInfo.getString(5); android.util.Log.d("DB value", jobId+" "+startLocation+" "+endLocation+" "+type+" "+tourNumber); }while(cursorTourNumberInfo.moveToNext()); } ListView listView = (ListView) findViewById(R.id.tourList); tourNumberListAdapter = new TourNumberListAdapter(this, cursorTourNumberInfo); listView.setAdapter(tourNumberListAdapter); // Get listview ListView lv = getListView(); // on seleting single product // launching Edit Product Screen lv.setOnItemClickListener(new OnItemClickListener() { @Override public void onItemClick(AdapterView&lt;?&gt; parent, View view, int position, long id) { // getting values from selected ListItem String startLocation = ((TextView) view.findViewById(R.id.start_location_invisible)).getText().toString(); String endLocation = ((TextView) view.findViewB…
has answer: http://stackoverflow.com/a/22782372
accepted answer: http://stackoverflow.com/a/22782372
type: AnsweredQuestion
tagged with: java
tagged with: listview
type: Question
possible better answer: http://stackoverflow.com/a/22782382
tagged with: r.java-file
answer count: 2
linked to: http://stackoverflow.com/q/11050817
has answer: http://stackoverflow.com/a/22782382
has title: java.lang.RuntimeException: Your content must have a ListView whose id attribute is 'android.R.id.list'- error
duplicate of: http://stackoverflow.com/q/11050817
score: 0

http://stackoverflow.com/comment/34536445
type: AnswerComment
score: 0
type: Comment
comment on: http://stackoverflow.com/a/22671417
has text: Then this answer can be moved to a comment saying: *I don't think cars should be compared by name only*...

swing
tags question: http://stackoverflow.com/q/22685423
tags question: http://stackoverflow.com/q/22667099
tags question: http://stackoverflow.com/q/22702238
tags question: http://stackoverflow.com/q/22766644
tags question: http://stackoverflow.com/q/22715365
tags question: http://stackoverflow.com/q/22748399
tags question: http://stackoverflow.com/q/22745313
tags question: http://stackoverflow.com/q/22793454
tags question: http://stackoverflow.com/q/22777498
tags question: http://stackoverflow.com/q/22747612
tags question: http://stackoverflow.com/q/22731675
tags question: http://stackoverflow.com/q/22717779
tags question: http://stackoverflow.com/q/22765816
tags question: http://stackoverflow.com/q/22713093
tags question: http://stackoverflow.com/q/22743773
tags question: http://stackoverflow.com/q/22715833
tags question: http://stackoverflow.com/q/22663387
tags question: http://stackoverflow.com/q/22721955
tags question: http://stackoverflow.com/q/22783818
tags question: http://stackoverflow.com/q/22712655
tags question: http://stackoverflow.com/q/22695068
tags question: http://stackoverflow.com/q/22678671
tags question: http://stackoverflow.com/q/22795669
tags question: http://stackoverflow.com/q/22653912
tags question: http://stackoverflow.com/q/22698698
tags question: http://stackoverflow.com/q/22729956
tags question: http://stackoverflow.com/q/22736590
tags question: http://stackoverflow.com/q/22673666
tags question: http://stackoverflow.com/q/22715224
tags question: http://stackoverflow.com/q/22804373
tags question: http://stackoverflow.com/q/22650561
tags question: http://stackoverflow.com/q/22726896
tags question: http://stackoverflow.com/q/22746280
tags question: http://stackoverflow.com/q/22659873
tags question: http://stackoverflow.com/q/22703165
tags question: http://stackoverflow.com/q/22663046
tags question: http://stackoverflow.com/q/22723413
tags question: http://stackoverflow.com/q/22679526
tags question: http://stackoverflow.com/q/22676020
tags question: http://stackoverflow.com/q/22807601
tags question: http://stackoverflow.com/q/22694410
tags question: http://stackoverflow.com/q/22752240
tags question: http://stackoverflow.com/q/22731462
tags question: http://stackoverflow.com/q/22667318
tags question: http://stackoverflow.com/q/22699784
tags question: http://stackoverflow.com/q/22685926
tags question: http://stackoverflow.com/q/22796137
tags question: http://stackoverflow.com/q/22664334
tags question: http://stackoverflow.com/q/22695978
tags question: http://stackoverflow.com/q/22785202
tags question: http://stackoverflow.com/q/22762395
tags question: http://stackoverflow.com/q/22783903
tags question: http://stackoverflow.com/q/22740243
tags question: http://stackoverflow.com/q/22788934
tags question: http://stackoverflow.com/q/22807407
tags question: http://stackoverflow.com/q/22795036
tags question: http://stackoverflow.com/q/22724797
tags question: http://stackoverflow.com/q/22681192
tags question: http://stackoverflow.com/q/22750372
tags question: http://stackoverflow.com/q/22648799
tags question: http://stackoverflow.com/q/22788387
tags question: http://stackoverflow.com/q/22656891
tags question: http://stackoverflow.com/q/22726565
tags question: http://stackoverflow.com/q/22801764
tags question: http://stackoverflow.com/q/22786282
tags question: http://stackoverflow.com/q/22740501
tags question: http://stackoverflow.com/q/22788477
tags question: http://stackoverflow.com/q/22778450
tags question: http://stackoverflow.com/q/22733881
tags question: http://stackoverflow.com/q/22764870
tags question: http://stackoverflow.com/q/22744937
tags question: http://stackoverflow.com/q/22747023
tags question: http://stackoverflow.com/q/22674859
tags question: http://stackoverflow.com/q/22742612
tags question: http://stackoverflow.com/q/22698013
tags question: http://stackoverflow.com/q/22716428
tags question: http://stackoverflow.com/q/22741215
tags question: http://stackoverflow.com/q/22702302
tags question: http://stackoverflow.com/q/22759134
tags question: http://stackoverflow.com/q/22757505

http://stackoverflow.com/comment/34780290
type: AnswerComment
score: 0
type: Comment
has text: you should have two java files one to declare yout pojo1 class in a file named pojo1.java, and the other for SimpleURL in in a file named SimpleURL.java
comment on: http://stackoverflow.com/a/22762001

http://stackoverflow.com/a/23197731
has comment: http://stackoverflow.com/comment/95232240
has body: I will go ahead and post an answer based on my final solution and a sort of summary of the very long comment chain. To start, the whole conversion chain of: Date --&gt; Instant --&gt; LocalDateTime --&gt; Do stuff --&gt; Instant --&gt; Date Is necessary to preserve the time zone information and still do operations on a Date like object that is aware of a Calendar and all of the context therein. Otherwise we run the risk of implicitly converting to the local time zone, and if we try to put it into a human readable date format, the times may have changed because of this. For example, the toLocalDateTime() method on the java.sql.Timestamp class implicitly converts to the default time zone. This was undesirable for my purposes, but is not necessarily bad behavior. It is important, however, to be aware of it. That is the issue with converting directly from a legacy java date object into a LocalDateTime object. Since legacy objects are generally assumed to be UTC, the conversion uses the local timezone offset. Now, lets say our program takes the input of 2014-04-16T13:00:00 and save to a database as a java.sql.Timestamp. //Parse string into local date. LocalDateTime has no timezone component LocalDateTime time = LocalDateTime.parse("2014-04-16T13:00:00"); //Convert to Instant with no time zone offset Instant instant = time.atZone(ZoneOffset.ofHours(0)).toInstant(); //Easy conversion from Instant to the java.sql.Timestamp object Timestamp timestamp = Timestamp.from(instant); Now we take a timestamp and add some number of days to it: Timestamp timestamp = ... //Convert to LocalDateTime. Use no offset for timezone LocalDateTime time = LocalDateTime.ofInstant(timestamp.toInstant(), ZoneOffset.ofHours(0)); //Add time. In this case, add one day. time = time.plus(1, ChronoUnit.DAYS); //Convert back to instant, again, no time zone offset. Instant output = time.atZone(ZoneOffset.ofHours(0)).toInstant(); Timestamp savedTimestamp = Timestamp.from(output); Now we just need to output …
has comment: http://stackoverflow.com/comment/65123150
accepted answer of: http://stackoverflow.com/q/22793315
answers question: http://stackoverflow.com/q/22793315
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/73454695
score: 30
upvote count: 30
type: Answer
has comment: http://stackoverflow.com/comment/36772701

http://stackoverflow.com/comment/34759353
comment on: http://stackoverflow.com/q/22791883
score: 0
type: Comment
has text: Nobody, who can help me?? hints, tutorials etc.?
type: QuestionComment

http://stackoverflow.com/q/22736473
score: 0
has comment: http://stackoverflow.com/comment/34653336
answer count: 1
tagged with: asynchronous
type: UnansweredQuestion
has body: The application I work with makes an async call to a third party web service end point and never receives a response. The async call passes a few parameters to the end point. The method that actually makes the async call preps the objects being passed as parameters and returns an error code if the objects are not valid. But the async call within the method itself does not return. Cannot post code here, but here is the pseudo code: public String makeAsyncCall(Object obj1, Object obj2, Object obj3) { if(isValid(obj1)) //call to external util method to checks if fields are notnull or notempty { getValueFromObj1(obj1) //call to private method to get a value and process the value } else { return errorcode; } ..... //other objects are validated makeAsyncCall(Object obj1, Object obj2, Object obj3); //returns void } How would I go about unit testing such a method?
tagged with: java
tagged with: web-services
has answer: http://stackoverflow.com/a/22736605
type: Question
has title: How to unit test an async call to a service end point

http://stackoverflow.com/comment/34779059
type: Comment
score: 1
has text: You can use [EL](http://docs.oracle.com/javaee/1.4/tutorial/doc/JSPIntro7.html) in jsp to avoid Scriptlet : `{generatedResponse}`
type: QuestionComment
comment on: http://stackoverflow.com/q/22806346

http://stackoverflow.com/a/22713619
downvote count: 1
has comment: http://stackoverflow.com/comment/34615512
score: 3
upvote count: 4
has body: If your string array is large, you want to use StringBuilder, because using the += string concatenation is inefficient due to Java String immutability. String[] str={"Hello","World!!!!","Java"}; StringBuilder sb = new StringBuilder(); for(String s : str) { sb.append(s); } System.out.println(sb.toString());
answers question: http://stackoverflow.com/q/22713493
has comment: http://stackoverflow.com/comment/34612197
type: Answer

http://stackoverflow.com/comment/37233684
has text: @TacoBurrito and Ramesh, how did you get to actually activate it? I activated it two days ago, and it now says `Applications should be in good standing and have billing enabled to use SSL.`. What does this even mean? I've had billing enabled on my appengine for 4 months, and I set up billing in Apps 32 hours ago (still in 30-day trial). Did you not get this message?
type: Comment
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/22733054

http://stackoverflow.com/comment/128419751
comment on: http://stackoverflow.com/a/57904796
type: Comment
has text: This is bad practice. It leads to nondeterministic behavior if there are 2 or more objects. Whole JDK's `findFirst` is bad idea.
type: AnswerComment
score: 2

http://stackoverflow.com/a/22701952
has body: For making a text field bigger, give it lots of columns and a big font. For making a button bigger, use a large font or a large icon. For either of those, we can add more space around the text or icon by calling setMargin(Insets). See also Should I avoid the use of set(Preferred|Maximum|Minimum)Size methods in Java Swing? (Yes.) General tip Java GUIs might have to work on a number of platforms, on different screen resolutions &amp; using different PLAFs. As such they are not conducive to exact placement or sizing of components. To organize the components for a robust GUI, instead use layout managers, or combinations of them1, along with layout padding &amp; borders for white space2.
downvote count: 0
upvote count: 2
type: Answer
answers question: http://stackoverflow.com/q/22698860
score: 2

http://stackoverflow.com/q/22777915
has answer: http://stackoverflow.com/a/22778104
has body: I'm playing with Java 8 and hit a basic scenario that illustrates a catch 22 where fixing one compile error causes another compile error. The scenario (which is just an example simplified from something more complex): public static List&lt;String&gt; catch22(List&lt;String&gt; input) { List&lt;String&gt; result = null; if (input != null) { result = new ArrayList&lt;&gt;(input.size()); input.forEach(e -&gt; result.add(e)); // compile error here } return result; } I get a compile error: Local variable result defined in an enclosing scope must be final or effectively final If I change the first line to: List&lt;String&gt; result; I get a compile error on the last line: The local variable result may not have been initialized It seems like the only approach here is to pre-initialize my result to an ArrayList, which I don't want to do, or not use lambda expressions. Am I missing any other solution?
has answer: http://stackoverflow.com/a/22778050
has answer: http://stackoverflow.com/a/22778310
answer count: 7
favorite count: 0
has answer: http://stackoverflow.com/a/41620996
tagged with: java-8
upvote count: 13
has answer: http://stackoverflow.com/a/26918881
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/22778104
has comment: http://stackoverflow.com/comment/34727869
has comment: http://stackoverflow.com/comment/34727965
tagged with: java
downvote count: 1
type: Question
has title: Java 8 catch 22 with lambda expressions and effectively final
has comment: http://stackoverflow.com/comment/34749933
has answer: http://stackoverflow.com/a/34973201
score: 12
has answer: http://stackoverflow.com/a/22778303
possible better answer: http://stackoverflow.com/a/22778050

http://stackoverflow.com/comment/34529869
type: Comment
type: AnswerComment
comment on: http://stackoverflow.com/a/22667555
has text: When I do this, I am getting 0 as a card number though. I think its something to do with my math.random() *
score: 0

http://stackoverflow.com/comment/34757810
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/22794276
has text: Okay, I tired that before I reinstalled Java and it had not worked. Gave it a shot and everything works fine! Put that in an answer and I will accept it. Thank you!
score: 0

http://stackoverflow.com/comment/34540440
type: AnswerComment
has text: @DocHoliday Or even better update your question and add code which would let us reproduce your problem. This way aliteralmind would be able to improve his post and make it actual answer.
score: 0
comment on: http://stackoverflow.com/a/22673410
type: Comment

http://stackoverflow.com/q/22719717
type: Question
has body: I am separating modules from my existing maven project. So created a core part and a module having all the mybaties interfaces and config files. So I created my main pom.xml as <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> 4.0.0 com.mycom app 1.0-SNAPSHOT <spring.version>3.2.0.RELEASE</spring.version> pom app org.apache.maven.plugins maven-compiler-plugin 2.3.2 1.7 1.7 core app-mybatis my core pom.xml is <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> 4.0.0 app com.mycom 1.0-SNAPSHOT com.mycom core 1.0-SNAPSHOT war core my app <spring.version>3.1.1.RELEASE</spring.version> org.springframework.security spring-security-web ${spring.version} org.springframework.security spring-security-config ${spring.version} org.springframework spring-context ${spring.version} org.springframework spring-web ${spring.version} org.springframework spring-webmvc ${spring.version} org.springframework spring-core ${spring.version} org.springframework spring-test ${spring.version} test org.springframework spring-support 2.0.8 javax.servlet servlet-api 2.5 javax.servlet.jsp jsp-api 2.1 provided junit junit 4.8.2 test org.codehaus.jackson jackson-core-asl 1.9.13 org.codehaus.jackson jackson-mapper-asl 1.9.13 rome rome 1.0 joda-time joda-time 2.1 joda-time joda-time-jsptags 1.1.1 mysql mysql-connector-java 5.1.24 log4j log4j 1.2.15 com.sun.jmx jmxri com.sun.jdmk jmxtools javax.jms jms org.apache.httpcomponents httpclient 4.0.1 commons-lang commons-lang 2.4 commons-configuration commons-configuration 1.6 commons-io commons-io 2.4 Codehaus http://repository.codehaus.org/ true true mycom.myproject.net org.apache.tomcat.maven tomcat7-maven-plugin 2.2 http://127.0.0.1:8080/manager/text To…
has title: converting maven project to multimodule
has answer: http://stackoverflow.com/a/22719774
upvote count: 3
answer count: 1
favorite count: 0
type: UnansweredQuestion
tagged with: maven
score: 3
downvote count: 0
tagged with: java

http://stackoverflow.com/a/22689402
has body: It means that the plug-in implementing your wizard could not be started. Have you tried using the Error Log or Console views to see why it couldn't be activated? 2 suggestions for you: First try these solutions. If not successful, try to reinstall your Eclipse from a newer build. That often solves the problem.
upvote count: 1
accepted answer of: http://stackoverflow.com/q/22687331
answers question: http://stackoverflow.com/q/22687331
has comment: http://stackoverflow.com/comment/34582310
type: Answer
downvote count: 0
score: 1
type: AcceptedAnswer

http://stackoverflow.com/a/51778632
type: Answer
answers question: http://stackoverflow.com/q/22742606
has body: Vector is a pre define class you can use it's method my creating it's object as follow, To add values in vector use object.add() methods, following are some methos: public class Vectorexapp { public static void main(String[] args) { Vector v=new Vector(); v.add(10); v.add(20); v.add("HELLO"); v.add(40.5); System.out.println("first element:"+v.firstElement()); System.out.println("last element:"+v.lastElement()); System.out.println("Values of vector:"+v); } }
score: 0

http://stackoverflow.com/q/22674575
type: Question
accepted answer: http://stackoverflow.com/a/22674770
has title: JTextPane Background Color
has answer: http://stackoverflow.com/a/22674770
has body: I am making a text-based game where the user inputs text to solve the game. I decided to use java swing to display the text, and I want to have the background of the textPane to be black. I have tried everything I have found (commented out), but non of it seems to work. private JTextPane blackJTextPane() { //JTextPane area = new JTextPane(); //area.setBackground(Color.BLACK); //area.setForeground(Color.WHITE); JEditorPane area = new JEditorPane(); Color bgColor = Color.BLACK; UIDefaults defaults = new UIDefaults(); defaults.put("EditorPane[Enabled].backgroundPainter", bgColor); area.putClientProperty("Nimbus.Overrides", defaults); area.putClientProperty("Nimbus.Overrides.InheritDefaults", true); area.setBackground(bgColor); return area; } public Everything(){ super("Game"); try { UIManager.setLookAndFeel("com.sun.java.swing.plaf.nimbus.NimbusLookAndFeel"); } catch (Exception exc) { // ignore error } setSize(600,500); setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); BorderLayout layout = new BorderLayout(); setLayout(layout); setVisible(true); text = new JLabel(""); text.setText("Text:"); texts = new JTextField(20); texts.setBackground(Color.white); texts.setText(""); JPanel panel = new JPanel(); panel.add(text ); panel.add(texts); texts.addActionListener(this); add(panel, BorderLayout.SOUTH); UIDefaults defs = UIManager.getDefaults(); defs.put("TextPane.background", new ColorUIResource(Color.BLACK)); defs.put("TextPane.inactiveBackground", new ColorUIResource(Color.BLACK)); area = blackJTextPane(); area.setEditable(false); style = area.addStyle("style", null); //StyleConstants.setBackground(style, Color.black); JScrollPane pane = new JScrollPane(area); add(pane, BorderLayout.CENTER); doc = area.getStyledDocument(); button.addActionListener(this); setVisible(true); } The imports are not pictured here but there are no errors in the game when I run it with any of those commented out parts.
answer count: 1
favorite count: 0
score: 8
type: AnsweredQuestion
downvote count: 0
tagged with: java
tagged with: jtextpane
tagged with: swing
upvote count: 8

http://stackoverflow.com/comment/34648584
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/22733807
has text: No, never put servlet-api.jar in lib folder. Your server will take care of it automatically, it will be in your server's lib directory.

keystroke
type: Tag
tags question: http://stackoverflow.com/q/22807892
tag name: keystroke

http://stackoverflow.com/a/22721647
score: 0
type: Answer
has body: I have created three variables as per your needs and have chosen random values. boolean a=true; boolean b=false; boolean c=true; boolean res1; boolean res2; boolean final_Res; res1=(a &amp;&amp; b) &amp;&amp;(!c) || (!a &amp;&amp; b &amp;&amp; !c); res2=(b &amp;&amp; !c); final_Res=res1==res2; System.out.println(final_Res); Hope this helps to solve your other problems..
answers question: http://stackoverflow.com/q/22721349

http://stackoverflow.com/q/22755100
tagged with: java
has comment: http://stackoverflow.com/comment/34690106
has title: Why SeekableByteChannel.read() always return -1 in linux?
has comment: http://stackoverflow.com/comment/34690865
type: Question
has comment: http://stackoverflow.com/comment/34690967
linked to: http://stackoverflow.com/q/22485267
score: 0
has comment: http://stackoverflow.com/comment/34688802
has comment: http://stackoverflow.com/comment/34686858
has comment: http://stackoverflow.com/comment/34723012
has comment: http://stackoverflow.com/comment/34688014
has comment: http://stackoverflow.com/comment/34688005
has comment: http://stackoverflow.com/comment/34687483
has body: In linux, I want to read the delta when some lines are added to the target file with SeekableByteChannel. Just like the following: 1, Run the code, 2, Add some line the target file, and then I discover that "seekableByteChannel.size() == size" be always true. import java.io.IOException; import java.nio.ByteBuffer; import java.nio.channels.SeekableByteChannel; import java.nio.charset.Charset; import java.nio.file.Files; import java.nio.file.Path; import java.nio.file.Paths; import java.util.EnumSet; import java.nio.file.StandardOpenOption; public class Test2 { public static void main( String[] args ) throws InterruptedException { Path path = Paths.get( "/root/desktop/file1" ); long size = path.toFile().length(); // read a file using SeekableByteChannel try (SeekableByteChannel seekableByteChannel = Files .newByteChannel( path, EnumSet.of( StandardOpenOption.READ ) )) { ByteBuffer buffer = ByteBuffer.allocate( 1 ); String encoding = System.getProperty( "file.encoding" ); buffer.clear(); seekableByteChannel.position(size); while(seekableByteChannel.size() == size) { Thread.sleep( 1000 ); } while ( seekableByteChannel.read( buffer ) &gt; 0 ) { buffer.flip(); System.out.print( Charset.forName( encoding ).decode( buffer ) ); buffer.clear(); } } catch ( IOException ex ) { System.err.println( ex ); } } } But windows does not have this problem My jdk version: 1.7.0._45 Because I install all the machine on VMFS5, after I change to install them on NFS, the problems go. Thanks for all your help.
has comment: http://stackoverflow.com/comment/34688143
tagged with: linux
has comment: http://stackoverflow.com/comment/34690134
has comment: http://stackoverflow.com/comment/34687370
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/34686900
has comment: http://stackoverflow.com/comment/34687180
has comment: http://stackoverflow.com/comment/34687224
answer count: 0
has comment: http://stackoverflow.com/comment/34688877

http://stackoverflow.com/q/22765459
favorite count: 0
tagged with: security
tagged with: jnlp
score: 1
has comment: http://stackoverflow.com/comment/34706269
has title: Java 7 webstart
has body: Legacy Java 5 application now throwing exceptions after moving to Java 7. I have this code in a Java class to return a URL. The URL can either be a filepath or the codebase for the application. An error is thrown when the URL is a filepath. What is going wrong here? It worked perfectly in Java 5.
upvote count: 1
has answer: http://stackoverflow.com/a/22777164
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/34706905
tagged with: java
type: Question
answer count: 1
tagged with: url
downvote count: 0
has comment: http://stackoverflow.com/comment/34705625
tagged with: java-web-start
accepted answer: http://stackoverflow.com/a/22777164

http://stackoverflow.com/q/22800319
has answer: http://stackoverflow.com/a/22800427
tagged with: runnable
has comment: http://stackoverflow.com/comment/34768488
has comment: http://stackoverflow.com/comment/34768519
tagged with: executorservice
has comment: http://stackoverflow.com/comment/34770239
has title: How to run two implementation classes in parallel using multithreading?
type: UnansweredQuestion
tagged with: multithreading
has comment: http://stackoverflow.com/comment/34770260
tagged with: java
type: Question
linked to: http://stackoverflow.com/q/22755151
has body: I am working on a project in which I have multiple interface and two Implementations classes which needs to implement these two interfaces. Suppose my first Interface is - public Interface interfaceA { public void abc() throws Exception; } And its implementation is - public class TestA implements interfaceA { // abc method } I am calling it like this - TestA testA = new TestA(); testA.abc(); Now my second interface is - public Interface interfaceB { public void xyz() throws Exception; } And its implementation is - public class TestB implements interfaceB { // xyz method } I am calling it like this - TestB testB = new TestB(); testB.xyz(); Problem Statement:- Now my question is - Is there any way, I can execute these two implementation classes in parallel? I don't want to run it in sequential. Meaning, I want to run TestA and TestB implementation in parallel? Is this possible to do? Initially I thought of using Callable but Callable requires return type but my interface methods are void so not sure how can I run these two in parallel.
tagged with: callable
answer count: 1
score: 0

http://stackoverflow.com/q/22761379
tagged with: cordova
type: UnansweredQuestion
tagged with: android
has body: I have an activity in cordova (see below) which was generated when I created the project. But now I need to create a java class that extends application and not CordovaActivity. This is what I got: package com.guessSound.guessSound; import android.os.Bundle; import org.apache.cordova.*; // import com.parse.*; // import com.parse.Parse; // import com.parse.ParseAnalytics; // import com.parse.ParseInstallation; // import com.parse.PushService; public class GuessThisSound extends CordovaActivity { @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); super.init(); // // Set by <content src="index.html" /> in config.xml super.setIntegerProperty("splashscreen", R.drawable.splash); super.loadUrl(Config.getStartUrl(),3000); //super.loadUrl("file:///android_asset/www/index.html") } } And I want to create a new class which is a application like below package com.guessSound.guessSound; import android.os.Bundle; import org.apache.cordova.*; // import com.parse.*; import com.parse.Parse; import com.parse.ParseAnalytics; import com.parse.ParseInstallation; import com.parse.PushService; public class MainApplication extends Application { private static MainApplication instance = new MainApplication(); public MainApplication() { instance = this; } public static Context getContext() { return instance; } @Override public void onCreate() { super.onCreate(); Parse.initialize(this, "xx", "xx"); PushService.setDefaultPushCallback(this, GuessThisSound.class); PushService.subscribe(this, "Broadcast", GuessThisSound.class); ParseInstallation.getCurrentInstallation().saveInBackground(); } } But when Im building the app, I receive the "cannot find symbol" for Application and Context. I have tried to import both Application and Context by writing import android.Context (the same for Application. So I figure that I need to use some sort of CordovaApplication since I extend the first class with CordovaActivity and not just Activity. My androidManifest lo…
has answer: http://stackoverflow.com/a/26367952
score: 2
has comment: http://stackoverflow.com/comment/34995274
has title: how to make a basic app class with cordova in Android
tagged with: java
type: Question
upvote count: 3
answer count: 1
downvote count: 1
favorite count: 0

http://stackoverflow.com/a/22659746
accepted answer of: http://stackoverflow.com/q/22659571
type: Answer
has comment: http://stackoverflow.com/comment/34520650
score: 2
upvote count: 2
has comment: http://stackoverflow.com/comment/34515430
type: AcceptedAnswer
downvote count: 0
answers question: http://stackoverflow.com/q/22659571
has comment: http://stackoverflow.com/comment/34535291
has comment: http://stackoverflow.com/comment/34520939
has body: It could be that it needs this: D:\jadretro&gt;jadretro.exe D:\myclasses\SomeClassName.class Try it, see if it helps. Try also: D:\jadretro&gt;jadretro.exe D:\myclasses\*.class UPDATE OK, I checked this tool myself. See what the documentation says: JadRetro is a command-line utility that could help You to successfully decompile Java classes created by the modern Java compilers (of Java 1.4, Java 1.5 or later). JadRetro operates by transforming the specified Java class files (if needed) into ones which could be processed correctly by an old Java decompiler (designed to work with classes of Java 1.3 or earlier). JadRetro is not a decompiler itself, it is a class transformer helping some old (but good) Java decompilers to convert more class files and/or generate more correct source code. Then I ran it on my machine on some .class files which I have. c:\Programs\eclipse-jee-kepler-R-win32-x86_64\workspace\TEST\bin&gt;cd \programs\jadretro c:\Programs\jadretro&gt;jadretro.exe c:\Programs\eclipse-jee-kepler-R-win32-x86_64\workspace\TEST\bin\*.class Class transformed: BookType Class transformed: Dummy Class transformed: Helloworld$1$HelloComponent Class transformed: Helloworld Class transformed: Test Class transformed: Test31 Done. Then I went into my bin folder and checked these class files, they have all been modified a few secounds ago (apparently by the jadretro tool which I ran). So this tool is not decompiling the classes, it is just transforming them to some old Java bytecode format. I hope this helps.

http://stackoverflow.com/a/22746485
score: 0
type: Answer
has body: If you have an ID and wants the associated entity, the use Session.get(). It's efficient, and makes use of the first-level cache to avoid reexecuting the query again and again. If you need to get entities via other criteria (like all the users with a given first name, for example), then use JPQL queries. They are simple to write, very readable, and have less limitations than criteria queries. If you need to take various optional criteria (like for a complex search form), the criteria API is the tool for the job. But it can't do everything a JPQL query does. There are other APIs available, and you can relatively easily write an API that generates dynamic JPQL queries if needed. If you have a really complex query that can't be expressed using JPQL, then use SQL. To write things to the database, queries should generally not be used, except in very specific circumstances where many entities must be modified the same way. Instead, get the entities to modify, and modify them. Hibernate will save their new state automatically.
answers question: http://stackoverflow.com/q/22746405
has comment: http://stackoverflow.com/comment/34822638
has comment: http://stackoverflow.com/comment/34678015
has comment: http://stackoverflow.com/comment/34823124

http://stackoverflow.com/q/22745710
downvote count: 0
answer count: 1
favorite count: 0
has title: How to import an external JAR file in Android eclipse
type: UnansweredQuestion
has body: I want to import external JAR file in my android project, to test this i have only created my own jar file, after that i have done following steps. 1)Right-click on my project 2)Build Path &gt; Add External JAR's &gt; Select your archive (.jar) The library.jar added to the 'Referenced Libraries' in my project, but after that still i am unable to use classes of my library. So i am not getting how to do this?
tagged with: android
linked to: http://stackoverflow.com/q/29149822
score: 1
has answer: http://stackoverflow.com/a/22745739
tagged with: java
upvote count: 1
tagged with: eclipse
type: Question
tagged with: jar

http://stackoverflow.com/q/22790097
tagged with: chat
upvote count: 0
answer count: 1
has comment: http://stackoverflow.com/comment/34757415
score: -7
favorite count: 0
has body: Can anayone give me a code to close the jframe or chat program when a client inputs 'bye'?
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/34749517
tagged with: java
tagged with: swing
downvote count: 7
type: Question
has title: Close chat program or jframe when client writes 'bye'?
has answer: http://stackoverflow.com/a/22790130

http://stackoverflow.com/a/22691510
score: 3
upvote count: 3
answers question: http://stackoverflow.com/q/22688866
has body: The merged regions are stored inside an ArrayList in the MergedCellsTable class. Therefore, they are stored in the same order as you add the regions to the Sheet. public static void main(String[] args) { HSSFWorkbook workbook = new HSSFWorkbook(); Sheet sheet = workbook.createSheet("Dump"); sheet.addMergedRegion(new CellRangeAddress(0,1,2,3)); sheet.addMergedRegion(new CellRangeAddress(0,0,0,0)); sheet.addMergedRegion(new CellRangeAddress(0,1,2,2)); sheet.addMergedRegion(new CellRangeAddress(3,3,3,3)); //Output System.out.println("num merged reagons: "+ sheet.getNumMergedRegions()); for(int i = 0; i &lt; sheet.getNumMergedRegions(); i++) { CellRangeAddress merge = sheet.getMergedRegion(i); System.out.println("Number:" + i+ " " + merge.getFirstRow() + " " + merge.getLastRow()+ " " + merge.getFirstColumn() + " " + merge.getLastColumn()); } } leads to Num merged Regions: 4 Number:0 0 1 2 3 Number:1 0 0 0 0 Number:2 0 1 2 2 Number:3 3 3 3 3 which is analog to the order in which I added the four regions to the sheet.
type: Answer
downvote count: 0

http://stackoverflow.com/a/22803674
has comment: http://stackoverflow.com/comment/34775925
accepted answer of: http://stackoverflow.com/q/22803175
upvote count: 1
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/34776873
downvote count: 0
answers question: http://stackoverflow.com/q/22803175
has comment: http://stackoverflow.com/comment/34776134
has comment: http://stackoverflow.com/comment/34776649
type: Answer
has body: You have two problems here: As it is declared now in IProducerConsumer&lt;T extends Number,ICommand&gt;, ICommand is not referencing your ICommand interface, but is instead just another generic type parameter declaration like T. Therefore you get the warning, that this generic type parameter is hiding your ICommand interface. You must declare your IProducerConsumer like so: public interface IProducerConsumer&lt;N extends Number, C extends ICommand&gt; You get a Bound mismatch for T, because T does not necessarily extend Number, as required by the IProducerConsumer interface. To fix this, you must declare your SimpleProducerConsumer like so: public class SimpleProducerConsumer&lt;N extends Number, C extends ICommand&gt; implements Runnable, IProducerConsumer&lt;N,C&gt;
score: 1
has comment: http://stackoverflow.com/comment/34775775

http://stackoverflow.com/comment/34706498
type: AnswerComment
comment on: http://stackoverflow.com/a/22763803
type: Comment
has text: Thanks for your quick answer! Something i forgot to say: the JSON comes as string from a database and its size can vary. I tell you this because your answer is for a fixed-size json. Thanks again!
score: 0

http://stackoverflow.com/comment/34547325
has text: Remove the try/catch approach and I'll remove my downvote. You should not use Exceptions in this scenario.
score: 0
type: Comment
comment on: http://stackoverflow.com/a/22677649
type: AnswerComment

http://stackoverflow.com/q/22735285
type: UnansweredQuestion
has body: I must preserve a ResultSet which was opened within a @Transactional Controller, to be consumed within a MessageConverter. To that end I have configured the following: MVC Interceptor: <mvc:interceptors> </mvc:interceptors> on the SessionFactory bean: <bean id="sessionFactory" class="org.springframework.orm.hibernate4.LocalSessionFactoryBean" on_close .... within the Controller method: session.doWork((con) -> { con.setHoldability(HOLD_CURSORS_OVER_COMMIT); }); Yet the PSQLException: This ResultSet is closed. persists. This is a relevant snippet in the log when the transaction commits upon controller method return: TRACE o.h.e.j.i.JdbcCoordinatorImpl - Registering result set [org.apache.tomcat.dbcp.dbcp2.DelegatingResultSet@5a63c2aa] DEBUG o.h.e.t.s.AbstractTransactionImpl - committing TRACE o.h.internal.SessionImpl - Automatically flushing session TRACE o.h.internal.SessionImpl - before transaction completion DEBUG o.h.e.t.i.j.JdbcTransaction - committed JDBC Connection DEBUG o.h.e.t.i.j.JdbcTransaction - re-enabling autocommit TRACE o.h.e.t.i.TransactionCoordinatorImpl - after transaction completion TRACE o.h.internal.SessionImpl - after transaction completion TRACE o.h.internal.SessionImpl - Setting flush mode to: MANUAL DEBUG o.h.internal.SessionImpl - Disconnecting session TRACE o.h.e.j.i.JdbcCoordinatorImpl - Releasing JDBC container resources [org.hibernate.engine.jdbc.internal.JdbcCoordinatorImpl@97bfa5f] TRACE o.h.e.j.i.JdbcCoordinatorImpl - Closing result set [org.apache.tomcat.dbcp.dbcp2.DelegatingResultSet@5a63c2aa] TRACE o.h.e.j.i.JdbcCoordinatorImpl - Closing prepared statement [select...] DEBUG o.h.e.j.i.LogicalConnectionImpl - Releasing JDBC connection DEBUG o.h.e.j.i.LogicalConnectionImpl - Released JDBC connection DEBUG o.h.e.j.s.SqlExceptionHelper - could not advance using next() [n/a] org.postgresql.util.PSQLException: This ResultSet is closed. Is there something more I can do to stop this from happening?
tagged with: spring
tagged with: spring-mvc
tagged with: hibernate-4.x
tagged with: java
tagged with: hibernate
type: Question
has comment: http://stackoverflow.com/comment/34651398
has title: Prevent closing ResultSet on transaction commit
score: 0
has answer: http://stackoverflow.com/a/22735850
answer count: 1
has comment: http://stackoverflow.com/comment/34651446

http://stackoverflow.com/q/22782671
tagged with: junit
answer count: 1
has body: I would like to test a singleton actor using java in Scala IDE build of Eclipse SDK (Build id: 3.0.2-vfinal-20131028-1923-Typesafe) and Akka is 2.3.1. public class WorkerTest { static ActorSystem system; @BeforeClass public static void setup() { system = ActorSystem.create("ClusterSystem"); } @AfterClass public static void teardown() { JavaTestKit.shutdownActorSystem(system); system = null; } @Test public void testWorkers() throws Exception { new JavaTestKit(system) {{ system.actorOf(ClusterSingletonManager.defaultProps( Props.create(ClassSingleton.class), "class", PoisonPill.getInstance(),"backend"), "classsingleton"); ActorRef selection = system.actorOf(ClusterSingletonProxy.defaultProps("user/classsingleton/class", "backend"), "proxy"); System.out.println(selection); }}; } } the ClassSingleton.java: public class ClassSingleton extends UntypedActor { LoggingAdapter log = Logging.getLogger(getContext().system(), this); public ClassSingleton() { System.out.println("Constructor is done"); } public static Props props() { return Props.create(ClassOperator.class); } @Override public void preStart() throws Exception { ActorRef selection = getSelf(); System.out.println("ClassSingleton ActorRef... " + selection); } @Override public void onReceive(Object message) { } @Override public void postStop() throws Exception { System.out.println("postStop ... "); } } The ClassSingleton actor is doing nothing, the printout is: Actor[akka://ClusterSystem/user/proxy#-893814405] only, which is printed from the ClusterSingletonProxy. No exception and Junit is done, green flag. In debugging ClassSingleton is not called (including contructor and preStart()). Sure it is me, but what is the mistake? Even more confusing that the same ClassSingleton ClusterSingletonManager code is working fine outside of javatestkit and junit. I suspect that the cluster setup might be reponsible, so I tried to include and exclude the following code (no effect). However I would like to understand why we need it…
favorite count: 0
downvote count: 0
has title: Junit testing an Akka singleton actor: preStart() hook not called
type: Question
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/22783755
accepted answer: http://stackoverflow.com/a/22783755
score: 1
tagged with: java
tagged with: eclipse
tagged with: akka
upvote count: 1

http://stackoverflow.com/comment/34693105
score: 0
type: Comment
type: QuestionComment
has text: Ya Good . . so while using a broad size of project with hundreds of objects, we can simply use that from that xml configuration files na ? if it is means i accept this reason. . Good :)
comment on: http://stackoverflow.com/q/22758321

http://stackoverflow.com/comment/34585256
score: 0
has text: I just edited my OP with the CharSearch() algorithm. Yeah, there is probably a million things wrong with this programming. A lot of it is self learning, as the book i received for my class as well as the lecture itself isn't the most helpful when it comes to actually writing the code... so I have to learn most of it for myself. and I changed the allocation in my original program.
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/22698282

http://stackoverflow.com/q/22700216
tagged with: jtextfield
linked to: http://stackoverflow.com/q/20578568
has comment: http://stackoverflow.com/comment/34588314
has title: Making a JTextField background transparent
has comment: http://stackoverflow.com/comment/34588262
tagged with: java
has answer: http://stackoverflow.com/a/22700611
type: AnsweredQuestion
downvote count: 0
has body: I'm trying to make the background for a JTextField transparent, that way so the JLabel underneath it is still visible, but whenever entering text into the JTextField you can see the text. Here's what I have now basically. The JTextField background is set to black in the below picture. In theory, if the JTextField's background was transparent it should look like this. So, my question is how would I make the JTextField's background transparent?
score: 6
accepted answer: http://stackoverflow.com/a/22700611
favorite count: 0
has comment: http://stackoverflow.com/comment/34589293
type: Question
has comment: http://stackoverflow.com/comment/34589314
has comment: http://stackoverflow.com/comment/34588283
possible better answer: http://stackoverflow.com/a/30829598
upvote count: 6
has comment: http://stackoverflow.com/comment/34588355
has answer: http://stackoverflow.com/a/67057163
has answer: http://stackoverflow.com/a/30829598
answer count: 3
tagged with: swing

http://stackoverflow.com/comment/34726582
score: 0
comment on: http://stackoverflow.com/a/22777104
type: AnswerComment
type: Comment
has text: So you are _not_ seeing the same problem as OP? And therefore your answer is dealing with something entirely different.

http://stackoverflow.com/a/22729705
has comment: http://stackoverflow.com/comment/34643771
has comment: http://stackoverflow.com/comment/34641477
has comment: http://stackoverflow.com/comment/34644006
upvote count: 2
has comment: http://stackoverflow.com/comment/34643938
has comment: http://stackoverflow.com/comment/34643869
type: Answer
has comment: http://stackoverflow.com/comment/34641393
score: 2
has comment: http://stackoverflow.com/comment/34641443
accepted answer of: http://stackoverflow.com/q/22729678
type: AcceptedAnswer
has body: Java allow one public class per file, and the public class name should be the same with the file name. For you , you should make the filename Appletprac.java You can see this link Why are filenames in Java the same as the class name? Write a html file like this: test.html &lt;html&gt; &lt;applet code = Appletprac.class width = 200 height = 100&gt; &lt;/applet&gt; &lt;/html&gt; Put the compiled .class file in the same folder, and input appletviewer test.html in the cmd.
downvote count: 0
has comment: http://stackoverflow.com/comment/34643929
has comment: http://stackoverflow.com/comment/34641533
answers question: http://stackoverflow.com/q/22729678

http://stackoverflow.com/q/22796884
has answer: http://stackoverflow.com/a/22796985
tagged with: java
type: Question
has answer: http://stackoverflow.com/a/22796956
has body: The program below exits the while-loop prematurely. If i take out the || leaving only one option to get out of the loop then it works fine. However, I but I don't want this; I want there to be multiple conditions to get out of the loop, not just one. public class password { public static void main (String args[]) { new password (); } public password () { String guess = ""; //while they haven't got the password yet while (!guess.equals ("Rain") || !guess.equals ("rain")) { guess = IBIO.inputString ("Enter the password: "); if (!guess.equals ("Rain") || !guess.equals ("rain")) { System.out.println ("Sorry please try again."); } } //if they are out of the loop, they got the password System.out.println ("Correct, please continue"); } }
score: 0
answer count: 3
has comment: http://stackoverflow.com/comment/34762326
has answer: http://stackoverflow.com/a/22796920
has title: Multi-part loop-condition satisfied when it shouldn't be
type: UnansweredQuestion

http://stackoverflow.com/comment/34750704
comment on: http://stackoverflow.com/a/22790551
score: 0
type: AnswerComment
has text: I'll put in my best detail:
type: Comment

http://stackoverflow.com/q/22664086
has answer: http://stackoverflow.com/a/22664189
type: AnsweredQuestion
has title: MongoDB update creates array inside array
tagged with: java
type: Question
tagged with: mongodb
has body: I have been sitting with this problem for hours and was unable to find solution, so I decided to ask for your help. What is wrong in my query? The problem is it creates array inside array, though my desired result would be simple array. BasicDBList list = new BasicDBList(); for (Paths pair : objects) { list.add(new BasicDBObject("path", pair.getPath()) .append("thumbnailPath, pair.getThumbnailPath())); } BasicDBObject updateCommand = new BasicDBObject(); updateCommand.append( "$push", new BasicDBObject( "imageContent", list ) ); WriteResult result = viewsCollection.update( new BasicDBObject(MongoFieldNames.ID, groupId), updateCommand, true, true ); And the result of pushed array is "imageContent" : [ [ { "path" : "sadL.png", "thumbnailPath" : sad.png" }, { "path" : "someImgL.png", "thumbnailPath" : "someimg.png" } ] ]
possible better answer: http://stackoverflow.com/a/22664424
score: 0
answer count: 2
accepted answer: http://stackoverflow.com/a/22664189
has answer: http://stackoverflow.com/a/22664424

http://stackoverflow.com/q/22745054
answer count: 3
downvote count: 0
tagged with: scheduled-tasks
favorite count: 0
has body: I'm trying to create a Scheduled task with Spring, but I'm probably not doing something correctly exposing the @Bean in configuration. My code is as follows: @Configuration @PropertySource("classpath:hibernate.properties") @EnableJpaRepositories("org.app.repository") @ComponentScan("org.app") @EnableTransactionManagement @EnableScheduling public class JpaConfiguration { private static final String PROPERTY_NAME_DATABASE_DRIVER = "db.driver"; private static final String PROPERTY_NAME_DATABASE_PASSWORD = "db.password"; private static final String PROPERTY_NAME_DATABASE_URL = "db.url"; private static final String PROPERTY_NAME_DATABASE_USERNAME = "db.username"; private static final String PROPERTY_NAME_HIBERNATE_DIALECT = "hibernate.dialect"; private static final String PROPERTY_NAME_HIBERNATE_SHOW_SQL = "hibernate.show_sql"; private static final String PROPERTY_NAME_ENTITYMANAGER_PACKAGES_TO_SCAN = "entitymanager.packages.to.scan"; @Resource private Environment env; @Bean public DataSource dataSource() { DriverManagerDataSource dataSource = new DriverManagerDataSource(); dataSource.setDriverClassName( env.getRequiredProperty(PROPERTY_NAME_DATABASE_DRIVER)); dataSource.setUrl(env.getRequiredProperty(PROPERTY_NAME_DATABASE_URL)); dataSource.setUsername(env.getRequiredProperty(PROPERTY_NAME_DATABASE_USERNAME)); dataSource.setPassword(env.getRequiredProperty(PROPERTY_NAME_DATABASE_PASSWORD)); return dataSource; } @Bean public LocalContainerEntityManagerFactoryBean entityManagerFactory() { // will set the provider to 'org.hibernate.ejb.HibernatePersistence' HibernateJpaVendorAdapter vendorAdapter = new HibernateJpaVendorAdapter(); // will set hibernate.show_sql to 'true' vendorAdapter.setShowSql(true); // if set to true, will set hibernate.hbm2ddl.auto to 'update' vendorAdapter.setGenerateDdl(true); LocalContainerEntityManagerFactoryBean emfBean = new LocalContainerEntityManagerFactoryBean(); emfBean.setDataSource(dataSource()); emfBean.setJpaVendorAdapter(vendorAdapter); …
tagged with: spring
has answer: http://stackoverflow.com/a/22746492
score: 2
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/22745135
has comment: http://stackoverflow.com/comment/34669297
upvote count: 2
tagged with: java
type: Question
has answer: http://stackoverflow.com/a/22944090
accepted answer: http://stackoverflow.com/a/22944090
possible better answer: http://stackoverflow.com/a/22746492
has title: Spring Scheduled Task

http://stackoverflow.com/comment/34646561
score: 0
type: Comment
type: QuestionComment
has text: It looks like a Kryo question. Here is the [Kryo project](https://github.com/EsotericSoftware/kryo) page.
comment on: http://stackoverflow.com/q/22732121

http://stackoverflow.com/a/22774991
accepted answer of: http://stackoverflow.com/q/22774980
type: Answer
type: AcceptedAnswer
has body: You can't. You'll have to parse it, extract the status line, headers, and body and use the appropriate methods to set them in the HttpServletResponse.
score: 0
answers question: http://stackoverflow.com/q/22774980

http://stackoverflow.com/a/22735245
type: AcceptedAnswer
downvote count: 0
answers question: http://stackoverflow.com/q/22734204
upvote count: 2
type: Answer
score: 2
accepted answer of: http://stackoverflow.com/q/22734204
has body: I know it's very badly coded, and I will try to fix it as much as I can, ... Next time, consider first cleaning up the mess and then asking the question. (Are the variables storing the values returned by getMouseX() and getMouseY() really static?) However, the main reason for the actual problem are the x and y values in the Bullet class: class Bullet { private double dx, dy; private int x, y; .... public void update() { x += dx; y += dy; System.out.println("dx : " + dx + " " + dy); } ... } They are declared as int values. Imagine what happens in the update method, for example, when x=0 and dx = 0.75: It will compute 0+0.75 = 0.75, truncate this to be an int value, and the result will be 0. Thus, the x and y values will never change, unless the dx and dy values are &gt;= 1.0, respectively. Just changing the type of x and y to double will solve this. You'll have to add casts in the render method accordingly: g.drawImage(image, (int)x, (int)y, ...); But you should really clean this up.

http://stackoverflow.com/a/22804588
has comment: http://stackoverflow.com/comment/34776127
has comment: http://stackoverflow.com/comment/34778880
score: 0
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/34779628
accepted answer of: http://stackoverflow.com/q/22803854
has body: Hope this will help you.. //select barge new Select(driver.findElement(By.id("ctl00_ContentPlaceHolder1_ddl_commodity"))).selectByVisibleText("Jo"); String sDate = "12/04/2014"; //What date you want driver.findElement(By.id("ctl00_ContentPlaceHolder1_txt_rate")).sendKeys(sDate); driver.findElement(By.id("ctl00_ContentPlaceHolder1_btn_show")).click(); Thread.sleep(3000); WebElement findElement = driver.findElement(By.id("ctl00_ContentPlaceHolder1_GridView1")); String htmlTableText = findElement.getText(); // do whatever you want now, This is raw table values. System.out.println(htmlTableText);
answers question: http://stackoverflow.com/q/22803854
has comment: http://stackoverflow.com/comment/34779111
has comment: http://stackoverflow.com/comment/34776520
has comment: http://stackoverflow.com/comment/34776112
type: Answer
has comment: http://stackoverflow.com/comment/34779810
has comment: http://stackoverflow.com/comment/34779767

http://stackoverflow.com/comment/34527385
has text: Java8 is ok, you don't need to care about the special chars.
type: Comment
comment on: http://stackoverflow.com/a/22666397
score: 0
type: AnswerComment

http://stackoverflow.com/comment/34765654
type: Comment
comment on: http://stackoverflow.com/a/22730940
has text: Thanks this has been very helpful! In my Callables, I'm fetching data from the database or web service, etc. Something can go wrong while doing this & my Callable will throw an ex. I've put a try/catch around .invokeAll() with a finally that calls executor.shutdownNow(). I have also checks for Thread.interrupted() from my Callable. I have ran failure test cases where 1)given time period expired 2)ex was thrown from Callable. Both of these were handled in catch. Others scenarios I should be concerned with? Could a callable be interrupted\killed without an ex being thrown & caught?
score: 0
type: AnswerComment

http://stackoverflow.com/a/22745626
score: 0
has body: You have to use layout_weight for particular child of your view group or use relativelayout may solve your problem and please post you layout XML.
type: Answer
answers question: http://stackoverflow.com/q/22745292

http://stackoverflow.com/q/22696171
has comment: http://stackoverflow.com/comment/39773479
answer count: 0
type: UnansweredQuestion
tagged with: class
tagged with: graphhopper
tagged with: web
favorite count: 0
has body: I'm getting start with a graphhopper sw, i've installed the maps but now i'm developing the sw in java code. GraphHopperAPI gh = new GraphHopperWeb(); gh.load("Address-of-maps"); And it required graphhopper classes but, where i can find these classes??
type: Question
upvote count: 1
score: 0
tagged with: java
has comment: http://stackoverflow.com/comment/34789417
downvote count: 1
has title: Getting started with graphhopper

http://stackoverflow.com/comment/74739766
type: Comment
comment on: http://stackoverflow.com/a/27954027
score: 22
type: AnswerComment
has text: This solution seems to work but does not give any explanation .

http://stackoverflow.com/comment/34750331
has text: @Doge Keep in mind that Wicket uses Java and the OP is asking how to write Java code to append JavaScript to the DOM using Wicket.
type: Comment
comment on: http://stackoverflow.com/q/22790515
type: QuestionComment
score: 2

http://stackoverflow.com/a/22737711
score: 5
type: AcceptedAnswer
downvote count: 0
accepted answer of: http://stackoverflow.com/q/22737685
type: Answer
has body: HashMap&lt;String, Integer&gt; map = new HashMap&lt;&gt;(); map.put("test", 1); I assume?
answers question: http://stackoverflow.com/q/22737685
upvote count: 5
has comment: http://stackoverflow.com/comment/34655681

adt
tags question: http://stackoverflow.com/q/22717939
tags question: http://stackoverflow.com/q/22672109
tags question: http://stackoverflow.com/q/22735041
tags question: http://stackoverflow.com/q/22760750
tag name: adt
tags question: http://stackoverflow.com/q/22761176
tags question: http://stackoverflow.com/q/22724111
tags question: http://stackoverflow.com/q/22704806
type: Tag
tags question: http://stackoverflow.com/q/22799842
tags question: http://stackoverflow.com/q/22761537

http://stackoverflow.com/q/22705534
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/34598000
has comment: http://stackoverflow.com/comment/34597755
tagged with: java
has title: Read url content into a String
has comment: http://stackoverflow.com/comment/34598189
has answer: http://stackoverflow.com/a/22706106
type: Question
linked to: http://stackoverflow.com/q/5867975
score: 0
answer count: 1
has comment: http://stackoverflow.com/comment/34598543
has comment: http://stackoverflow.com/comment/34597953
has body: I am reading the contents of buffered reader in the below method: public static String readBuffer(Reader reader, int limit) throws IOException { StringBuilder sb = new StringBuilder(); for (int i = 0; i &lt; limit; i++) { int c = reader.read(); if (c == -1) { return ((sb.length() &gt; 0) ? sb.toString() : null); } if (((char) c == '\n') || ((char) c == '\r')) { break; } sb.append((char) c); } return sb.toString(); } I am invoking this method later to test - URL url = new URL("http://www.oracle.com/"); BufferedReader in = new BufferedReader(new InputStreamReader(url.openStream())); StringBuffer sb = new StringBuffer(); String line=null; while((line=readBuffer(in, 2048))!=null) { sb.append(line); } System.out.println(sb.toString()); My question here is, I am returning the contents of bufferedreader into a string in my first method, and appending these String contents into a StringBuffer again in the second method, and reading out of it. Is this the right way? Any other way I can read the String contents that has contents from url?Please advise.

http://stackoverflow.com/a/22801960
downvote count: 0
answers question: http://stackoverflow.com/q/22801701
has body: public static Date StringDateToDate(String StrDate) { Date dateToReturn = null; SimpleDateFormat dateFormat = new SimpleDateFormat(DATEFORMAT); try { dateToReturn = (Date) dateFormat.parse(StrDate); } catch (ParseException e) { e.printStackTrace(); return null; } Calendar c = Calendar.getInstance(); c.setTime(dateToReturn); int minute = c.get(Calendar.MINUTE); minute = minute % 5; if (minute != 0) { int minuteToAdd = 5 - minute; c.add(Calendar.MINUTE, minuteToAdd); } return c.getTime(); }
type: Answer
upvote count: 3
score: 3

http://stackoverflow.com/a/22807762
answers question: http://stackoverflow.com/q/22807565
type: Answer
downvote count: 0
has comment: http://stackoverflow.com/comment/35225240
has comment: http://stackoverflow.com/comment/34781614
has comment: http://stackoverflow.com/comment/34781411
has body: Dear, use enctype="multipart/form-data" in your form tag like: form action="Request" method="Post" name="logout" enctype="multipart/form-data"
upvote count: 6
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/22807565
score: 6

http://stackoverflow.com/q/22753969
has body: I am working with a set of DTDs from a third party system. Our goal is to map the XML request (which conforms to those DTDs into java and then, send an XML response back to the system). DTDs are written in stone (I don't have any control in changing those). So, in order to map, I converted DTDs to XML Schemas (xsd) using XMLSpy and then, created Jaxb binding classes using XJC compiler. I am using Java 7. The problem is, the DTDs don't really have a namespace.. and I have 20 different DTDs.. 10 for request and 10 for response. When I generated the schemas, I had to do one-one mapping.. and created the same 10 request XSDs and 10 response XSDs. Now, the jaxb xjc compiler generated binding classes.. but they are far from practical use. There is no inheritance 'cus these schemas are not related to each other (although they seem to have similar content - request types and response types). Can someone please help me if there is a way to customize jaxb bindings to override the default bindings and create more reasonable bindings? For example consider this simple case: DTD: &lt;!ELEMENT FromDate (#PCDATA)&gt; &lt;!ATTLIST FromDate year CDATA #REQUIRED month CDATA #REQUIRED day CDATA #REQUIRED &gt; Schema that I generated using XMLSpy: &lt;xs:element name="FromDate"&gt; &lt;xs:complexType mixed="true"&gt; &lt;xs:attribute name="year" use="required"/&gt; &lt;xs:attribute name="month" use="required"/&gt; &lt;xs:attribute name="day" use="required"/&gt; &lt;/xs:complexType&gt; &lt;/xs:element&gt; The binding classes that generated out of XJC compiler (java 1.7): public class FromDate { @XmlValue protected String content; @XmlAttribute(name = "year", required = true) @XmlSchemaType(name = "anySimpleType") protected String year; @XmlAttribute(name = "month", required = true) @XmlSchemaType(name = "anySimpleType") protected String month; @XmlAttribute(name = "day", required = true) @XmlSchemaType(name = "anySimpleType") protected String day; ... ... If you look at how fromDate fina…
type: Question
has answer: http://stackoverflow.com/a/22755739
downvote count: 0
answer count: 1
favorite count: 0
type: UnansweredQuestion
tagged with: xsd
tagged with: http://stackoverflow.com/tag/xml
score: 2
linked to: http://stackoverflow.com/q/1510126
has title: how to customize and override jaxb bindings
upvote count: 2
tagged with: java
tagged with: jaxb

http://stackoverflow.com/comment/34653721
has text: @HovercraftFullOfEels I am calling super.repaint() and I am overriding paint(graphics g) in my clock classes
score: 0
comment on: http://stackoverflow.com/q/22736759
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/34598083
type: AnswerComment
type: Comment
has text: Add required jar in your classpath
score: 1
comment on: http://stackoverflow.com/a/22705623

http://stackoverflow.com/comment/34508250
comment on: http://stackoverflow.com/q/22649964
score: 0
type: Comment
type: QuestionComment
has text: @CraigRinger I´m using `postgresql-9.2-1002.jdbc3.jar`

http://stackoverflow.com/comment/34685019
has text: But i do need it to sleep right? invokeall would let me know if all threads are finished but after that i still need to use thread sleep. So is the above given approach still not right?
type: Comment
comment on: http://stackoverflow.com/a/22748844
type: AnswerComment
score: 0

event-handling
tag name: event-handling
tags question: http://stackoverflow.com/q/22762118
type: Tag

android-listview
tags question: http://stackoverflow.com/q/22649810
tags question: http://stackoverflow.com/q/22715082
tags question: http://stackoverflow.com/q/22677143
tags question: http://stackoverflow.com/q/22704551
tags question: http://stackoverflow.com/q/22732907
tags question: http://stackoverflow.com/q/22718038
tags question: http://stackoverflow.com/q/22674183
tags question: http://stackoverflow.com/q/22763328
tags question: http://stackoverflow.com/q/22706457
tags question: http://stackoverflow.com/q/22729795
tags question: http://stackoverflow.com/q/22746491
tags question: http://stackoverflow.com/q/22750177
tags question: http://stackoverflow.com/q/22717577
tags question: http://stackoverflow.com/q/22733449
tags question: http://stackoverflow.com/q/22782347
tag name: android-listview
tags question: http://stackoverflow.com/q/22758492
type: Tag
tags question: http://stackoverflow.com/q/22696776

http://stackoverflow.com/q/22661250
has answer: http://stackoverflow.com/a/22661372
has answer: http://stackoverflow.com/a/22661353
has answer: http://stackoverflow.com/a/22661288
score: -6
has comment: http://stackoverflow.com/comment/34517605
upvote count: 2
downvote count: 8
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/34517435
has body: this is my code, when I am trying this I am getting index out of bound exception. Please suggest while (rs.next()) { String url = rs.getString("rssUrl"); List&lt;String&gt; test = new ArrayList&lt;String&gt;(); test.add(url); //List&lt;List&lt;String&gt;&gt; output = new ArrayList&lt;List&lt;String&gt;&gt;(); for (int start = 0; start &lt; test.size(); start += 5) { List&lt;String&gt; group = test.subList(start, start+5); System.out.println(group); //System.out.println(output); System.out.println("split"); } }
has comment: http://stackoverflow.com/comment/34517439
has comment: http://stackoverflow.com/comment/34518206
has answer: http://stackoverflow.com/a/22661448
tagged with: java
has answer: http://stackoverflow.com/a/22661482
answer count: 6
has answer: http://stackoverflow.com/a/22662233
type: Question
has title: How to solve this index out of bound
favorite count: 0

http://stackoverflow.com/comment/34662684
type: QuestionComment
has text: how to you take the screenshot ? Using buil-in capabilities, i.e. with hardware volume keys ? on 4.0 and above screenshots will be put in gallery, try fetch if from there. If you take them with some other 3d party program - see the description of that soft it should mention where it saves screens
comment on: http://stackoverflow.com/q/22718047
score: 0
type: Comment

http://stackoverflow.com/comment/34545391
has text: Ah! So the cells array will be the same fir all 10 elements but they will each have their own x and y. Is that right?
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/22676096
score: 0

http://stackoverflow.com/comment/34633448
type: Comment
score: 0
comment on: http://stackoverflow.com/a/22724994
type: AnswerComment
has text: @user3192423 : This answer won't solve your problem - it's just another way of doing exactly what you're already doing.

http://stackoverflow.com/a/22749120
score: 1
has body: Do what it says and add all necessary jars on the classpath. Best to use a build-system like maven, gradle and declare the dependency: org.neo4j:neo4j:2.0.1 Then everything needed will be pulled in automatically.
answers question: http://stackoverflow.com/q/22745529
upvote count: 1
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/22745529
has comment: http://stackoverflow.com/comment/34726510
type: Answer
downvote count: 0

http://stackoverflow.com/comment/34767800
comment on: http://stackoverflow.com/a/22782043
score: 0
has text: Thanks, I've figured it out, mis-configuration, lib file must be include in solrconfig.xml insteads of copying to lib folder of solr instance.
type: AnswerComment
type: Comment

http://stackoverflow.com/q/22736938
score: 0
answer count: 1
type: UnansweredQuestion
has title: Saving variables that have been modified outside the class
tagged with: java
has body: I'm building a plugin for Bukkit with a number of different classes. The main class loads information from different config files into public variables in the main class. When a person runs a command in the game, the main class sends handling for the command over to a different class here called playerCommands which is initialized using the main class MineJobs. So handler = new playerCommands(this), basically. When playerCommands initializes, it pulls the public variables from MineJobs like so: public class playerCommands implements CommandExecutor{ private MineJobs Main; private Conf Config; private Lang Lang; private Map&lt;String, Player&gt; Players; private Map&lt;String, Job&gt; Jobs; private Map&lt;Location, SignC&gt; Signs; public playerCommands(MineJobs main) { Main = main; Config = main.Config; Lang = main.Lang; Players = main.Players; Jobs = main.Jobs; Signs = main.Signs; } My question is: When I modify one of the private variables in playerCommands, will that modify the public variables in MineJobs so that I can call a save function there and not need to pass the variables back? Or do I need to define the variables differently?
type: Question
has answer: http://stackoverflow.com/a/22737021
has comment: http://stackoverflow.com/comment/34654022
tagged with: class

http://stackoverflow.com/q/22714505
accepted answer: http://stackoverflow.com/a/22716721
has answer: http://stackoverflow.com/a/22716721
type: AnsweredQuestion
downvote count: 0
score: 1
tagged with: java
tagged with: eclipse
has title: How to get currently opened class in eclipse editor correctly?
type: Question
upvote count: 1
answer count: 1
tagged with: eclipse-plugin
favorite count: 0
has body: I have the following code, which actually works well: IJavaElement je = null; IWorkbenchPart part = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage().getActivePart(); if (part instanceof ContentOutline) part = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage().getActiveEditor(); if (part instanceof IViewPartInputProvider) { Object elem = ((IViewPartInputProvider)part).getViewPartInput(); if (elem instanceof IJavaElement) je = (IJavaElement)elem; } But I get a warning: Discouraged access: The type IViewPartInputProvider is not accessible due to restriction on required library C:\eclipse\plugins\org.eclipse.jdt.ui_3.9.1.v20130820-1427.jar Seems that this is a dirty way because of accessing internal API. Is there a better way to do this? update I found out that this code works fine too but doesn't produce any warnings: IJavaElement je = null; IWorkbenchPart part = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage().getActivePart(); if (part instanceof ContentOutline) part = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage().getActiveEditor(); je = JavaUI.getEditorInputJavaElement(((IEditorPart)part).getEditorInput()); Since I omitted some checks I'm worried that this code could cause runtime errors if somebody using my plugin has a different eclipse configuration. Any suggestion for improvements?

http://stackoverflow.com/comment/34686003
type: AnswerComment
comment on: http://stackoverflow.com/a/22754100
score: 0
type: Comment
has text: @ThorbjørnRavnAndersen bad wording; I really mean that if a dedicated package exists for this or that format (HTML, XML, CSV, etc etc) you are better off using a dedicated library than regexes. I mean, even perl has `HTML::Parser`

http://stackoverflow.com/comment/34637830
score: 1
type: Comment
type: QuestionComment
has text: Pls set clientMode to false: engineConfigurator.setClientMode(false);
comment on: http://stackoverflow.com/q/22724862

http://stackoverflow.com/a/22716796
has body: Try to add t.join() after t.start(). This will make main thread wait till thread 2 ends
type: Answer
upvote count: 2
score: 2
downvote count: 0
answers question: http://stackoverflow.com/q/22716685

http://stackoverflow.com/q/22717156
type: UnansweredQuestion
answer count: 0
downvote count: 0
score: 1
favorite count: 0
type: Question
tagged with: android
has title: How to Kill a Thread with TID on Android Platform
tagged with: multithreading
upvote count: 1
tagged with: java
has body: I use a third part library to do some heavy work asynchronously with a thread.If the user quit the that activity, I want to kill the thread that created by third library. I only get the TID from the library. Is there any method to kill a thread with his TID? I've found tkill system call on Linux. How can I invoke tkill from java code?

http://stackoverflow.com/comment/34670079
has text: Awesome! It finally worked! Thanks Andrei. Really appreciate that.
type: AnswerComment
comment on: http://stackoverflow.com/a/22703101
score: 0
type: Comment

first-level-cache
type: Tag
tag name: first-level-cache
tags question: http://stackoverflow.com/q/22731941

http://stackoverflow.com/q/22775311
score: 0
tagged with: keystore
type: UnansweredQuestion
has title: Moving a Java Keystore
tagged with: jks
tagged with: java
has body: I have a wildcard cert and a jks with my chain of trust. When I want to use the wild card on another host for SSL (another java web server), do I simply copy the jks to the other host and use? Or is the jks specific to a host and therefore should remain on the host it was created on...?
tagged with: ssl
type: Question
has answer: http://stackoverflow.com/a/22776987
answer count: 1
tagged with: ssl-certificate

http://stackoverflow.com/comment/34591116
score: 0
has text: Why not use Java's media player? http://stackoverflow.com/questions/6045384/playing-mp3-and-wav-in-java
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/22698658

http://stackoverflow.com/a/22733483
score: 1
upvote count: 1
has body: The constructors for both your Circle and Triangle classes just assign the Point they are given to a data member. In this way, you're storing a reference to the same object, and every time it's manipulated, it will effect all references to it. A safer way of handling such situations is, as you suggested, to copy the object passed to the constructor. E.g.: //Circle class public Circle(Point p) { this.p = new Point(p.getX(), p.getY()); } Alternatively, if you defined Point as clonable: //Circle class public Circle(Point p) { this.p = p.clone(); }
has comment: http://stackoverflow.com/comment/34648042
downvote count: 0
has comment: http://stackoverflow.com/comment/34648061
answers question: http://stackoverflow.com/q/22733404
type: Answer

http://stackoverflow.com/comment/34639238
comment on: http://stackoverflow.com/q/22728502
type: Comment
type: QuestionComment
has text: You can use JSONP in jquery ajax call
score: 1

http://stackoverflow.com/q/22803732
tagged with: struts2
has answer: http://stackoverflow.com/a/22806263
score: 3
upvote count: 3
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/34778182
type: Question
has title: Returning JSON Object from Struts2 Action Giving Empty Data
tagged with: java
tagged with: http://stackoverflow.com/tag/json
has body: In Action: //Declaration JSONObject jObj1 = null; public JSONObject getjObj1() { return jObj1; } public void setjObj1(JSONObject jObj1) { this.jObj1 = jObj1; } //In Action method String jsong="{\"cid\":232}"; jObj1 = new JSONObject(jsong); return Action.SUCCESS Struts Cfg File : jObj1 I am getting empty result when I see in JSP console Where I went wrong? Thanks.
has comment: http://stackoverflow.com/comment/34781695
downvote count: 0
answer count: 1
linked to: http://stackoverflow.com/q/17093862
favorite count: 0

http://stackoverflow.com/q/22770170
tagged with: java
linked to: http://stackoverflow.com/q/1979957
downvote count: 0
answer count: 1
tagged with: tomcat
has answer: http://stackoverflow.com/a/22791865
accepted answer: http://stackoverflow.com/a/22791865
favorite count: 0
has body: I am trying to use the GZipFilter servlet provided in the jetty-servlets lib. My web app runs on Tomcat rather than Jetty. I know that Jetty is another servlet engine, but I should be able to use individual components. I use maven to build my application. Whenever I include jetty-servlets in my pom, my web application refuses to start, failing at the declaration of GzipFilter in the web.xml. The error is as follows, Mar 31, 2014 3:03:32 PM org.apache.catalina.core.StandardContext filterStart SEVERE: Exception starting filter GzipFilter java.lang.NoClassDefFoundError: javax/servlet/AsyncListener at java.lang.Class.getDeclaredConstructors0(Native Method) at java.lang.Class.privateGetDeclaredConstructors(Class.java:2493) at java.lang.Class.getConstructor0(Class.java:2803) at java.lang.Class.newInstance(Class.java:345) at org.apache.catalina.core.ApplicationFilterConfig.getFilter(ApplicationFilterConfig.java:275) I knew that Jetty-Servlets has a dependency on servlets-api, so I excluded it from the dependency in maven. My snippet of pom.xml looks like, org.eclipse.jetty jetty-servlets 9.1.0.M0 javax.servlet javax.servlet-api My snippet of web.xml looks like, GzipFilter org.eclipse.jetty.servlets.GzipFilter mimeTypes text/html,text/plain,text/xml,application/xhtml+xml,text/css,application/javascript,image/svg+xml GzipFilter /*
has comment: http://stackoverflow.com/comment/34752341
has title: HOWTO use jetty-servlets' GZipFilter in Tomcat webapp
type: AnsweredQuestion
linked to: http://stackoverflow.com/q/2846673
tagged with: jetty
tagged with: maven
upvote count: 1
tagged with: servlet-filters
type: Question
linked to: http://stackoverflow.com/q/14406990
score: 1

http://stackoverflow.com/q/22776243
favorite count: 0
has title: Rename All Files In Folders Java
type: UnansweredQuestion
tagged with: file
upvote count: 1
has comment: http://stackoverflow.com/comment/34725360
has body: I have one folder which contains many sub-folders. To make it more clear here is an example of the folders: Movies: MovieTitle: Moviefile.mp4 (Movie File) MovieSubtitles.srt (Subtitles) MovieSeries: MovieTitle: Moviefile.mp4 MovieSubtitles.srt I need to rename each mp4 and srt file to the following "MovieTitle". If the movie is part of a series it should be named to Series "Title + Movie Title". Lets use Star Wars as an example for series and how to name. "Star Wars" would be the name of a directory in "Movies". In "Star Wars" are 6 Folders each with a mp4 and srt file in it. For episode 1 of star wars the mp4 and srt file should be renamed to: "Star Wars - Episode 1.mp4" and "Star Wars - Episode 1.srt". If Episode 1 was not part of series it should be named to just "Episode 1.mp4" Here is the code that I have come up with so far: public static void renaming(File[] files){ String dir1, dir2; for(File movie: files){ //Main folder containing all of the movies. dir1 = movie.getName(); for(File filesInMovie: movie.listFiles()){ if(filesInMovie.isDirectory()){ //This means that it is a series. dir2 = filesInMovie.getName(); for(File i: filesInMovie.listFiles()){ i.renameTo(dir1 + " - " + dir2); } }else{ filesInMovie.renameTo(dir1) } } } } I realize that renameTo is an actual function in Java. I thought it would rename files until I read what it actually does (which I am still a little fuzzy on). So my main question is how would I get this code to properly rename the files. Just some extra things you should know: One Directory Contains all of the movies. There are possibilities for each folder in the movies folder It has other folders in it (It is a series) It has a mp4 and srt file in it If you have any questions please ask!!!
score: 1
tagged with: java
has answer: http://stackoverflow.com/a/22776678
type: Question
answer count: 2
has answer: http://stackoverflow.com/a/22776675
downvote count: 0
has comment: http://stackoverflow.com/comment/34725196
has comment: http://stackoverflow.com/comment/34725244
has comment: http://stackoverflow.com/comment/34725402
has comment: http://stackoverflow.com/comment/34725382
tagged with: directory

http://stackoverflow.com/comment/34582422
type: QuestionComment
has text: You didn't call `start()`...
score: 4
comment on: http://stackoverflow.com/q/22697236
type: Comment

http://stackoverflow.com/a/22868842
score: 0
has body: The guidance offered here in troubleshooting the problem helped greatly - thank you to everyone. I tested contents of an exported JAR; I used diagnostic code suggested by Kishan to determine if my code could "see" the image. I believe it might have something to do with the way Eclipse works/refreshes if I move images around in the file system instead of the Eclipse import function. Finally, in order to get it to work, I made the following changes: I created a new project and two sub-packages - one for 'resources' and one for my code class. Then I right-clicked > import on the resources package in Eclipse to get the image. The only thing to change in my code is ....getResourceAsStream("/resources/strawberry.jpg");
type: AcceptedAnswer
type: Answer
accepted answer of: http://stackoverflow.com/q/22802016
answers question: http://stackoverflow.com/q/22802016

http://stackoverflow.com/q/22786931
downvote count: 0
answer count: 1
tagged with: applet
favorite count: 0
tagged with: windowlistener
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/34775272
linked to: http://stackoverflow.com/q/6255106
score: 2
tagged with: compiler-errors
tagged with: java
has body: i'm programming on frame and applet window but problem is that,the code not working. help me to solve this problem and also help me how to close frame window because with the help of window listener the frame window is not closing. import java.awt.*; import java.applet.*; import java.awt.event.*; /*&lt;applet code="fra1.class" height=500 width=600&gt;&lt;/applet&gt;*/ public class fra1 extends Applet implements WindowListener { String msg="This is applet window"; Frame f; public void init() { setLayout(null); f=new Frame(); f.setTitle("THE JAVA GAMER"); f.setSize(400,400); f.setVisible(true); f.add(new Label("This is frame window"),Label.LEFT); f.addWindowListener(this); } public void start() { f.setVisible(true); } public void stop() { f.setVisible(false); } public void windowClosing(WindowEvent e) { System.exit(0); } public void paint(Graphics g) { g.drawString(msg,100,100); } } and giving me this error again and again: fra1 is not abstract and does not override abstract method windowdDeactivated (java.awt.event.windowEvent) in java.awt.event.WindowListener public class fra1 extends Applet implements WindowListener
type: Question
has title: WindowListener does not work
has answer: http://stackoverflow.com/a/22787094
tagged with: event-listener
upvote count: 2

http://stackoverflow.com/q/22804628
upvote count: 4
tagged with: spring
type: AnsweredQuestion
has body: So I need to set the timeout parameter for @Transactional annotation. This property will come from a property file which I'm not able to do since I'm encountering "The value for annotation attribute Transactional.timeout must be a constant expression". Something like this @Value("${mytimeout}") private int myTimeout; @Transactional(timeout=myTimeout) public void myMethod(){ } The only time the timeout attribute can be set by a variable is when a variable is final. So, I was thinking if it is possible to set the timeout property programmatically while using the @Transaction annotation. Or any other way I can set this attribute Thanks!
downvote count: 0
tagged with: java
type: Question
accepted answer: http://stackoverflow.com/a/22805677
has title: How to set annotation property/attribute programmatically?
score: 4
has answer: http://stackoverflow.com/a/22805677
tagged with: transactional
answer count: 1
favorite count: 0
tagged with: spring-annotations

http://stackoverflow.com/a/22732487
score: 0
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/22708452
type: Answer
answers question: http://stackoverflow.com/q/22708452
has body: For future readers may have this problem: I've installed Sony PC Companion and now I can use my phone in order to test the application.

http://stackoverflow.com/q/22800047
answer count: 0
type: UnansweredQuestion
upvote count: 1
downvote count: 1
has comment: http://stackoverflow.com/comment/34768003
tagged with: java
type: Question
score: 0
tagged with: bufferedreader
tagged with: sorting
has comment: http://stackoverflow.com/comment/34768026
favorite count: 0
has comment: http://stackoverflow.com/comment/34767907
has body: I am trying to implement simple external sort and I want to read blocks of data at a time. Suppose I read data line by line, and if reading one line means 1 I/O it would defeat the purpose of external sort as there are now too many I/Os. I should be able to read blocks of data at a time. How would I achieve that ?
tagged with: external-sorting
has comment: http://stackoverflow.com/comment/34767949
has title: Is a buffered reader br.readLine() 1 input I/O?

http://stackoverflow.com/a/22771807
has comment: http://stackoverflow.com/comment/35856727
has comment: http://stackoverflow.com/comment/34728350
type: Answer
has comment: http://stackoverflow.com/comment/35805889
has comment: http://stackoverflow.com/comment/35813195
has comment: http://stackoverflow.com/comment/35728991
accepted answer of: http://stackoverflow.com/q/22767457
score: 1
answers question: http://stackoverflow.com/q/22767457
upvote count: 1
has comment: http://stackoverflow.com/comment/35856787
has comment: http://stackoverflow.com/comment/35859199
has comment: http://stackoverflow.com/comment/35730074
has comment: http://stackoverflow.com/comment/35727920
has comment: http://stackoverflow.com/comment/34724950
has comment: http://stackoverflow.com/comment/34725642
has body: The most significant issue is you're not calling super.paint, which is preventing what ever was previously painted to the Graphics context from been cleared or any child components from been painted. For painting the background, you should be using paintComponent, which is used to paint the background of the component. If you need to paint under the child components, but above the background, you should still use paintComponent, but paint the background first and then the next layer. The components will be painted after paintComponent. Painting over components is actually more complex Take a closer look at Custom Painting and Painting in Swing and AWT Updated based on code snippets In Screen which extends from Container, you are doing... @Override public void paint(Graphics g) { super.paint(g); GraphicsUtilities.drawPictureTiled(background, g); paintComponents(g); g.dispose(); } Don't call paintComponents, super.paint has already done this. Don't call dispose on a Graphics context you don't create Based on the rest of the example code I have, you should be extending from JPanel and overriding paintComponent instead. This will allow you to put under the component layer Because GroundPanel and ForeGroundPanel are both JPanels, there's no need to ever paint them yourself. In fact, you could simply use OverlayLayout or even a GridBagLayout and add them directly to the NestedScreen which is itself a container... So, I stripped down you example code so I could get it working with the missing code as an example. I got a little more fancy and simply made a JPanel to act as the pause screen This is all done by simply overlaying the components on top of each other using a GridBagLayout import java.awt.Color; import java.awt.Dimension; import java.awt.EventQueue; import java.awt.Font; import java.awt.Graphics; import java.awt.GridBagConstraints; import java.awt.GridBagLayout; import java.awt.event.MouseAdapter; import java.awt.event.MouseEvent; import java.awt.image.BufferedIm…
has comment: http://stackoverflow.com/comment/35856499
has comment: http://stackoverflow.com/comment/35813232
has comment: http://stackoverflow.com/comment/34729861
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/35815045
has comment: http://stackoverflow.com/comment/35796857

http://stackoverflow.com/comment/34537220
type: AnswerComment
score: 0
comment on: http://stackoverflow.com/a/22671728
type: Comment
has text: You're welcome. I thought you had to use `setContentPane`, but apparently `add` works as well. :)

http://stackoverflow.com/a/36319433
score: 0
type: Answer
has body: This is a Windows OS only Solution. Click on "attach source" Link In the window that opens, select "External location" In "Path" option click on "External File..." Button which should open Windows selection box that only accepts "*.jar" and ".zip" files. Navigate to a location where you have installed your java which is usually at a location for eg. C:\Program Files\Java\jdk1.8.0_74 Look For file name src.zip, select that folder and click ok. So The final location will be eg. C:\Program Files\Java\jdk1.8.0_74\src.zip This should attach the source files and you should be able to see the classes.
answers question: http://stackoverflow.com/q/22653933

http://stackoverflow.com/comment/34685858
type: Comment
has text: Make sure that you use the same java version and dependencies… Depending on which java version the `@ManagedBean` might or might not be available.
comment on: http://stackoverflow.com/q/22749965
score: 0
type: QuestionComment

http://stackoverflow.com/q/22751383
type: Question
answer count: 2
has answer: http://stackoverflow.com/a/22751456
downvote count: 0
favorite count: 0
tagged with: arraylist
linked to: http://stackoverflow.com/q/13636094
has title: Simplest way to search an arraylist's entries for a piece of text?
has comment: http://stackoverflow.com/comment/34680319
has comment: http://stackoverflow.com/comment/34680284
has comment: http://stackoverflow.com/comment/34680340
has body: I've got an arraylist with (let's say) three entries. The first entry: "Chris lives at 2320 alpha street" The second entry: "Bob sleeps at 1900 bravo road" The third entry: "Alex eats at 4231 charlie lane" I'm trying to search through the arraylist, parse each line for a term the user enters, and return (to another part of my code) the index of the arraylist entry that contains the search term. In this example, the user types in "lane", the code searches all three, finds that the third entry contains the word "lane", and then returns a 2. Currently, I'm using if(addressBook.contains(searchModifier))//if their searchModifier is found anywhere in any of the strings return addressBook.indexOf(searchModifier);//return that index value else return noEntry; but this only works if there's an exact string match. I need to be able to search for just part of a string. Is there a simple way to do this? I checked this question, but it seemed ridiculously complicated for what I'm trying to do - this is a 'hello world'-type program. I'm only searching through 3-4 entries at most! (not to mention the fact that I'm fairly new at this, and that code seemed awfully advanced...)
has comment: http://stackoverflow.com/comment/34680211
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/22751461
upvote count: 1
score: 1
tagged with: java
tagged with: search

http://stackoverflow.com/comment/34643938
has text: I am compiling from command prompt (javac) and running the applet from same command prompt using command (appletviewer Appletprac.java).
score: 0
comment on: http://stackoverflow.com/a/22729705
type: Comment
type: AnswerComment

http://stackoverflow.com/a/22655317
has comment: http://stackoverflow.com/comment/34513932
score: 0
has comment: http://stackoverflow.com/comment/34529424
has comment: http://stackoverflow.com/comment/34544391
upvote count: 1
downvote count: 1
has comment: http://stackoverflow.com/comment/34514029
answers question: http://stackoverflow.com/q/22655126
has comment: http://stackoverflow.com/comment/34507722
has body: First you need to take a look at the following memory parameters, it may not prevent the OutOfMemoryError, but you should learn about them: -Xmx2048m -&gt; this param to set the max memory that the JVM can allocate -Xms1024m -&gt; the init memory that JVM will allocate on the start up -XX:MaxPermSize=512M -&gt; this for the max Permanent Generation memory Also and you may want to check this parameters also, those parameters will speed up the GC activities on your Young space, so the collection will be better. -XX:MaxNewSize= -&gt; this need to be 40% from your Xmx value -XX:NewSize=614m -&gt; this need to be 40% from your Xmx value also you may tell you JVM what type of GC to use like (i think this type is already enabled in the newest JVM versions) : -XX:+UseConcMarkSweepGC Second When an OutOfMemoryError occured, the JVM will trigger the Stop World GC, so it will collect your object and the un referenced object, that why the heap size is less than you -Xmx value. Usually in this case, if you analyzed this heap using one of the analyzing tools, you will clearly find the big objects that filled your memory, that will led you to the code and it will be easy to fix it.
type: Answer
has comment: http://stackoverflow.com/comment/34507610
has comment: http://stackoverflow.com/comment/34516582
has comment: http://stackoverflow.com/comment/34554673
has comment: http://stackoverflow.com/comment/34516706
has comment: http://stackoverflow.com/comment/34516438

http://stackoverflow.com/q/22798955
accepted answer: http://stackoverflow.com/a/23705859
has body: We have a web application in tomcat 7, JDK 7, Amazon Linux. This is what we have for the GC configuration: -XX:+UseConcMarkSweepGC -XX:+CMSClassUnloadingEnabled" We do not have "PrintGCDetails" enabled. This is what is printed out in the gc.log file every few seconds (for 48 hours straight when the application at this time is under 0 load - absolutely no activity and even then the following gets printed out and the CPU taken by these threads is at 15%) (please see below for context): 940568.925: [GC 7425641K(8277888K), 0.2201750 secs] 940572.415: [GC 7425641K(8277888K), 0.1782950 secs] 940574.101: [GC 7425641K(8277888K), 0.1736550 secs] 940577.545: [GC 7425647K(8277888K), 0.1779190 secs] And we see that the following GC threads take up CPU (around 15% overall) even though: there is no activity in the system, no other threads are active except these and this continues for 48 hours and the system at this time was under 0 load. the system was under 0 load also for the previous 24 hours and then these threads became active when these threads were active and taking up CPU, the preceding lines were printed in the gc.log this continued for 2 days and when we finally put load by invoking the web application in this JVM for 5 minutes and then it all stopped. We noticed that these threads are no longer taking CPU (they are taking &lt;1 %) now. The problem seems to have resolved itself once a FULL GC happens. The FULL GC happened after the system was put under load. In short, the GC threads continued taking 15% CPU when the system was under 0 load for 48 hours. These are the threads: "Gang worker#0 (Parallel GC Threads)" prio=10 tid=0x00007fad9402e000 nid=0x629d runnable "Gang worker#1 (Parallel GC Threads)" prio=10 tid=0x00007fad94030000 nid=0x629e runnable "Gang worker#2 (Parallel GC Threads)" prio=10 tid=0x00007fad94031800 nid=0x629f runnable "Gang worker#3 (Parallel GC Threads)" prio=10 tid=0x00007fad94033800 nid=0x62a0 runnable "Gang worker#4 (Parallel GC Threads)" prio=1…
type: AnsweredQuestion
upvote count: 2
tagged with: garbage-collection
tagged with: tomcat7
type: Question
has title: Java CMS GC, GC threads taking CPU when system is idle
tagged with: java
has answer: http://stackoverflow.com/a/23705859
tagged with: concurrent-mark-sweep
score: 2
answer count: 1
downvote count: 0
tagged with: jvm
favorite count: 0

http://stackoverflow.com/a/30829598
answers question: http://stackoverflow.com/q/22700216
score: 1
upvote count: 1
has comment: http://stackoverflow.com/comment/118527497
has body: Change look and feel setting to metal or window It will work if u have set it transparent already Nimbus laf makes textareas backgroung visible as soon as the program runs
downvote count: 0
type: Answer

http://stackoverflow.com/comment/34767601
type: AnswerComment
comment on: http://stackoverflow.com/a/22799813
type: Comment
score: 1
has text: Contrary to all the Map-based answers (of complexity O(n)), the complexity of this answer is O(n²). This may be significant with bigger lists.

http://stackoverflow.com/a/22786395
has body: || is no operator in JPQL. Replace it with OR: http://docs.oracle.com/cd/E11035_01/kodo41/full/html/ejb3_langref.html#ejb3_langref_operators
has comment: http://stackoverflow.com/comment/34743026
score: 0
type: Answer
answers question: http://stackoverflow.com/q/22786359

http://stackoverflow.com/comment/34525170
score: 0
has text: where's the code that writes the model to disk? Also, please show (at least a sample of) the output in the question; we need to see the data _here_ for the question to make sense.
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/22657447

http://stackoverflow.com/a/27341040
answers question: http://stackoverflow.com/q/22798802
has body: If you just want to draw curves, then use either Path2D class (Path2D.Float or Path2D.Double) which provide the methods .moveTo(x, y), .lineTo(x, y), .curveTo(cp1x, cp1y, cp2x, cp2y, endx, endy), and .quadTo(cpx, cpy, endx, endy). If you want to really dig into how curves work, then check this wonderful tutorial http://devmag.org.za/2011/04/05/bzier-curves-a-tutorial/
upvote count: 4
score: 4
downvote count: 0
type: Answer

http://stackoverflow.com/q/22684740
possible better answer: http://stackoverflow.com/a/64011460
type: Question
upvote count: 4
answer count: 2
downvote count: 0
score: 4
has answer: http://stackoverflow.com/a/22687265
favorite count: 0
has body: Is the following usable with JNI? public NativeClass { static { System.loadLibrary("dll"); } public static native void addListener(Listener listener); } public interface Listener { public void eventOccurred(Info info); } public Info { private final String s1; private final String s2; public Info(String s1, String s2); // ... getters for use in Java } Is it possible to register a Listener object on a dll (should be no problem, as far as I found out) instantiate an Info object in the c/c++ code and use it as a parameter for calling Listener.eventOccured(Info...)? Or what would be a good way to implement a listener which gets some information from a DLL? In my case - we have a dll wich does some work. We call this dll from java. Now we want to attach a listener to the dll, to push us some progress information while working. The above example is the listener part, which I don't know if it is possible regarding the constructor call to a Java constructor from c/c++. A hint where to find a piece of documentation, which describes the answer would be nice - I could not find infos, which answered my question. A small snippet of code, describing the c/c++ part would be the icing on the cake :)
tagged with: c++
has title: JNI - Listener in C++/Java - is it possible to instantiate Java objects in c++ and use them as parameters
accepted answer: http://stackoverflow.com/a/22687265
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/64011460
tagged with: dll
tagged with: java-native-interface
tagged with: java
tagged with: http://stackoverflow.com/tag/c

http://stackoverflow.com/q/22782675
has comment: http://stackoverflow.com/comment/34737134
tagged with: visualvm
downvote count: 1
possible better answer: http://stackoverflow.com/a/22783635
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/22783635
tagged with: java
type: Question
answer count: 2
has answer: http://stackoverflow.com/a/22783098
upvote count: 5
score: 4
has body: VisualVM has an official plugin called "VisualGC". In the VisualGC tab, there is a "Compile Time" meter displaying number of compiles and time spent. The meter shows up on any OS with OpenJDK JVM 6+, Oracle Hotspot JVM 6+ no matter what GC method/parameters are specified. What does the "Compile Time" mean? Does it become a concern if the compile "time spent" shows many minutes?
has title: What is "Compile Time" in VisualGC?
favorite count: 0
accepted answer: http://stackoverflow.com/a/22783098

junit
tags question: http://stackoverflow.com/q/22720233
tags question: http://stackoverflow.com/q/22683491
tags question: http://stackoverflow.com/q/22729226
type: Tag
tags question: http://stackoverflow.com/q/22686178
tags question: http://stackoverflow.com/q/22751541
tags question: http://stackoverflow.com/q/22782671
tags question: http://stackoverflow.com/q/22656641
tags question: http://stackoverflow.com/q/22731488
tags question: http://stackoverflow.com/q/22677467
tags question: http://stackoverflow.com/q/22726182
tags question: http://stackoverflow.com/q/22803246
tags question: http://stackoverflow.com/q/22670534
tags question: http://stackoverflow.com/q/22782848
tags question: http://stackoverflow.com/q/22808130
tags question: http://stackoverflow.com/q/22807328
tags question: http://stackoverflow.com/q/22777230
tags question: http://stackoverflow.com/q/22654619
tags question: http://stackoverflow.com/q/22658624
tags question: http://stackoverflow.com/q/22724946
tags question: http://stackoverflow.com/q/22676040
tags question: http://stackoverflow.com/q/22780964
tags question: http://stackoverflow.com/q/22807733
tag name: junit
tags question: http://stackoverflow.com/q/22667237
tags question: http://stackoverflow.com/q/22704972
tags question: http://stackoverflow.com/q/22805909
tags question: http://stackoverflow.com/q/22670841
tags question: http://stackoverflow.com/q/22762576
tags question: http://stackoverflow.com/q/22695408
tags question: http://stackoverflow.com/q/22737495
tags question: http://stackoverflow.com/q/22750900
tags question: http://stackoverflow.com/q/22659641
tags question: http://stackoverflow.com/q/22773590
tags question: http://stackoverflow.com/q/22666824
tags question: http://stackoverflow.com/q/22747023
tags question: http://stackoverflow.com/q/22744602
tags question: http://stackoverflow.com/q/22719485
tags question: http://stackoverflow.com/q/22664565
tags question: http://stackoverflow.com/q/22765304
tags question: http://stackoverflow.com/q/22804711
tags question: http://stackoverflow.com/q/22791538
tags question: http://stackoverflow.com/q/22666833
tags question: http://stackoverflow.com/q/22665919
tags question: http://stackoverflow.com/q/22761120
tags question: http://stackoverflow.com/q/22668513
tags question: http://stackoverflow.com/q/22683399
tags question: http://stackoverflow.com/q/22722930
tags question: http://stackoverflow.com/q/22666671
tags question: http://stackoverflow.com/q/22751356

http://stackoverflow.com/q/22729034
answer count: 1
has comment: http://stackoverflow.com/comment/34655571
tagged with: c++
has title: JNI java.lang.UnsatisfiedLinkError: ****.***()Z
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/22741223
tagged with: java-native-interface
tagged with: java
type: Question
has body: I am going to use JNI. But result is... Exception in thread "main" java.lang.UnsatisfiedLinkError: Graphic.begin()Z at Graphic.begin(Native Method) at Graphic.main(Graphic.java:22) Compile: objects: g++ -c -fPIC -I. -I../gxlib/include/gxlib -I/usr/lib/jvm/jdk-7-oracle-armhf/include/ -I/usr/lib/jvm/jdk-7-oracle-armhf/include/linux -o a.o a.cpp final file: g++ -shared -o libpbjni.so [Object files] The library was loaded. but problem in calling functions. Code: C++ Code #include &lt;iostream&gt; #include &lt;string&gt; using std::cerr; using std::endl; using std::string; void logerr(string s){ cerr &lt;&lt; "PB: ERROR: " &lt;&lt; s &lt;&lt; endl; } extern "C"{ #include "Graphic.h" #include &lt;gx.h&gt; dc_t *scr, *buf; font_t *font12, *font24, *font36; //boolean begin() JNIEXPORT jboolean JNICALL Java_Graphic_begin (JNIEnv * env, jobject o){ if(GX_SUCCESS != gx_open("/dev/fb1")){ logerr("Failed to open framebuffer /dev/fb1"); return false; } if(NULL == (scr = gx_get_screen_dc())){ logerr("Failed to get device context"); gx_close(); return false; } if(NULL == (buf = gx_get_compatible_dc(scr))){ logerr("Failed to get compatible device context"); gx_release_dc(scr); gx_close(); return false; } gx_clear(buf, gx_color(0, 0, 0, 255)); if(NULL == (font12 = gx_open_font("font12.bdf"))){ logerr("Failed to oepn font font12.bdf"); gx_release_dc(buf); gx_release_dc(scr); gx_close(); return false; } if(NULL == (font24 = gx_open_font("font24.bdf"))){ logerr("Failed to oepn font font24.bdf"); gx_release_dc(buf); gx_release_dc(scr); gx_close(); return false; } if(NULL == (font36 = gx_open_font("font36.bdf"))){ logerr("Failed to oepn font font36.bdf"); gx_release_dc(buf); gx_release_dc(scr); gx_close(); return false; } buf-&gt;font = font36; gx_text_out(buf, 90, 120, "PiBox"); gx_bitblt(scr, 0, 0, buf, 0, 0, buf-&gt;width-1, buf-&gt;height-1); return true; } //int width() JNIEXPORT jint JNICALL Java_Graphic_width (JNIEnv * env, jobject o){ return buf-&gt;width; } //int height() JNIEXPO…
score: 0
has comment: http://stackoverflow.com/comment/34655707

http://stackoverflow.com/q/22689271
has comment: http://stackoverflow.com/comment/34567531
type: Question
has answer: http://stackoverflow.com/a/31519986
tagged with: performance
has comment: http://stackoverflow.com/comment/34571783
upvote count: 1
has body: I am using Webview in an Android application. This application receives an event for each 250 ms and updates the DOM element. For this simple operation the CPU usage goes to 14 to 16%. For the same operation the native app is consuming only 4 to 5%. Why is Webview consuming so much of CPU for updating one DOM element. Is there a way we can optimize this in Android?
answer count: 1
favorite count: 0
type: UnansweredQuestion
tagged with: android
has title: Android Webview CPU usage
downvote count: 0
score: 1
tagged with: java

http://stackoverflow.com/comment/34637074
comment on: http://stackoverflow.com/a/22726748
score: 0
type: Comment
has text: Even when I set the timezone to my local time of CST it still says 6:00
type: AnswerComment

http://stackoverflow.com/comment/34543945
score: 0
type: Comment
has text: Added how to print out the output. Done!
comment on: http://stackoverflow.com/a/22675327
type: AnswerComment

http://stackoverflow.com/comment/34639713
score: 0
has text: How can I make the webdriver to wait until a download complete
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/22714112

http://stackoverflow.com/q/22656752
has body: I am developing an Fitness App. My app will have different exercises like Push Ups and Sit Ups. Every exercise need to have an image to show to the user. I have been thinking a while on what is a good way to solve this problem. But I don't think my solution below is good. Have you worked with images on Android for displaying images? Give me your solution on how you did it. An exercise have a name but also images. The purpose is to display a specific Exercise with the images and exercise name. My Exercise class looks like this right now: I have thought of having the path to the image saved which I can have access when I need to show the image. I am uploading the images on the assets folder. public class Exercise { private String exerciseName; private String exerciseSmallImagePath; private String exerciseLargeImagePath; public Exercise(String exerciseName, String exerciseSmallImagePath, String exerciseLargeImagePath){ this.exerciseName = exerciseName; this.exerciseSmallImagePath = exerciseSmallImagePath; this.exerciseLargeImagePath = exerciseLargeImagePath; } }
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/22657076
type: Question
possible better answer: http://stackoverflow.com/a/22656972
has comment: http://stackoverflow.com/comment/34510879
tagged with: java
has answer: http://stackoverflow.com/a/22657076
answer count: 2
has comment: http://stackoverflow.com/comment/34510158
has comment: http://stackoverflow.com/comment/34509940
score: 0
has title: Displaying an Image Android
has answer: http://stackoverflow.com/a/22656972
tagged with: android
has comment: http://stackoverflow.com/comment/34510010

http://stackoverflow.com/q/22773649
downvote count: 0
favorite count: 0
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/39730634
upvote count: 1
has comment: http://stackoverflow.com/comment/34720674
has body: I have the following code: while(!loggedIn) { loggedIn = login.getDone(); } System.out.println("madeIt"); The print line never executes, even though I know login.getDone() returns true at some point. If, however, I use the following code: while(!loggedIn) { loggedIn = login.getDone(); System.out.println(loggedIn); } System.out.println("madeIt"); Then the last print line executes. I have no idea why. Does anyone have any insight into why this happens? For more code, see the entirety of my main class: public class GameManager { public static void main (String args[]) { boolean loggedIn = false; String username; int playerNum; int i = 0; Login login = new Login(); while (!loggedIn){ loggedIn = login.getDone(); //System.out.println(loggedIn); } login.close(); System.out.println("Logged in"); } } and the entirety of the login class: import squint.*; import javax.swing.*; import java.util.*; public class Login extends GUIManager { private final int WINDOW_WIDTH = 200, WINDOW_HEIGHT = 150; private JButton login; String name; boolean done; int playerNumber; public Login() { done = false; this.createWindow( WINDOW_WIDTH, WINDOW_HEIGHT ); this.setTitle("Hearts Login"); login = new JButton("Click"); contentPane.add(login); } public void buttonClicked( ) { done = true; System.out.println(done); } public boolean getDone() { return done; } } And squint can be found at http://dept.cs.williams.edu/~cs134/squintV2.20.jar
has comment: http://stackoverflow.com/comment/34720513
has comment: http://stackoverflow.com/comment/34720481
score: 1
tagged with: java
tagged with: loops
linked to: http://stackoverflow.com/q/25425130
type: Question
has comment: http://stackoverflow.com/comment/34721508
has answer: http://stackoverflow.com/a/22773757
has comment: http://stackoverflow.com/comment/34727913
tagged with: while-loop
has comment: http://stackoverflow.com/comment/34720600
has title: Java while loop subtlety
answer count: 1

http://stackoverflow.com/a/22654171
has comment: http://stackoverflow.com/comment/34600403
has comment: http://stackoverflow.com/comment/34595616
upvote count: 2
has body: Disclaimer The ImageMagick solutions does not create vector outputs but pixel file formats. It might solve the problem though. The only, open source, way, I found, to create a svg image from eps is the Inkscape method mentioned briefly below. EDIT: @Chai has found a solution by himself, see elsewhere on this page. Manual pre-process With the open source utility software ImageMagick you can easily convert from one image format to another. In its easiest form just do: convert image.eps image.png With use of switches you can tweak the quality and a lot of other features as well. With the open source drawing software Inkscape you can do the same manually. Simply open the eps image and save it as a svg image file. Programmatical process This is one way to solve this using java. The solution is based on the im4java ImageMagick wrapper. In my case there was no need to connect my ImageMagick installation to the java library but if that is the case; how is mentioned on their web-site. import java.io.IOException; import org.im4java.core.ConvertCmd; import org.im4java.core.IM4JavaException; import org.im4java.core.IMOperation; public static void main(String[] args) throws IOException, InterruptedException, IM4JavaException { ConvertCmd convertCmd = new ConvertCmd(); IMOperation imOperation = new IMOperation(); imOperation.addImage("/home/user/images/image.eps"); imOperation.addImage("/home/user/images/image.png"); convertCmd.run(imOperation); } The pom.xml if you are using maven 4.0.0 lab imagemagick 0.0.1-SNAPSHOT org.im4java im4java 1.4.0
has comment: http://stackoverflow.com/comment/34595168
answers question: http://stackoverflow.com/q/22653134
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/34548874
accepted answer of: http://stackoverflow.com/q/22653134
has comment: http://stackoverflow.com/comment/34559060
has comment: http://stackoverflow.com/comment/34561048
type: Answer
score: 2

http://stackoverflow.com/a/22741450
type: Answer
answers question: http://stackoverflow.com/q/22741388
has comment: http://stackoverflow.com/comment/34661943
has comment: http://stackoverflow.com/comment/34662100
has body: If one paragraph is separated from the next using a blank line, you can use the regex ^\s*$ to count for blank lines between other lines and calculate the number of paragraphs as the number of blank lines between two normal lines + 1. Edited: The paragraphs start with a little indentation, while the lines within the paragraph start at the beginning of the line. So read each line and use the regex ^\\s+ to check if the line starts with a an indentation and count the number of lines that match the regex to find the number of paragraphs.
has comment: http://stackoverflow.com/comment/34690178
has comment: http://stackoverflow.com/comment/34689689
has comment: http://stackoverflow.com/comment/34691516
score: 0
has comment: http://stackoverflow.com/comment/34661913
has comment: http://stackoverflow.com/comment/34662206

http://stackoverflow.com/q/22786950
has body: I have read about the generics get and put rule that should prevent you from adding a Banana to a List&lt;? extends Fruit&gt;: public abstract class Fruit { } public class Banana extends Fruit { } public class Apple extends Fruit { } List&lt;? extends Fruit&gt; lst = new ArrayList&lt;&gt;(); lst.add(new Banana()); // Compile error "The method add(capture#6-of ? extends Fruit) in the type List&lt;capture#6-of ? extends Fruit&gt; is not applicable for the arguments (Banana)" I understand that if you didn't have the compile error, you would be able to do: List&lt;? extends Fruit&gt; lst = new ArrayList&lt;&gt;(); lst.add(new Banana()); lst.add(new Apple()); which sounds wrong because you get different objects type in the same list (I saw an answer by @Tom Hawtins explaining why, and I believed him :) (I can't find the link to it though)). However, if you implement the following: public class ListFruit implements List&lt;Fruit&gt; { List&lt;Fruit&gt; list; public ListFruit() { list = new ArrayList&lt;&gt;(); } @Override public int size() { return list.size(); } // All delegates of "list" @Override public List&lt;Fruit&gt; subList(int fromIndex, int toIndex) { return list.subList(fromIndex, toIndex); } } and then do: ListFruit lst = new ListFruit(); lst.add(new Banana()); lst.add(new Apple()); for (Fruit fruit : lst) System.out.println(fruit.getClass().getName()); you get no compile error, and the following (expected) output: Banana Apple Am I breaking any contract by doing so? Or am I circumventing a protection and should-no-be-doing-it?
linked to: http://stackoverflow.com/q/1292109
tagged with: pecs
tagged with: generic-list
score: 0
has answer: http://stackoverflow.com/a/22787042
possible better answer: http://stackoverflow.com/a/22787025
accepted answer: http://stackoverflow.com/a/22787042
answer count: 3
tagged with: generics
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/22787025
tagged with: java
has title: Overcoming generics put-get rule
type: Question
has answer: http://stackoverflow.com/a/22787803

http://stackoverflow.com/comment/34601826
type: QuestionComment
comment on: http://stackoverflow.com/q/22707787
score: 4
has text: Hint: You can't add the same `JList` to multiple components, but you _can_ use _two_ `JLists` with the same `DefaultListModel`. Try it out on a simple example. If it doesn't work, then post the _simple_ compilable example so we can text it out.
type: Comment

http://stackoverflow.com/q/22774332
answer count: 2
possible better answer: http://stackoverflow.com/a/29499769
favorite count: 0
has answer: http://stackoverflow.com/a/29499769
accepted answer: http://stackoverflow.com/a/22774661
has title: how to get specific initial dice movement in snakes and ladder
type: AnsweredQuestion
tagged with: java
tagged with: javafx
upvote count: 1
has answer: http://stackoverflow.com/a/22774661
downvote count: 1
type: Question
has body: Any help shall be much appreciated! I'm new to java and need to make java app(snakes and ladder) for college project but got stuck. I'm facing problem with the dice movements I have done the coding but it gives random number and the problem is : I have been to told that the game should only start if the dice value is 1 or 6. So how do I predefine it so that my dice's initial value is 1 or 6? 2nd problem if a player's dice value is 6 he should get another chance. code: if(togglePlayer==1){ turnIndicator.setText("Player A's turn"); togglePlayer=0; // using togglePlayer to switch between players if(cheatInjector==0){ face=1; cheatInjector=1; } else{face=r.nextInt(6); } switch (face) { case 0: rollDice1(primaryStage); face = 1; break; case 2: rollDice2(primaryStage); face = 2; break; case 3: rollDice3(primaryStage); face = 3; break; case 4: rollDice4(primaryStage); face = 4; break; case 5: rollDice5(primaryStage); face = 5; break; case 6: rollDice6(primaryStage); face = 6; break; }
score: 0

http://stackoverflow.com/q/22777159
has title: how to create live trace search field in java
type: AnsweredQuestion
tagged with: netbeans
has comment: http://stackoverflow.com/comment/34726474
tagged with: java
type: Question
tagged with: database
has answer: http://stackoverflow.com/a/22777355
accepted answer: http://stackoverflow.com/a/22777355
tagged with: eclipse
tagged with: search
score: 0
answer count: 1
has body: I want to create a live trace search field like google search, for my java desktop application using mysql or sql server data base. I have no idea how to do it. please send me a web link or some stuff to learn about it. I googled but directly not found anything

http://stackoverflow.com/a/22677012
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/34670445
type: Answer
upvote count: 11
score: 11
accepted answer of: http://stackoverflow.com/q/22670646
answers question: http://stackoverflow.com/q/22670646
has body: I get an error indicating that Tomcat 7 will not start because there is a duplicate bean definition for springSecurityFilterChain This is because you should define the springSecurityFilterChain with either (NOT both) the web.xml or a AbstractSecurityWebApplicationInitializer. As you appear to be using Java Configuration, I would remove the web.xml entry. However, when I the comment out the springSecurityFilterChain bean definition in web.xml and try to restart the server, I get a different error message indicating that there is no bean definition for springSecurityFilterChain. This is because the SecurityConfig needs to be referenced somehow. Typically the easiest way to do this when using Java Configuration is to pass in the configuration to the super class constructor of MessageSecurityWebApplicationInitializer. However, the pet clinic is using XML configuration in the web.xml so you will need to do this by combining Java and XML configuration as outlined in the reference. For this example, you could include the following within src/main/resources/business-config.xml &lt;bean class="thepackage.SecurityConfig"/&gt; Naturally, you will need to replace thepackage with the package you are using for SecurityConfig. The reason you can include the configuration in business-config.xml is because this is specified as a contextConfiguration to load in the web.xml. You could also create your own Spring bean XML file, add the SecurityConfig bean as shown above, and ensure to update the web.xml to point to the new Spring bean XML file.
has comment: http://stackoverflow.com/comment/34678067

http://stackoverflow.com/q/22759023
has comment: http://stackoverflow.com/comment/34693920
score: 1
tagged with: java
has body: I have created an application in which a new JFrame displays certain output. The application is working fine when I call the method new ServerInitiator().Initialize(8081) from a console application. But when I call the method from a button click event in first frame the second frame is blank and does not display any output. Code on first JFrame is private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) { new ServerInitiator().initialize(8081); } Code for ServerInitiator is public class ServerInitiator { private JFrame frame = new JFrame(); private JDesktopPane desktop = new JDesktopPane(); public static void main(String args[]){ } public void initialize(int port){ try { ServerSocket sc = new ServerSocket(port); //Show Server GUI drawGUI(); //Listen to server port and accept clients connections while(true){ Socket client = sc.accept(); System.out.println("New client Connected to the server"); //Per each client create a ClientHandler new ClientHandler(client,desktop); } } catch (IOException ex) { ex.printStackTrace(); } } /* * Draws the main server GUI */ public void drawGUI(){ frame.add(desktop,BorderLayout.CENTER); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); //Show the frame in a maximized state frame.setExtendedState(frame.getExtendedState()|JFrame.MAXIMIZED_BOTH); frame.setVisible(true); } }
upvote count: 1
tagged with: swing
type: Question
linked to: http://stackoverflow.com/q/9554636
has answer: http://stackoverflow.com/a/22759155
has comment: http://stackoverflow.com/comment/34696211
has title: Nothing displayed in second frame when called from first frame
answer count: 1
downvote count: 0
favorite count: 0
tagged with: jframe
type: UnansweredQuestion

http://stackoverflow.com/q/22759924
accepted answer: http://stackoverflow.com/a/22783474
score: 1
tagged with: java
has body: I'm consuming a webservice with a binary data object which is base 64 encoded. The corresponding xsd element looks like this: &lt;xs:element name="Document" maxOccurs="unbounded" xmime:expectedContentTypes="application/octet-stream"&gt; &lt;xs:complexType&gt; &lt;xs:simpleContent&gt; &lt;xs:extension base="xs:base64Binary"&gt; &lt;xs:attribute name="id" type="xs:anyURI" use="required"&gt; &lt;xs:annotation&gt; &lt;xs:documentation&gt;documentation text...&lt;/xs:documentation&gt; &lt;/xs:annotation&gt; &lt;/xs:attribute&gt; &lt;/xs:extension&gt; &lt;/xs:simpleContent&gt; &lt;/xs:complexType&gt; &lt;/xs:element&gt; After generating my classes using the maven-jaxws-tools-plugin with the jbossws-cxf-client (the native client leads to the same error) something seems to be missing. No matter how I try to enable MTOM, it just does not send any attachments but it keeps the binary data in the main xml. I tried to configure the SOAPBinding and I created the port with an MTOMFeature with and without threshold. Basically it always looks like this. &lt;ns4:Document id="Document01"&gt;dGhpcyBpcyBzYW1wbGUgZG9jdW1lbnQgbm8uIDE=&lt;/ns4:Document&gt; Is there an error in the xsd file, is the plugin the problem or is it just me forgetting something? -- After generating the classes with another plugin (jaxws-maven-plugin) I got an interesting warning in the console. It tells me that the xmine:expectedContentType attribute is present in an invalid element. I'm quite sure that I saw several examples of this doing it exactly the same way so I have no idea whether this could lead to any problems or not. This does not change anything, I found that the classes are just fine. -- It seems to be a problem of this method call in one of our Handler implementations: ctx.getMessage(); ctx is the SOAPMessageContext object that is put into the handleMessage method of the SOAPHandler implementation. As soon as this method is executed, there will be no attachments in the request. I'm curious how a gett…
tagged with: mtom
type: Question
has title: SOAP message not using attachments
upvote count: 1
downvote count: 0
answer count: 1
tagged with: http://stackoverflow.com/tag/xml
favorite count: 0
tagged with: soap
tagged with: web-services
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/22783474

http://stackoverflow.com/comment/34670350
type: QuestionComment
has text: See also [tag:embedded-resource].
comment on: http://stackoverflow.com/q/22744920
score: 0
type: Comment

http://stackoverflow.com/comment/34721873
type: AnswerComment
type: Comment
has text: Do you have any input into the new problem after inputting the data?
comment on: http://stackoverflow.com/a/22774301
score: 0

http://stackoverflow.com/a/22766460
has comment: http://stackoverflow.com/comment/34713961
downvote count: 0
type: Answer
has body: There are a couple of useful frameworks for this usecase. Have a look at: FlyWay and Liquibase Both can handle your use case quite neatly. The main difference is the way how migrations are defined, flyway uses SQL and Javacode based migrations, Liquibase uses XML. My personal preference lies with FlyWay, as I find it more natural.
upvote count: 1
accepted answer of: http://stackoverflow.com/q/22766279
score: 1
answers question: http://stackoverflow.com/q/22766279
has comment: http://stackoverflow.com/comment/34711592
has comment: http://stackoverflow.com/comment/34722361
type: AcceptedAnswer

http://stackoverflow.com/a/22781187
score: 0
answers question: http://stackoverflow.com/q/22780918
type: Answer
has body: In your first line you create a 2d dimensional array of uninitialized instances of a Cards class. The size of each dimension is defined by the number you input in the braces (don't know why you need the int in there, does it even compile ?) You need to initialize each cell by cards[i][j] = new Cards(suits, ranks); in order to be able to access the cards in that cell. (where i and j are in the array boundaries) You second line is a creation of a single instance of class Cards. The suits and ranks arguments that you are passing are due to the constructor definition of the class Cards as opposed to the definition of a 2d array (where the values in the braces define the size of each dimension of the array)

http://stackoverflow.com/q/22657007
tagged with: java
answer count: 1
has comment: http://stackoverflow.com/comment/34510697
tagged with: casting
has comment: http://stackoverflow.com/comment/34514801
tagged with: arrays
has comment: http://stackoverflow.com/comment/34514838
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/22762517
has comment: http://stackoverflow.com/comment/34514921
has comment: http://stackoverflow.com/comment/34511190
linked to: http://stackoverflow.com/q/2351189
tagged with: string
has comment: http://stackoverflow.com/comment/34512577
type: Question
has body: This simple line of code is giving me a headache : Set&lt;Long&gt; statutList = rechercheSalarieForm.getIdStatutList(); getIdStatutList() is returning a set of Longs BUT when I do : statutList.toArray()[0].getClass() or rechercheSalarieForm.getIdStatutList().toArray()[0].getClass() The result is : (java.lang.Class&lt;T&gt;) class java.lang.String This statutList is send straight to DAO layer which doesn't like Strings in the hibernate request. How is it possible to have Strings in a Long array ? Edit : Short program : public List&lt;EffectifRupHistoriqueExtractionVO&gt; generateExtractionRupHistorique(RechercheSalariesRupFormVO rechercheSalarieForm) throws FunctionalException { Collection&lt;Long&gt; statutList = rechercheSalarieForm.getIdStatutList(); // Some business/Dao call with statutList in parameter } Object RechercheSalariesRupFormVO : public class RechercheSalariesRupFormVO extends ValueObject{ // some declaration private Set&lt;Long&gt; idStatutList; public Set&lt;Long&gt; getIdStatutList() { return idStatutList; } }
has title: java getClass show String but variable is affected in a long object
has comment: http://stackoverflow.com/comment/34510425
score: 0

http://stackoverflow.com/a/22697179
accepted answer of: http://stackoverflow.com/q/22696950
answers question: http://stackoverflow.com/q/22696950
score: 1
has comment: http://stackoverflow.com/comment/34584636
type: AcceptedAnswer
has body: When you are sending the data you specify utf-16 as encoding. But when you are reading the response you do not specify an encoding, so the default platform encoding is used. So exchange this line: BufferedReader br = new BufferedReader(new InputStreamReader(stream)); with this (assuming the response also is encoded in utf-16): BufferedReader br = new BufferedReader(new InputStreamReader(stream,"utf-16")); You should actually check the response header to learn which encoding has been used.
upvote count: 1
type: Answer
downvote count: 0
has comment: http://stackoverflow.com/comment/34582493

http://stackoverflow.com/q/22799437
tagged with: java
tagged with: rgb
score: 2
type: AnsweredQuestion
downvote count: 0
has body: I can read in an image and write to an image and the image looks perfect. So thats ok. I think I am having difficulties with my bit shifting. Because when I test print the first 3 RGB int values, and then test print the 3 int values after, they don't have the same values? But the I run the program again, the first print values are the same as the first print values before? OK, below is the code when I bit shift the values out into red, green and blue arrays int g=0; for(int row=0; row&lt;h; row++) { for(int col=0; col&lt;w; col++) { redPixels[row][col] = ((RGBarray[g]&gt;&gt;16)&amp;0xff); greenPixels[row][col] = ((RGBarray[g]&gt;&gt;8)&amp;0xff); bluePixels[row][col] = (RGBarray[g]&amp;0xff); g++; } } Below is the code to bit shift the values back into integers... for(int row=0; row&lt;h; row++) { for(int col=0; col&lt;w; col++) { int rgb = (redPixels[row][col] &amp; 0xff) &lt;&lt; 16 | (greenPixels[row][col] &amp; 0xff) &lt;&lt; 8 |(bluePixels[row][col] &amp; 0xff); bufferedImage.setRGB(col, row, rgb); } } first 3 int values before bit shifting into array: -16573912 -16573912 -16508119 first 3 int values after bit shifting back into integers: 203304 203304 269097 But keep in mind, when I run the program again, the exact same values are shown (in this case the above same output). And also that an accurate image is created. I am just unsure about the values not being the same before and after bit shifting? Hope this is clear? Thanks
has answer: http://stackoverflow.com/a/22799570
favorite count: 0
type: Question
has title: Using BufferedImage in Java
upvote count: 2
accepted answer: http://stackoverflow.com/a/22799570
tagged with: bufferedimage
answer count: 1

http://stackoverflow.com/comment/34575368
comment on: http://stackoverflow.com/q/22692858
has text: Interesting - did you reinstall Tomcat by any chance?
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/34598717
type: Comment
comment on: http://stackoverflow.com/q/22706042
type: QuestionComment
score: 1
has text: Shouldn't it be `[^a-zA-Z]` not `[^a-zA-z]`

http://stackoverflow.com/a/56170117
score: 2
upvote count: 2
has body: As the whole JAXB project now moved from https://github.com/javaee/jaxb-v2 to https://github.com/eclipse-ee4j/jaxb-ri including the Maven dependencies, I updated my pom.xml from com.sun.xml.bind jaxb-xjc ${jaxb-xjc.version} com.sun.xml.bind jaxb-core ${jaxb.version} to org.glassfish.jaxb jaxb-xjc ${jaxb-xjc.version} org.glassfish.jaxb jaxb-core ${jaxb.version} This helped me at least with a similar issue.
answers question: http://stackoverflow.com/q/22670725
downvote count: 0
type: Answer

http://stackoverflow.com/comment/34667539
type: QuestionComment
comment on: http://stackoverflow.com/q/22744355
has text: Right. Well, the package the class is in needs to be the same as the the folder that the class is in the Jar. That's why I ask exactly how you packaged it. [This](http://stackoverflow.com/q/7408921/2071828) might help you, or maybe your teacher gave you some information.
score: 0
type: Comment

http://stackoverflow.com/comment/34727695
score: 0
type: Comment
comment on: http://stackoverflow.com/a/22756464
type: AnswerComment
has text: Fair enough, however I haven't asked about multi-threading. It is just an example of how the @Nullable/@Nonnull Annoations are not evaluated properly, since a simple null check makes the error marker go away.

http://stackoverflow.com/comment/34731042
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/22778149
has text: My application is already running sir, it's so complex to explain you so you are telling like that, I want only the instance as per method argument. I have tried ParameterizedType and other thing but not working. Sir can you told me that without @Autowired can I return instance of class and also without new ? Is there any other option for that ? I am stuck in this situation because like AddFoo and so on I have near about 300 classes so I can't write it manually in if condition and also it's wrong concept.

http://stackoverflow.com/q/22720893
type: Question
has comment: http://stackoverflow.com/comment/34625802
answer count: 1
has comment: http://stackoverflow.com/comment/34625789
tagged with: android
tagged with: android-virtual-device
tagged with: opengl-es
has comment: http://stackoverflow.com/comment/34625916
has comment: http://stackoverflow.com/comment/34625966
score: 0
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/22721339
has title: Android Unfortunately, App Has Stopped On Navbar Back
has comment: http://stackoverflow.com/comment/34625808
tagged with: java
has body: I am using AVD to fiddle with making applications. I can run the app fine, but if I try to press the back button on the navbar, it brings me back (as intended) but also gives me the "Unfortunately, app has stopped." message. So, how can I get rid of this? I have been frustrated with this for a long time and I feel like it's a really simple answer that I left out... I am using an emulator. The (single) line of code it outputs in logcat when I press the back button on the navbar is this: 03-28 14:47:46.391: A/libc(1707): Fatal signal 11 (SIGSEGV) at 0x00000000 (code=1), thread 1720 (Thread-117) After it takes me back to where I was before I started the app, it kindly shows me an "Unfortunately, app has stopped" message. Thanks in advance.

http://stackoverflow.com/comment/34594227
comment on: http://stackoverflow.com/q/22703409
score: 0
type: QuestionComment
type: Comment
has text: Will your query always return 2 results?

http://stackoverflow.com/comment/34520275
score: 0
comment on: http://stackoverflow.com/q/22661660
type: Comment
type: QuestionComment
has text: @EyalSchneider Is there any other methods to re-organize besides removeall and addall again.

http://stackoverflow.com/q/22764871
has answer: http://stackoverflow.com/a/22765246
has body: I am trying reset all values in a HashMap to some default value if a condition fails. Currently i am doing this by iterating over all the keys and individually resetting the values. Is there any possible way to set a same value to all the keys without iterating? Something like: hm.putAll("some val") //hm is hashmap object
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/22765354
has comment: http://stackoverflow.com/comment/34704689
downvote count: 0
tagged with: java
has answer: http://stackoverflow.com/a/22764963
possible better answer: http://stackoverflow.com/a/22765098
type: Question
has title: Reset all values in hashmap without iterating?
tagged with: hashmap
upvote count: 6
has comment: http://stackoverflow.com/comment/34705689
answer count: 6
has comment: http://stackoverflow.com/comment/34704602
favorite count: 0
has answer: http://stackoverflow.com/a/22765162
has comment: http://stackoverflow.com/comment/34704741
has comment: http://stackoverflow.com/comment/34704746
has answer: http://stackoverflow.com/a/22765098
has answer: http://stackoverflow.com/a/22765025
score: 6
accepted answer: http://stackoverflow.com/a/22764963

http://stackoverflow.com/comment/34589433
comment on: http://stackoverflow.com/a/22700852
type: Comment
has text: Yeah please recheck it because when you compare it to answer #1, it seems your answer isn't correct.
score: 0
type: AnswerComment

http://stackoverflow.com/a/22792419
answers question: http://stackoverflow.com/q/22753912
accepted answer of: http://stackoverflow.com/q/22753912
has body: I figured it out on my own. I took out the WorldGeneratieOverworld1 and just added the generation below the other WorldGeneratieOverworld. here is the new code: private void generateInOverworld(World world, Random random, int x, int z) { for(int i = 0; i &lt; 17; i++) { //20 = Rarity int chunkX = x + random.nextInt(16); int chunkY = random.nextInt(28); //= how high generates int chunkz = z + random.nextInt(16); (new WorldGenMinable(halo.Titanium_Ore, 6)).generate(world, random, chunkX, chunkY, chunkz); //8 = number per vein } for(int i = 0; i &lt; 24; i++) { //20 = Rarity int chunkX = x + random.nextInt(16); int chunkY = random.nextInt(45); //= how high generates int chunkz = z + random.nextInt(16); (new WorldGenMinable(halo.Copper_Ore, 7)).generate(world, random, chunkX, chunkY, chunkz); //8 = number per vein } }
score: 0
type: AcceptedAnswer
type: Answer

http://stackoverflow.com/comment/34663272
type: QuestionComment
comment on: http://stackoverflow.com/q/22742092
has text: For better help try adding example of input and expected output/result with little explanation why is it expected.
score: 0
type: Comment

http://stackoverflow.com/comment/34691085
comment on: http://stackoverflow.com/a/22757417
score: 0
type: Comment
has text: OK I see ` false ` and ` true `.
type: AnswerComment

http://stackoverflow.com/comment/36749432
comment on: http://stackoverflow.com/a/22774943
has text: I found that AnimationTimer actually slows the GUI down. Is there an alternative solution to retrieve messages like a hook to the application thread somewhere? And I don't like to repeatedly use runLater(). The essence of using a queue seems to be lost in it and I'm also uncertain about the order on how "runLater()" objects gets executed as reference to the actual and strict technical spec of its implementation, not just the current one.
type: AnswerComment
score: 0
type: Comment

http://stackoverflow.com/q/22767033
score: -2
has body: I'm making the connect 4 game in Java and in vs computer mode. The computer will play randomly. I wrote the code to select randomly the column. Computer does play randomly on a column but keep on playing on same column after. How should I do to make it play randomly on any column whenever its computer's turn. This is my simple code so far: public static Random rnd = new Random(); public static final int row = Row - 1; public static int col = rnd.nextInt(7); What code should I write and I need the variable col for my next method of this class
has answer: http://stackoverflow.com/a/22767254
tagged with: random
answer count: 2
upvote count: 0
has answer: http://stackoverflow.com/a/22767068
favorite count: 0
type: UnansweredQuestion
has title: Random number loop
tagged with: java
downvote count: 2
type: Question

http://stackoverflow.com/a/22758415
has body: I had the same problem and I resolved it by activating the android plugin in Netbeans. To do so, go to tools -&gt; plugins -&gt; installed then check the show details checkbox and search for the android plugins then activate them.
type: Answer
answers question: http://stackoverflow.com/q/22665777
score: 0

http://stackoverflow.com/q/22761048
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/34698873
type: Question
tagged with: dependency-injection
tagged with: java
tagged with: seam2
has comment: http://stackoverflow.com/comment/34697515
tagged with: java-ee-5
has title: Configure bean through annotation (java ee5)
has comment: http://stackoverflow.com/comment/34699248
has body: I'm in need of configurating ejb through custom annotation (in java ee 5 environment). How can I achieve it? Here's a sample code which shall depict my problem better. class MyBigClass{ @Configure(value=5) ConfigurableBean bean; } and somewhere on the way, I'd like to set certain property in implementation of 'ConfigurableBean' with value of "5". class MyConfigurableBean implements ConfigurableBean{ int myValue; // while DI process it's being set with 5 } I use jboss-seam2 in my product. Maybe there's a build-in component that might help me in achieving my goal. I trully hope I have stated my mind clearly :) Best regards, Miron
score: 0
has comment: http://stackoverflow.com/comment/34697787
tagged with: ejb-3.0
answer count: 0

http://stackoverflow.com/comment/34652366
score: 0
type: AnswerComment
has text: If the splitting parts bigger than 1024, i don't know how many lines in text.
type: Comment
comment on: http://stackoverflow.com/a/22735732

http://stackoverflow.com/comment/34767778
score: 0
has text: Are you asking how to implement that method or how to actually write it syntactically in the class?
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/22799968

http://stackoverflow.com/q/22733437
has comment: http://stackoverflow.com/comment/34647940
type: AnsweredQuestion
score: 0
tagged with: java
type: Question
has comment: http://stackoverflow.com/comment/34648094
tagged with: arrays
has answer: http://stackoverflow.com/a/22733544
has title: How can i write code about different colors, different radius balls in java
has comment: http://stackoverflow.com/comment/34647973
answer count: 2
has comment: http://stackoverflow.com/comment/34648059
possible better answer: http://stackoverflow.com/a/22733549
has body: Main class this is main class of my program public class Main { public static void main(String[] args) { BallWorld frm = new BallWorld(3); frm.setVisible(true); for (int i=0; i&lt;1000; i++){ frm.stepTheBall(); } } } BallWorld.java class this class related with JFrame import java.awt.Graphics; import java.awt.Point; import javax.swing.JFrame; public class BallWorld extends JFrame { public final int FRAMEWIDTH = 600; public final int FRAMEHEIGHT = 400; private Ball[] ballArr; private int ballCnt; public BallWorld(int ballCnt){ super(); setSize(FRAMEWIDTH, FRAMEHEIGHT); setTitle("My Bouncing Ball Application"); ballArr = new Ball[ballCnt]; this.ballCnt = ballCnt; for (int i=0; i &lt; ballCnt; i++){ ballArr[i] = new Ball(new Point(50,50), 5); int ddx = (int) (5*Math.random()); //Exercise 1 int ddy = (int) (4*Math.random()); //Exercise 1 ballArr[i].setMotion(ddx, ddy); } } public void paint(Graphics g){ super.paint(g); for (int i=0; i &lt; ballCnt; i++){ ballArr[i].paint(g); } } public void stepTheBall(){ for (int i=0; i &lt; ballCnt; i++){ ballArr[i].move(); Point loc = ballArr[i].getLocation(); if (loc.x &lt; ballArr[i].getRadius() || loc.x &gt; FRAMEWIDTH-ballArr[i].getRadius()){ ballArr[i].reclectVert(); } if (loc.y &lt; ballArr[i].getRadius() || loc.y &gt; FRAMEHEIGHT-ballArr[i].getRadius()){ ballArr[i].reclectHoriz(); } } repaint(); try { Thread.sleep(20); } catch (InterruptedException e) { e.printStackTrace(); } } } Ball.java class this class related with balls information public class Ball { private Point location; private int radius; private Color color; private int dx, dy; public Ball(Point l, int r, Color c){ location = l; radius = r; color = c; } public Ball(Point l, int r){ location = l; radius = r; color = Color.RED; } public Point getLocation() { return location; } public void setLocation(Point location) { this.location = location; } public int getRadius() { return radius; } public void setRadius(int radius) { this.radius = radius; } public Color getColor…
has answer: http://stackoverflow.com/a/22733549
favorite count: 0
has comment: http://stackoverflow.com/comment/34647962
upvote count: 2
accepted answer: http://stackoverflow.com/a/22733544
downvote count: 2

http://stackoverflow.com/q/22749789
tagged with: graph-theory
tagged with: data-structures
answer count: 2
downvote count: 0
favorite count: 0
has title: Implementation of Adjacency List Graph: Do incidence of vertices require separate objects?
possible better answer: http://stackoverflow.com/a/25178665
has answer: http://stackoverflow.com/a/22750202
accepted answer: http://stackoverflow.com/a/22750202
has body: In Goodrich and Tamassia's textbook: Data Structures &amp; Algorithms in Java, The Adjacency List Structure implementation of the graph ADT is shown in the diagram below: An Incident object I(u), containing the list of incident edges to Vertex u, is referenced to in the Vertex u object. This is the case for every Vertex in the graph. My question is, in a Java implementation of this ADT, what is the point in a separate Incident Object, I(u)? Why can't incident edges be stored in a field in the Vertex object? I can't see how this would be problematic, and surely it would simplify the implementation?
tagged with: abstract-data-type
type: AnsweredQuestion
score: 1
tagged with: java
upvote count: 1
has answer: http://stackoverflow.com/a/25178665
type: Question

http://stackoverflow.com/comment/34688812
type: Comment
type: QuestionComment
score: 1
has text: Generate java source files from where? How? Compilation occurs automatically if you have set eclipse to build automatically. These tasks sounds like they should be done by ant and an ant builder, see http://help.eclipse.org/indigo/index.jsp?topic=%2Forg.eclipse.platform.doc.user%2FgettingStarted%2Fqs-93_project_builder.htm
comment on: http://stackoverflow.com/q/22745762

http://stackoverflow.com/comment/34762541
has text: Why not load 32mb chunks if that is all you want to do? JVM decides when to do GC. GC algorithm you are using may make some difference, but I guess it would be minimal.
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/22797118

http://stackoverflow.com/comment/34772741
type: AnswerComment
score: 0
has text: I believe that given the contents of the above reply, you can figure out the rest yourself. What have you tried so far, and where are you stuck?
comment on: http://stackoverflow.com/a/22801276
type: Comment

http://stackoverflow.com/comment/34658585
score: 0
comment on: http://stackoverflow.com/q/22738570
type: Comment
has text: Run `top` or the equivalent on your program and see whether you're hitting a significant IO wait.
type: QuestionComment

http://stackoverflow.com/a/22763083
has body: If switch &lt; if-then-else and if-then-else == ternary, then switch &lt; ternary.
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/34702559
score: 9
type: Answer
accepted answer of: http://stackoverflow.com/q/22763021
upvote count: 9
answers question: http://stackoverflow.com/q/22763021

http://stackoverflow.com/comment/34604877
type: AnswerComment
score: 0
type: Comment
has text: Point taken. "In the case of divide, the exact quotient could have an infinitely long decimal expansion; for example, 1 divided by 3. If the quotient has a nonterminating decimal expansion and the operation is specified to return an exact result, an ArithmeticException is thrown." - However, you can specify the amount of decimals you want to see (up to 4679 digits, what I've tested), making it far more exact than a Double.
comment on: http://stackoverflow.com/a/22707998

http://stackoverflow.com/q/22725547
accepted answer: http://stackoverflow.com/a/22727130
has body: My objective is quite simple. Store the current date in the Oracle Global Temporary table and display that on JavaScript page using Spring MVC and Hibernate as ORM. Code I wrote is (please note that system time is "Sat Mar 29 11:29:44 EST 2014"): public List<TmpClass> getData() { Integer sno = 1; /* Write query to save the data in the temporary table. Function calls getSession().save(..) */ Date date = new Date(); saveData(new TmpClass(sno, date)); /* Retrieve the data from TmpClass class. Function calls getSession().queryObject("from TmpClass") */ return retrieveData(); } Configuration file: hibernate.cfg.xml at resource path: <hibernate-configuration> <mapping class="com.tesco.larc.forms.TmpGenUtil" /> </hibernate-configuration> -servlet.xml has ${jdbc.dialect} TmpClass @Entity @Table(name = "TMPTABLE") public class TmpClass { @Id @Column(name = "SNO") private Integer sno; @Column(name = "dcol1") private Date date; //getter and setter methods omitted Controller class, creates stores the output of above function in a Model. @RequestMapping(value = {"/", "index"}, method = RequestMethod.GET) public String displayContacts(Model model) { model.addAttribute("Data", contactService.getData()); return "eInfoScreen"; } JavaScript code is : <c:forEach items="${Data}" var="list"> ${list.id} ${list.date} </c:forEach> I am getting date as: Sr BAR_DATE 1 **88-Mar-2014** I am not able to figure out, why instead of 29-Mar-2014, it is showing as 88-Mar-2014. Any help or pointer is much appreciated.
answer count: 1
has comment: http://stackoverflow.com/comment/34636840
score: 0
has comment: http://stackoverflow.com/comment/34635372
has title: Date format get changed in Java-Spring-Hibernate
has answer: http://stackoverflow.com/a/22727130
tagged with: spring
type: Question
tagged with: spring-mvc
type: AnsweredQuestion
tagged with: java
tagged with: hibernate

http://stackoverflow.com/comment/34767546
comment on: http://stackoverflow.com/a/22799735
score: 0
has text: @HotLicks Thanks no idea what I was thinking with the "|". Changed it.
type: AnswerComment
type: Comment

http://stackoverflow.com/q/22750989
answer count: 1
accepted answer: http://stackoverflow.com/a/22752194
type: AnsweredQuestion
tagged with: java
tagged with: multithreading
has answer: http://stackoverflow.com/a/22752194
type: Question
has title: Java multi threading HashMap
has body: I have 1 thread that insert values in my hash map and another thread that just read the value by the hashmap. I don't know why i have problem to read the correct value. I show to you what i did: By the main thread i add the value in the hash map: public class S3Esercizio1 { public static void main(final String[] args) { final EventSource eventSource = new EventSource(); final Thread eventSourceThread = new Thread(eventSource); // run the thread eventSourceThread.start(); // create and register the EventListeners final List&lt;EventListener&gt; allListeners = new ArrayList&lt;&gt;(); for (int i = 0; i &lt; 20; i++) allListeners.add(new EventListener(i, eventSource)); // Wait untill the other thread finish his job. try { eventSourceThread.join(); } catch (final InterruptedException e) { // Thread interrotto } } } when is created a new EventListener is called this constructor: public EventListener(final int id, final EventSource eventSource) { eventSource.registerListener(id, this); // this sleep simulate the problem try { Thread.sleep(4); } catch (final InterruptedException e) { // Thread interrupted } this.id = id; } and by the registerListener method i insert the value in the hashmap public synchronized void registerListener(final int id, final EventListener listener) { allListeners.putIfAbsent(id, listener); } In the other thread there is the Hashmap, and by this thread i read the values inside in the hashmap while the main thread (at the same time) insert values in the hashmap: class EventSource implements Runnable { final ConcurrentHashMap&lt;Integer, EventListener&gt; allListeners = new ConcurrentHashMap&lt;Integer, EventListener&gt;(); @Override public void run() { for (long i = 0; i &lt; 30000000; i++) { final Event e = new Event(i); final java.util.Iterator&lt;Integer&gt; it = allListeners.keySet().iterator(); while(it.hasNext()) { final Integer id = it.next(); EventListener listener = allListeners.get(id); listener.onEvent(id, e); } } } public synchronized v…
score: 0

http://stackoverflow.com/q/22684668
tagged with: java
type: Question
has body: I have a project that have to stream a video in real time from the web cam or from the desctop. I think i have to convert the stream using any codecs because the output stream will be large. Any suggestions how i can convert the output stream using any codecs. Thanks in advance
score: 0
answer count: 1
type: UnansweredQuestion
has title: How i can convert the output stream using any codecs.
has answer: http://stackoverflow.com/a/22685256

http://stackoverflow.com/comment/34572748
type: AnswerComment
comment on: http://stackoverflow.com/a/22691262
score: 0
type: Comment
has text: From the "other answer", it looks to me that some of those Java 7 features depend only on having a compiler that understands them, and is independent of what Android version is running on the device; and that `switch(String)` is one of those. Is my interpretation correct?

http://stackoverflow.com/a/22795787
type: AcceptedAnswer
downvote count: 0
has body: the error is in the json you receive: you class expects an array because List&lt;Person&gt; records; but then in your json you have "records":"[ it has to be : "records": [ and at the end ]"}, has to be ]}
type: Answer
has comment: http://stackoverflow.com/comment/34760273
answers question: http://stackoverflow.com/q/22795614
upvote count: 13
score: 13
accepted answer of: http://stackoverflow.com/q/22795614

http://stackoverflow.com/q/22726633
has comment: http://stackoverflow.com/comment/34715484
type: Question
tagged with: ant
has comment: http://stackoverflow.com/comment/34640024
has title: ANT release errors
score: 0
has body: I'm trying to compile my app to a release build using ant release I followed the procedure and generated build.xml using $ANDROID_HOME/tools/android update project --name MyProject -p . Both $ANDROID_HOME and $JAVA_HOME are exported correctly. I saved ant.propertieswith a valid keystore file and alias Following this, I tried to execute the command ant clean, which runs fine and exits with BUILD SUCCESSFUL message. When I try to do an ant release, that's when the problem happens. I get a bunch of javac compile errors -compile: [javac] Compiling 89 source files /Users/kishu27/Developer/projects/MyProject/bin/classes [javac] /Users/kishu27/Developer/projects/MyProject/src/com/myproject/android/fragments/SettingsDetailFragment.java:20: cyclic inheritance involving com.myproject.android.fragments.SettingsDetailFragment [javac] public class SettingsDetailFragment extends SettingsFragment implements OnScrollListener { [javac] ^ [javac] /Users/kishu27/Developer/projects/MyProject/src/com/myproject/android/fragments/SettingsDetailFragment.java:22: modifier private not allowed here [javac] private String cat; [javac] ^ [javac] /Users/kishu27/Developer/projects/MyProject/src/com/myproject/android/fragments/SettingsFragment.java:28: modifier private static not allowed here [javac] private static final String LOG_TAG = SettingsFragment.class.getSimpleName(); [javac] ^ [javac] /Users/kishu27/Developer/projects/MyProject/src/com/myproject/android/fragments/SettingsFragment.java:29: modifier public static not allowed here [javac] public static final String KEY_OPTIONS = LOG_TAG + ".Options"; [javac] ^ [javac] /Users/kishu27/Developer/projects/MyProject/src/com/myproject/android/fragments/SettingsFragment.java:30: modifier public static not allowed here [javac] public static final String KEY_CAT = LOG_TAG + ".Cat"; [javac] ^ Does anyone have any idea what might be wrong?
type: UnansweredQuestion
tagged with: android
tagged with: apk
answer count: 0
tagged with: java

http://stackoverflow.com/q/22757296
has comment: http://stackoverflow.com/comment/34690923
has comment: http://stackoverflow.com/comment/34690786
upvote count: 1
has answer: http://stackoverflow.com/a/22757442
has answer: http://stackoverflow.com/a/22757421
has answer: http://stackoverflow.com/a/22757475
tagged with: java
accepted answer: http://stackoverflow.com/a/22757421
answer count: 4
type: AnsweredQuestion
downvote count: 0
score: 1
favorite count: 0
possible better answer: http://stackoverflow.com/a/22757380
type: Question
has body: I need to change a string as follow : Adding a "\" before any founded special character here an example : If the string = ${Name} the result should be ===> \${NAME} I wrote this : private static String getFormattedString(String variable) { char [] specialCharacters = {'.', '\\', '+', '*', '?', '[', '^', ']', '$', '(', ')' ,'{' ,'}', '=', '!', '&lt;', '&gt;', '|', ':', '-'}; String old = variable; String formatted = ""; int i=0; while(i&lt;old.length()) { for (int j=0;j&lt;specialCharacters.length;j++) { if (old.charAt(i) == specialCharacters[j]) { formatted+=old.substring(0, i)+"\\"+old.substring(i, i+1); old=variable.substring(i+1,variable.length()); break; } } i++; } return formatted; } But i'm getting a wrong result : Formatted String : ++++&gt; \${NAME\} I'm really confused, any idea will be appreciated.
has title: Insert a character in a String before a specific character
has answer: http://stackoverflow.com/a/22757380
has comment: http://stackoverflow.com/comment/34690846
has comment: http://stackoverflow.com/comment/34690890

http://stackoverflow.com/comment/34580642
comment on: http://stackoverflow.com/q/22696243
type: QuestionComment
type: Comment
score: 0
has text: Use a HashSet to hold the Strings. It doesn't allow duplicates. If you try to add(yourString) it'll return true if it's not in the set, false if it is already there. The HashSet can grow to accommodate more elements.

http://stackoverflow.com/a/22668358
answers question: http://stackoverflow.com/q/22664681
has body: Try replacing import javax.transaction.Transactional; with import org.springframework.transaction.annotation.Transactional;
score: 4
upvote count: 4
type: AcceptedAnswer
downvote count: 0
accepted answer of: http://stackoverflow.com/q/22664681
type: Answer

http://stackoverflow.com/q/22798347
type: Question
has answer: http://stackoverflow.com/a/22798421
downvote count: 0
favorite count: 0
has answer: http://stackoverflow.com/a/22801769
answer count: 3
has title: Android: Linking Edit Text field to button
has body: I am creating a times tables app, in which one of the activities allows the user to enter which times tables they would like to view, then the app will bring up that times tables.(e.g. 6x5=30) etc. Below is the xml layout I have created for the activity: &lt;?xml version="1.0" encoding="utf-8"?&gt; &lt;LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent" android:layout_height="match_parent" android:orientation="vertical" android:padding="15dp"&gt; &lt;TextView android:id="@+id/tvTop" android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="I want to see the: " android:textSize="25dp" /&gt; &lt;EditText android:id="@+id/etEnterNumber" android:layout_width="fill_parent" android:layout_height="wrap_content" android:ems="10" android:hint="Enter Number..." &gt; &lt;/EditText&gt; &lt;TextView android:id="@+id/tvBottom" android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="Times tables!" android:textSize="25dp" /&gt; &lt;Button android:id="@+id/btnGo" android:layout_width="50dp" android:layout_height="50dp" android:text="Go" android:layout_gravity="center"/&gt;r &lt;/LinearLayout&gt; And this it the java class I have created thus far for the classes functionalitiy: public class ViewTimesTables extends Activity implements View.OnClickListener { // Declaring Vars Button go; EditText enterNumber; TextView top; TextView bottom; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); // setting equal to text layout View setContentView(R.layout.view); // calling method to intialise vars initialiseVars(); }// on create end /** * method to initialise all of the buttons, textviews etc used to clean up * the onCreate. */ private void initialiseVars() { // Setting up (initialising) all the buttons text views etc from the xml // (vid 25) go = (Button) findViewById(R.id.btnGo); enterNumber = (EditText) findViewById(R.id.etEnter…
tagged with: android
possible better answer: http://stackoverflow.com/a/22801507
score: 2
tagged with: android-edittext
has comment: http://stackoverflow.com/comment/34771845
upvote count: 2
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/22798421
tagged with: java
has answer: http://stackoverflow.com/a/22801507
tagged with: switch-statement

http://stackoverflow.com/a/22746965
answers question: http://stackoverflow.com/q/22746617
type: Answer
has body: Everything costs something. If adding another class variable, it will cost in two ways. First some bytes for your declaration in the class when it is loaded and then for each reference another 4 bytes. This is because you class definition must be loaded into memory (permanent, permgen space) and because every reference is unique on your stack the 4 bytes per reference.
upvote count: 2
score: 2
type: AcceptedAnswer
downvote count: 0
accepted answer of: http://stackoverflow.com/q/22746617

playframework-2.0
tags question: http://stackoverflow.com/q/22779742
tags question: http://stackoverflow.com/q/22703853
tags question: http://stackoverflow.com/q/22662824
tags question: http://stackoverflow.com/q/22653475
tags question: http://stackoverflow.com/q/22704418
tags question: http://stackoverflow.com/q/22791538
tags question: http://stackoverflow.com/q/22653130
tags question: http://stackoverflow.com/q/22766493
type: Tag
tags question: http://stackoverflow.com/q/22788108
tag name: playframework-2.0

http://stackoverflow.com/q/22681013
type: Question
tagged with: pki
upvote count: 1
has comment: http://stackoverflow.com/comment/34563151
favorite count: 0
has comment: http://stackoverflow.com/comment/34561889
answer count: 0
downvote count: 0
has comment: http://stackoverflow.com/comment/34558874
type: UnansweredQuestion
has title: PKIOperation via SCEP: Message too short
has comment: http://stackoverflow.com/comment/34581864
tagged with: x509certificate
tagged with: certenroll
tagged with: openscep
has comment: http://stackoverflow.com/comment/34561597
score: 1
tagged with: java
has comment: http://stackoverflow.com/comment/34554522
has body: I'm running an OpenSCEP Server and try to enrol a certificate on an JSCEP-Client. When it comes to the PKIOperation I end up with a request like this http://[my_openscep_server]/cgi-bin/pkiclient.exe?operation=PKIOperation&amp;message=%5BB%406c4cbf96 where the message is obviously not correct, but I don't know why. I took jscep-2.0.2-sources, bcpkix-jdk15on-1.50.jar and bcprov-jdk15on-1.50.jar. The JSCEP-documentation does not seem to fit the version so the current Test-code, created with input from various sources, looks like this: URL server = new URL("http://[my_openscep_server]/cgi-bin/pkiclient.exe"); KeyPair keyPair = KeyPairGenerator.getInstance("RSA").generateKeyPair(); char[] keyPw = "somePW".toCharArray(); SecretKeyFactory factory = SecretKeyFactory.getInstance(FACTORY_ALGORITHM, PROVIDER); KeySpec spec = new PBEKeySpec(keyPw, SecureRandom.getSeed(50), 65536, 128); SecretKey tmp = factory.generateSecret(spec); KeyStore ks = KeyStore.getInstance("JCEKS", "SunJCE"); ks.load(null, keyPw); ks.setEntry("someAlias", new SecretKeyEntry(tmp), new KeyStore.PasswordProtection(keyPw)); X500Name entityName = new X500Name("DN=someDN"); Calendar calendar = Calendar.getInstance(); calendar.add(Calendar.HOUR, -1); Date notBefore = calendar.getTime(); calendar.add(Calendar.HOUR, 4); Date notAfter = calendar.getTime(); X509v3CertificateBuilder certBuilder = new X509v3CertificateBuilder(entityName, BigInteger.valueOf( new Date().getTime()).abs(), notBefore, notAfter, entityName, SubjectPublicKeyInfo.getInstance(keyPair .getPublic().getEncoded())); ContentSigner cs = new JCESigner(keyPair.getPrivate(), "SHA256withRSA"); byte[] certBytes = certBuilder.build(cs).getEncoded(); CertificateFactory certificateFactory = CertificateFactory.getInstance("X.509"); X509Certificate certificate = (X509Certificate)certificateFactory.generateCertificate(new ByteArrayInputStream(certBytes)); PKCS10CertificationRequestBuilder crb = new JcaPKCS10CertificationRequestBuilder( certificate.getSubje…
has comment: http://stackoverflow.com/comment/34562071

http://stackoverflow.com/q/22685879
has comment: http://stackoverflow.com/comment/34605014
tagged with: activemq-classic
score: 1
tagged with: java
type: Question
has body: Good day I am using ActiveMQ 5.7 in a standalone configuration. I have a server application that has an embedded broker. The server "produces" tasks and places them on a persistent queue. One or more clients are connecting to the broker running in the server application and "consuming" jobs. I am using the following connection string to connect to the broker: failover:(tcp://0.0.0.0:61616)?maxReconnectAttempts=-1 The behaviour I am getting is the following: If the client is started up first, it tries to connect to the server continuously (with incremental backup, etc.) and behaves exactly as expected. If the server is than started up, the client connects successfully and everything works well. If the server is now terminated, the client logs the lost connection and retries to connect as before. However, it only reties to connect 10 times and then terminates. I don't understand this behaviour as -1 means infinite. If I change the -1 to, say, 5, the client attempts 5 times to reconnect and then terminates (as expected). Any amount above 10 is simply ignored. It is as if 10 has become this magical barrier. Any suggestions?
downvote count: 0
tagged with: failover
has title: ActiveMQ failover not working as expected
favorite count: 0
answer count: 0
type: UnansweredQuestion
upvote count: 1

http://stackoverflow.com/comment/34756178
type: AnswerComment
has text: It works now ! I can't believe that I forgot this part ! Thank you very much
comment on: http://stackoverflow.com/a/22793657
type: Comment
score: 2

http://stackoverflow.com/a/22686387
score: 2
downvote count: 0
upvote count: 2
type: AcceptedAnswer
answers question: http://stackoverflow.com/q/22685997
has comment: http://stackoverflow.com/comment/34562216
has body: Yes, the same string will always generate the same hash-code. Hash-codes do collide, the chance that similar (but different) strings will collide is just very very small (that's the generic idea). Your application should be able to recover (at least not break) from a collision. What are the nature of the strings? Are they only letters? Maximum length? These properties can be used to generate a better hashcode. One of the nicest techniques I know of is Zobrist keys. Depending on the nature of your strings, this may be an option.
accepted answer of: http://stackoverflow.com/q/22685997
type: Answer

http://stackoverflow.com/comment/34736722
type: Comment
comment on: http://stackoverflow.com/q/22783078
score: 3
has text: http://stackoverflow.com/questions/910374/why-does-java-have-transient-variables
type: QuestionComment

http://stackoverflow.com/comment/139534791
score: 0
type: AnswerComment
has text: sure, but the question is about "*IllegalFormatConversionException: d != **java.lang.Double***" and, by the way, your code will also throw an exception: "IllegalFormatConversionException: d != **java.lang.String**"
type: Comment
comment on: http://stackoverflow.com/a/79128506

http://stackoverflow.com/comment/34778182
type: Comment
type: QuestionComment
has text: why you are not using JSON plugin provided by S2 ??
comment on: http://stackoverflow.com/q/22803732
score: 0

http://stackoverflow.com/comment/34503035
type: AnswerComment
has text: @user3462609 don't use sendredirect, se the updated answer. Now it should work.
type: Comment
comment on: http://stackoverflow.com/a/22652054
score: 0

http://stackoverflow.com/comment/34498851
comment on: http://stackoverflow.com/q/22650121
has text: it is the hashCode of the object not its address, btw.
score: 1
type: Comment
type: QuestionComment

http://stackoverflow.com/q/22679913
type: Question
answer count: 2
tagged with: deserialization
has body: I am trying to deserialize the 9 objects of the class Planet which are stored on the planetobject.txt file: But it gives me error that says: java.io.InvalidClassException: Planet; local class incompatible: stream classdesc serialVersionUID = -1020679419761445431, local class serialVersionUID = -3074022091766650572 at java.io.ObjectStreamClass.initNonProxy(Unknown Source) at java.io.ObjectInputStream.readNonProxyDesc(Unknown Source) at java.io.ObjectInputStream.readClassDesc(Unknown Source) at java.io.ObjectInputStream.readOrdinaryObject(Unknown Source) at java.io.ObjectInputStream.readObject0(Unknown Source) at java.io.ObjectInputStream.readObject(Unknown Source) at LA7ex5a.main(LA7ex5a.java:20) Here is the expected output (which I am not getting): Mercury 57910000.0 4880.0 3.30e23 Venus 108200000.0 12103.6 4.869e24 Earth 149600000.0 12756.3 5.972e24 Mars 227940000.0 6794.0 6.4219e23 Jupitor 778330000.0 142984 1.900e27 Saturn 1429400000.0 120536 5.68e26 Uranus 2870990000.0 51118.0 8.683e25 Neptune 4504000000.0 49532.0 1.0247e26 Pluto 5913520000.0 2274.0 1.27e22 I would appreciate it if someone could guide me what the problem is. import java.io.BufferedReader; import java.io.FileInputStream; import java.io.FileOutputStream; import java.io.FileReader; import java.io.IOException; import java.io.ObjectInputStream; import java.io.ObjectOutputStream; import java.util.StringTokenizer; public class LA7ex5a { public static void main(String[] args) throws IOException { ObjectInputStream objectinput = null; Planet [] planet = null; int i=0; try { objectinput = new ObjectInputStream(new FileInputStream("C:/Users/user/workspace/LA7ex5a/src/planetobject.txt")); planet = (Planet[])objectinput.readObject(); planet = (Planet[])objectinput.readObject(); while (i&lt;0) { planet[i].print(); i++; } objectinput.close(); } catch (IOException ex) { ex.printStackTrace(); } catch (ClassNotFoundException ex) { ex.printStackTrace(); } } } . import java.io.Serializable; public class Planet impl…
score: 0
has title: Deserializing objects using a pointer
linked to: http://stackoverflow.com/q/16709017
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/34551440
has comment: http://stackoverflow.com/comment/34551541
has answer: http://stackoverflow.com/a/22680236
has answer: http://stackoverflow.com/a/22680113
tagged with: java
has comment: http://stackoverflow.com/comment/34551375

http://stackoverflow.com/comment/34613937
has text: @namanjain It's not converting; it's telling the compiler that you expect that the object is really a subclass of its declared type. If it's not already the type you try to cast it to, you'll get a `ClassCastException`.
type: AnswerComment
score: 0
type: Comment
comment on: http://stackoverflow.com/a/22714500

http://stackoverflow.com/a/22759136
has comment: http://stackoverflow.com/comment/34694141
downvote count: 0
has comment: http://stackoverflow.com/comment/34694006
has body: Maybe you can try these ones ? UIManager.setLookAndFeel(UIManager.getCrossPlatformLookAndFeelClassName()); UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName()); edit: UIManager.setLookAndFeel("com.sun.java.swing.plaf.windows.WindowsLookAndFeel"); UIManager.setLookAndFeel("com.sun.java.swing.plaf.nimbus.NimbusLookAndFeel");
has comment: http://stackoverflow.com/comment/34694335
type: Answer
score: 2
upvote count: 2
has comment: http://stackoverflow.com/comment/34694835
answers question: http://stackoverflow.com/q/22758459
has comment: http://stackoverflow.com/comment/34694923
has comment: http://stackoverflow.com/comment/34694447
has comment: http://stackoverflow.com/comment/34694992
has comment: http://stackoverflow.com/comment/34695517
has comment: http://stackoverflow.com/comment/34695027
has comment: http://stackoverflow.com/comment/34695571

http://stackoverflow.com/comment/34581979
type: Comment
type: QuestionComment
has text: In image space, what are you rotating relative to what?
comment on: http://stackoverflow.com/q/22696539
score: 0

http://stackoverflow.com/a/22685169
has comment: http://stackoverflow.com/comment/34560679
has body: Putting the jar file into src\main\webapp\WEB-INF\lib is cumbersome, and plainly wrong. The reason that the code does not compile is that maven compiler plugin uses defined source paths and (provided and compile scoped) dependencies. You could change this, but the result would be hard to understand. Also, you would have to update your jar file (which, BTW has no place in your source code) by hand. Thats what dependency management is for. Don't work against your tool. If your project needs classes from this jar, it is a dependency. So declare it as such.
has comment: http://stackoverflow.com/comment/34560648
type: Answer
has comment: http://stackoverflow.com/comment/34560647
score: 3
downvote count: 0
accepted answer of: http://stackoverflow.com/q/22684795
type: AcceptedAnswer
answers question: http://stackoverflow.com/q/22684795
has comment: http://stackoverflow.com/comment/34560481
upvote count: 3

http://stackoverflow.com/q/22786317
type: Question
has comment: http://stackoverflow.com/comment/34743514
tagged with: guice
tagged with: xtend
downvote count: 0
favorite count: 0
has body: I'm getting an error when trying to do unit testing of a DSL parser with Xtext and Xtend. I'm using com.google.inject.Inject and then I do a @Inject extension ParseHelper. This is basically the error: at com.google.inject.internal.Errors.throwCreationExceptionIfErrorsExist(Errors.java:435) at com.google.inject.internal.InternalInjectorCreator.initializeStatically(InternalInjectorCreator.java:154) at com.google.inject.internal.InternalInjectorCreator.build(InternalInjectorCreator.java:106) at com.google.inject.Guice.createInjector(Guice.java:95) at com.google.inject.Guice.createInjector(Guice.java:72) at com.google.inject.Guice.createInjector(Guice.java:62) Any help would be appreciated. Thanks a lot in advance.
has comment: http://stackoverflow.com/comment/34851909
type: UnansweredQuestion
tagged with: xtext
has title: JUnit error: com.google.inject.CreationException: Guice creation errors
score: 2
tagged with: junit4
answer count: 0
upvote count: 2
tagged with: java

http://stackoverflow.com/comment/34534895
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/22670571
has text: yes i want to reverse @avi
score: 0

http://stackoverflow.com/q/22769704
type: AnsweredQuestion
tagged with: java
type: Question
tagged with: hibernate-search
has comment: http://stackoverflow.com/comment/34716308
tagged with: dependency-injection
answer count: 1
has answer: http://stackoverflow.com/a/22782912
score: 0
has body: I use Hibernate Search programmatic api and I have configurable boosting for each entity. Configuration can be read through service which I need to access in mapping factory. Is it possible to get this bean somehow inside SearchMappingFactory? The problem is that spring context is not fully created at the moment the search mapping needs beans from it. public class SearchMappingFactory{ @Factory public SearchMapping getSearchMapping() { SearchMapping searchMapping = new SearchMapping(); // here I need to read configuration using configurationService // ... define mapping ... return searchMapping; } } Then I set this mapping in sessionFactory this way hibernateProperties.put("hibernate.search.model_mapping", SearchMappingFactory.class.getCanonicalName()); I could pass instance of SearchMappingFactory with autowired bean inside but SearchMappingBuilder.getProgrammaticMappingClass does not allow that...
has title: Hibernate Search mapping factory with spring bean injected
accepted answer: http://stackoverflow.com/a/22782912
has comment: http://stackoverflow.com/comment/34732343
tagged with: spring

http://stackoverflow.com/a/22736260
has body: You can simply take your highestNumber and run the code that computes the sequence on it to print it. It will help if you extract the code to a separate method (just a sketch, verify it and modify it yourself): public int checkSequence(int x, boolean print) { int number = x; while(number !=1) { if (print) { System.out.print(number + " "); } if(number % 2 == 0) //even { number = number/2; } else //odd { number = number*3 + 1; } counter++; //counts sequence } return counter; } In your program you will then call checkSequence(x, false) and after you're done you'll call checkSequence(highestNumber, true).
score: 2
downvote count: 0
type: Answer
upvote count: 2
answers question: http://stackoverflow.com/q/22736087
has comment: http://stackoverflow.com/comment/52725758

http://stackoverflow.com/q/22680663
type: AnsweredQuestion
tagged with: java
has answer: http://stackoverflow.com/a/62590261
has answer: http://stackoverflow.com/a/61838557
has body: I updated my JHipster installation as per this page by running the command npm update -g generator-jhipster But to update my application I am not sure where should I run the next command yo jhipster. I tried running it from the root of existing project, but it asked me to enter the name of the new project. I tried running it at one level above the root of existing project, then also it asked me the name of the new project. But this time I entered the same name and the jhipster generation process ran. However there was no change in any of the major files like package.json or Gruntfile.js or bower.json What is the correct way to update a JHipster project, once the JHipster generator is updated?
score: 17
type: Question
has answer: http://stackoverflow.com/a/36979473
possible better answer: http://stackoverflow.com/a/30572331
has answer: http://stackoverflow.com/a/38493708
tagged with: jhipster
has answer: http://stackoverflow.com/a/53513796
downvote count: 0
answer count: 7
upvote count: 17
favorite count: 0
has title: How to update the JHipster project after updating JHipster generator?
has answer: http://stackoverflow.com/a/22713837
accepted answer: http://stackoverflow.com/a/22713837
tagged with: spring
tagged with: yeoman-generator
has answer: http://stackoverflow.com/a/30572331

http://stackoverflow.com/a/22698016
downvote count: 0
answers question: http://stackoverflow.com/q/22697846
score: 3
type: Answer
upvote count: 3
has body: You could start by looking at How to write a Mouse Listener and the JavaDocs for MouseEvent in particular, the getButton method. However, there are cross platform considerations that need to taken into consideration, which are overed by SwingUtilities.isLeftMouseButton and equivalent methods...

http://stackoverflow.com/q/22749570
has answer: http://stackoverflow.com/a/27489210
tagged with: dependencies
has answer: http://stackoverflow.com/a/22764683
type: AnsweredQuestion
downvote count: 0
tagged with: java
tagged with: wildfly
has answer: http://stackoverflow.com/a/25657716
tagged with: web-services
score: 9
type: Question
tagged with: jndi
answer count: 6
has body: this is the first time I am trying to setup datasource in my Wildfly server. I tried to follow some tutorials which I found on Google but it still doesn't work. I am working on a web service but I keep getting some errors when I deploy my .war file. Here is the latest log when app is deployed: 22:16:33,049 INFO [org.jboss.as.server.deployment] (MSC service thread 1-2) JBAS015877: Stopped deployment IslamicPostsWS.war (runtime-name: IslamicPostsWS.war) in 7ms 22:16:33,184 INFO [org.jboss.as.server] (XNIO-1 task-2) JBAS018558: Undeployed "IslamicPostsWS.war" (runtime-name: "IslamicPostsWS.war") 22:16:33,186 INFO [org.jboss.as.controller] (XNIO-1 task-2) JBAS014774: Service status report JBAS014777: Services which failed to start: service jboss.deployment.unit."IslamicPostsWS.war".POST_MODULE 22:16:35,518 INFO [org.jboss.as.server.deployment] (MSC service thread 1-6) JBAS015877: Stopped deployment IslamicPostsWS (runtime-name: IslamicPostsWS) in 7ms 22:16:35,660 INFO [org.jboss.as.server] (XNIO-1 task-6) JBAS018558: Undeployed "IslamicPostsWS" (runtime-name: "IslamicPostsWS") 22:16:38,358 INFO [org.jboss.as.server.deployment.scanner] (DeploymentScanner-threads - 2) JBAS015018: Deployment IslamicPostsWS was previously deployed by this scanner but has been removed from the server deployment list by another management tool. Marker file C:\Users\Ilhami\workspace-services\.metadata\.plugins\org.jboss.ide.eclipse.as.core\WildFly_8.0_Runtime_Server1396040937545\deploy\IslamicPostsWS.undeployed is being added to record this fact. 22:17:00,406 INFO [org.jboss.as.server.deployment] (MSC service thread 1-7) JBAS015876: Starting deployment of "IslamicPostsWS.war" (runtime-name: "IslamicPostsWS.war") 22:17:00,540 ERROR [org.jboss.as.controller.management-operation] (DeploymentScanner-threads - 2) JBAS014613: Operation ("deploy") failed - address: ([("deployment" => "IslamicPostsWS.war")]) - failure description: { "JBAS014771: Services with missing/unavailable dependencies" => ["jbo…
has answer: http://stackoverflow.com/a/28793467
has title: Wildfly configuration with DataSource
has answer: http://stackoverflow.com/a/24797924
has answer: http://stackoverflow.com/a/24358050
possible better answer: http://stackoverflow.com/a/27489210
favorite count: 0
accepted answer: http://stackoverflow.com/a/22764683
upvote count: 9

http://stackoverflow.com/comment/125375259
type: Comment
comment on: http://stackoverflow.com/a/35788753
score: 0
type: AnswerComment
has text: Mr @mentya, I have the problem related to this thread, mind you visit to here? https://stackoverflow.com/questions/70921122/how-to-import-twitter-data-directly-into-database-from-crawling-by-geocode-with thanks before

http://stackoverflow.com/comment/34655237
score: 0
type: AnswerComment
has text: my array does not contain only number, it contains the first names, last names and ages of 4 employees. I want to add the ages of 3 employees after I've deleted one of the employees information.
type: Comment
comment on: http://stackoverflow.com/a/22737594

http://stackoverflow.com/a/29323668
has comment: http://stackoverflow.com/comment/74151509
has comment: http://stackoverflow.com/comment/111363316
has comment: http://stackoverflow.com/comment/47509085
has comment: http://stackoverflow.com/comment/79193910
upvote count: 46
has body: For intellij 13, Simply change the Project language level itself to 8.0 with following navigation. File | | ---------Project Structure -> Project tab | |________Project language level Module lang level I also had to update Modules lang level when there was no maven plugin for java compiler. File | | ---------Project Structure -> Modules tab | |________ language level But this Module lang level would automatically be fixed if there's already a maven plugin for it, org.apache.maven.plugins maven-compiler-plugin 3.6.0 1.8 1.8 After changes everything looks good
score: 45
type: Answer
downvote count: 1
answers question: http://stackoverflow.com/q/22703412

http://stackoverflow.com/comment/34598743
score: 0
type: Comment
comment on: http://stackoverflow.com/q/22706042
type: QuestionComment
has text: @Jon Skeet: giving error means it is not giving me correct result like string contain character then it is giving false result and if character is not present then giving true in checking condition.

http://stackoverflow.com/comment/34598068
type: Comment
comment on: http://stackoverflow.com/a/22701365
has text: @MirroredFate thing is in my `paintComponent` I'm drawing shapes on my JPanel and then I check if I've got data to load and if I do, I'm drawing something else. The problem is, the first call of `paintComponent` call my drawSmth methods but nothing appear, and so, when it's trying to draw something else it fails since it's based on what was previously drawn. It's kind of hard to explain but in my case the first call does absolutely nothing, and that's why I need to use a boolean to be sure things have been drawn at least once.
type: AnswerComment
score: 0

http://stackoverflow.com/comment/34701123
type: QuestionComment
score: 1
has text: What's wrong with having a look at the Infinispan site? It took me less than two minutes to find this link ["Maven users"](http://infinispan.org/docs/7.0.x/getting_started/getting_started.html#_maven_users). There is also a quick start tutorial you can download and use as reference.
comment on: http://stackoverflow.com/q/22758327
type: Comment

http://stackoverflow.com/a/22767112
accepted answer of: http://stackoverflow.com/q/22765009
answers question: http://stackoverflow.com/q/22765009
upvote count: 2
type: AcceptedAnswer
downvote count: 0
has body: The Switch Statement is absolutely not what you want in this case. Even if the above example worked, and it does not for a reason, your results would be completely wrong. The switch on an enum is using the enum ordinal, which is 0 for Enum1.A, 1 for Enum1.B, 0 for Enum2.C, and 1 for Enum2.D using your classes above. You can see why this would be a really bad idea. Your EnumInterface class is not tied of the Java type enum in any way, it just defines any class that implements it and provides your getTitle() method. This could be Enum1, Enum2, or any other class that might not even be an Enum. So when you want to switch based on the EnumInterface, you need to ask yourself what you actually want to switch on. Is it the title you want to be using as your conditional, or do the enums you defined bring something else to the table? Now, I'm going to give you the benefit of the doubt and assume that whatever you are trying to do, it needs to be keyed off of an Enum. I will also assume that you cannot combine Enum1 or Enum2 for whatever reason. Below is my completely over-engineered solution for you: public interface EnumInterface { public String getTitle(); public void processEvent(SwitchLogicClass e); } public enum Enum1 implements EnumInterface{ A("Apple"){ public void processEvent(SwitchLogicClass e){ //Any A specific Logic e.doSomethingA(); } }, B("Ball"){ public void processEvent(SwitchLogicClass e){ //Any B specific Logic e.doSomethingB(); } }; private String title; Enum1(String title){ this.title = title; } @Override public String getTitle(){ return title; } } Repeat for Enum2. Assume that the next class is called SwitchLogicClass private EnumInterface[] enumList;//declared globally. if(flagTrue){ enumList = Enum1.values(); }else{ enumList = Enum2.values(); } .... .... private method1(int position){ EnumInterface[position].processEvent(this); } public void doSomethingA(){ //Whatever you needed to switch on A for } public void doSomethingB(){ //Whatever you needed to …
type: Answer
score: 2

http://stackoverflow.com/q/22743594
has comment: http://stackoverflow.com/comment/34665710
answer count: 1
tagged with: arrays
downvote count: 0
linked to: http://stackoverflow.com/q/4372439
favorite count: 0
tagged with: arraylist
has answer: http://stackoverflow.com/a/22743685
has title: Convert ArrayList<ArrayList<Object>> to Object[][]
accepted answer: http://stackoverflow.com/a/22743685
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/34665734
upvote count: 1
type: Question
tagged with: object
score: 1
tagged with: java
has body: I would like to populate a JTable with the cnstructor like this : new JTable(datas, columns); so I need an Object[] for the columns and a Object[][] for the datas. The problem is when I try to get the datas. In one of my method I work with an ArrayList&lt;ArrayList&lt;Object&gt;&gt; and I would like to cast it to an Object[][]. Here's a sample of my code : ArrayList&lt;ArrayList&lt;Object&gt;&gt; datas = new ArrayList&lt;ArrayList&lt;Object&gt;&gt;(); for (Map.Entry&lt;Integer, JSObject&gt; entry : params.entrySet()) { datas.add(entry.getValue().getValues()); // getValues returns an ArrayList&lt;Object&gt; } return new datas.toArray(); // not seems to work I saw in this question Convert ArrayList&lt;Object[]&gt; to Object[][] some idea, but I'm not sure about the result. Thanks in advance !
has comment: http://stackoverflow.com/comment/34665752

http://stackoverflow.com/q/22676950
type: Question
has comment: http://stackoverflow.com/comment/34546306
has title: org.apache.jasper.JasperException: Unable to compile class for JSP.
score: 0
linked to: http://stackoverflow.com/q/5818101
answer count: 1
has answer: http://stackoverflow.com/a/22676981
tagged with: java
has body: org.apache.jasper.JasperException: Unable to compile class for JSP: An error occurred at line: 176 in the jsp file: /encrypted.jsp gn cannot be resolved 173: 174: 175: Generated Key- 176: <input type="text" name="Gnkey" value="<%=gn%>"/> 177: 178: the gn variable is used to store a output from a function <% String gn = generateKey(SelectedIndex, key, itt); %> how to resolve this error?
tagged with: jstl
type: AnsweredQuestion
tagged with: jsp
accepted answer: http://stackoverflow.com/a/22676981

http://stackoverflow.com/comment/34545872
comment on: http://stackoverflow.com/a/22676557
type: Comment
score: 0
type: AnswerComment
has text: Thank you so much, I was surprised at how fast you answered!

http://stackoverflow.com/comment/34680954
type: Comment
comment on: http://stackoverflow.com/a/22751114
has text: sorry about that, i made a few more changes and uploaded the new log. Im wondering if it has to do with context. if im calling from Route.java should the line look like this: DatabaseManager dbManager = new DatabaseManager(Route.this, "dbSkyTrain.dbf", null, 1);
type: AnswerComment
score: 0

http://stackoverflow.com/q/22688682
has comment: http://stackoverflow.com/comment/34566460
linked to: http://stackoverflow.com/q/22691435
favorite count: 0
has comment: http://stackoverflow.com/comment/34567396
answer count: 5
has comment: http://stackoverflow.com/comment/34566849
linked to: http://stackoverflow.com/q/2748749
downvote count: 2
has answer: http://stackoverflow.com/a/22688803
has comment: http://stackoverflow.com/comment/34566325
has comment: http://stackoverflow.com/comment/34566463
has comment: http://stackoverflow.com/comment/34567456
has title: What is the best algorithm for sorting 12 items
score: 2
has answer: http://stackoverflow.com/a/22698241
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/22688819
possible better answer: http://stackoverflow.com/a/22688803
has comment: http://stackoverflow.com/comment/34566342
has comment: http://stackoverflow.com/comment/34566600
tagged with: java
has comment: http://stackoverflow.com/comment/34566423
has comment: http://stackoverflow.com/comment/34566569
has answer: http://stackoverflow.com/a/22690616
type: Question
has comment: http://stackoverflow.com/comment/34566792
tagged with: performance
tagged with: algorithm
has answer: http://stackoverflow.com/a/22691268
has comment: http://stackoverflow.com/comment/34566734
tagged with: sorting
has comment: http://stackoverflow.com/comment/34566321
has comment: http://stackoverflow.com/comment/34566634
has body: I need to sort array of integers between startIndex to startIndex + 12. This operation is critical for my performance. What algorithm do you suggest me to use? Right now I am using Bubble sort and it's not performing so well... Update: Sorry for missing details. I am working with random arrays. I do this action very often, I am working in Java. Update 2: I am not sure that insertion sort is good idea as I am using native arrays and not ArrayList. So I need to implement the insertion by my self or combine it with bubble search some how.
has comment: http://stackoverflow.com/comment/34566629
upvote count: 4
has comment: http://stackoverflow.com/comment/34566694
has comment: http://stackoverflow.com/comment/34567093
has answer: http://stackoverflow.com/a/22688819

http://stackoverflow.com/comment/34760093
type: QuestionComment
has text: I'd let the method throw the exception
score: 0
comment on: http://stackoverflow.com/q/22791828
type: Comment

http://stackoverflow.com/comment/34763836
type: Comment
has text: Er... what data types are the variables currently if they keep leading zeroes?
type: QuestionComment
score: 2
comment on: http://stackoverflow.com/q/22797801

http://stackoverflow.com/q/22716594
has title: How to port the local development to a shared web server
type: Question
has body: I've done some development on my local using liferay 6.2, Apache Tomcat server using Java 7. I am provided with a shared web server where i can see java 6 is installed. I am doing this for the first time, Can some1 please provide any relevant help for porting my local application to this web server? My target is to make sure the code which is accessible to me by localhost:8080 should now be available by url-of-the-web-server:8080 So far, I have copied my liferay folder on the web server. When I am trying to run the startup.sh file using putty, it just gives this - Using CATALINA_BASE: /home/user/liferay/tomcat-7.0.42 Using CATALINA_HOME: /home/user/liferay/tomcat-7.0.42 Using CATALINA_TMPDIR: /home/user/liferay/tomcat-7.0.42/temp Using JRE_HOME: /usr/local/jdk1.6.0_37 Using CLASSPATH: /home/user/liferay/tomcat-7.0.42/bin/bootstrap.jar:/home/user/liferay/tomcat-7.0.42/bin/tomcat-juli.jar I am not able to access anything using http://url-of-the-web-server:8080
tagged with: java
upvote count: 1
tagged with: liferay
type: UnansweredQuestion
answer count: 0
downvote count: 0
score: 1
tagged with: tomcat
favorite count: 0

datetimepicker
type: Tag
tag name: datetimepicker
tags question: http://stackoverflow.com/q/22784523

http://stackoverflow.com/comment/45747994
comment on: http://stackoverflow.com/q/22725537
type: Comment
has text: @skiwi Well, `Optional.stream` exists in JDK 9 now....
type: QuestionComment
score: 21

http://stackoverflow.com/q/22792505
answer count: 1
tagged with: lucene
score: 0
has body: I would like to know how to restrict the search of a query within a set of docids. So far, I am able to output a list of the docids from a search to an array (or text file). I would like to search for other terms but limiting the results within this list of documents. Please be descriptive in your answer considering I am a java newbie. I dont understand most of the javadocs covering the filter/filtereddocidset/docidset in the lucene website. Thank you very much
has answer: http://stackoverflow.com/a/22806707
type: UnansweredQuestion
tagged with: java
has title: Java - Lucene - How to filter a search using an array of docids
type: Question
has comment: http://stackoverflow.com/comment/34755784

http://stackoverflow.com/comment/34633937
type: Comment
type: QuestionComment
has text: If you generate the .c file with javah, then edit your code into it, then you decide to change the method signature so you rerun javah, you risk losing the code you wrote.
comment on: http://stackoverflow.com/q/22700088
score: 0

taskmanager
tags question: http://stackoverflow.com/q/22652692
tag name: taskmanager
type: Tag

http://stackoverflow.com/q/22739255
type: AnsweredQuestion
has body: I have run into a problem on a piece of homework I have. I've had to make my own Shape, Circle and Rectangle classes. The problem is when a Point object is inputted into a circle and rectangle, the Shape class won't accept it in the constructor for a new shape object. So when I run the main program, the coordinates of the centre of the circle and top corner of the rectangle are null instead of the inputted coordinates. How can I get Shape to accept the point coordinates? (Sorry if the codes/terminology's wrong, I'm still new to Java) My shape class: public class Shape { private int sides; private Color colour; private Point coordinates; public Shape (int sides, Point coordinates, Color colour) { this.sides = sides; this.colour = colour; this.coordinates = coordinates; } My Circle class: public class Circle extends Shape { private Point center; private int radius; //constructor for circle class public Circle(Point center, int radius, Color c) { super(0, center, c); this.radius = radius; My rectangle class: public class Rectangle extends Shape { private int sides = 4; private Point topCorner; private int width, length; //Constructor for rectangle public Rectangle(Point topCorner, int width, int length, Color c) { super(4, topCorner, c); this.width = width; this.length = length; } My main class: public static void main(String[] args) { Point p1 = new Point(0,20); Point p2 = new Point(20,0); Point p3 = new Point(30,30); Shape r = new Rectangle(p1, 10, 15, Color.BLUE); Shape c = new Circle (p3, 25, Color.YELLOW);
tagged with: java
type: Question
has title: Shape objects won't accept inputted coordinates
has answer: http://stackoverflow.com/a/22739274
answer count: 1
favorite count: 0
score: 0
accepted answer: http://stackoverflow.com/a/22739274
upvote count: 1
downvote count: 1

http://stackoverflow.com/comment/34763233
type: AnswerComment
comment on: http://stackoverflow.com/a/22797219
type: Comment
has text: @user3478869 Yes, an array with 10,000 integers between `1` and `1000` will necessarily have duplicates. *On average*, each integer will be repeated ten times in a uniform random distribution. What my suggestion does is formalize that fact by creating a sorted array that conststs of ten 1s, ten 2s, ten 3s... all the way up to ten 1000s.
score: 0

http://stackoverflow.com/a/22804563
has comment: http://stackoverflow.com/comment/137897924
type: Answer
has comment: http://stackoverflow.com/comment/75665860
has comment: http://stackoverflow.com/comment/137910213
has body: You are using the wrong method for reading the cookies.. Cookie[] cookies = request.getCookies(); if (cookies != null) { for (Cookie cookie : cookies) { if (cookie.getName().equals("cookieName")) { //do something //value can be retrieved using #cookie.getValue() } } } use this. No need to detect the cookie for particular user just deactivate it.
upvote count: 43
has comment: http://stackoverflow.com/comment/66705218
score: 42
has comment: http://stackoverflow.com/comment/34775958
has comment: http://stackoverflow.com/comment/73529392
has comment: http://stackoverflow.com/comment/66741795
type: AcceptedAnswer
downvote count: 1
accepted answer of: http://stackoverflow.com/q/22804409
answers question: http://stackoverflow.com/q/22804409

http://stackoverflow.com/a/22765546
answers question: http://stackoverflow.com/q/22765326
has comment: http://stackoverflow.com/comment/34707660
has body: UPDATE: I didn't notice the "not first character" requirement. Updated to find the first vowel AFTER the first letter. A much more interesting regex. :) I don't know about a one-liner, but this works and is pretty concise. Since it compiles the pattern and creates the matcher only once, I think it's as fast and efficient as you're going get with regular expressions: import java.util.regex.Matcher; import java.util.regex.Pattern; public class PrimevaVocal { //"": Unused to-search string so the matcher can be reset (and reused). private static final Matcher MTCHR_VOWEL = Pattern.compile( "\\b\\w[^aeiou]*([aeiou])", Pattern.CASE_INSENSITIVE).matcher(""); //Alternate and more elegant regex, thanks //to @GarisMSuero: "[\\w]([aeiou])" public static final void main(String[] ignored) { System.out.println(primevaVocal("Speller")); System.out.println(primevaVocal("Estinshtien")); System.out.println(primevaVocal("Xyz")); } public static final Character primevaVocal(String to_search) { return (!MTCHR_VOWEL.reset(to_search).find() ? '!' : MTCHR_VOWEL.group(1).charAt(0)); } } Output: [C:\java_code\]java PrimevaVocal e i !
downvote count: 0
type: Answer
has comment: http://stackoverflow.com/comment/34706592
score: 1
upvote count: 1

http://stackoverflow.com/comment/34654824
score: 1
comment on: http://stackoverflow.com/q/22737415
type: QuestionComment
type: Comment
has text: It throws an exception because you told it to throw an exception.

http://stackoverflow.com/q/22654937
type: Question
tagged with: mobile
score: 0
answer count: 3
has title: How to hide the Android Keyboard for all activities
tagged with: keyboard
type: UnansweredQuestion
tagged with: android
has body: I want to create an activity that will hide the keyboard. The activity will keep on running in the background as a service and prevent the keyboard from being visible for all the apps. As in the keyboard will not come up unless the activity is stopped. Can anyone point me towards the correct source?
tagged with: java
has answer: http://stackoverflow.com/a/22657744
has answer: http://stackoverflow.com/a/22654966
has answer: http://stackoverflow.com/a/22655034

http://stackoverflow.com/a/22696140
has body: Try flushing the outputstream: dataOutputStream.writeUTF("on"); dataOutputStream.flush(); You also might want to close it when you're done.
upvote count: 1
answers question: http://stackoverflow.com/q/22695924
type: Answer
downvote count: 0
score: 1

hql
tags question: http://stackoverflow.com/q/22787137
tag name: hql
tags question: http://stackoverflow.com/q/22655531
type: Tag
tags question: http://stackoverflow.com/q/22795359
tags question: http://stackoverflow.com/q/22740267
tags question: http://stackoverflow.com/q/22766109

http://stackoverflow.com/comment/34674973
has text: @fge I know how volatile works:) But that race condition when other threads reads the old value lasts for milliseconds. The schedule updates the content in every 30 seconds... do you really feel the need of AtomicReference?:D
type: Comment
comment on: http://stackoverflow.com/a/22747707
score: 0
type: AnswerComment

http://stackoverflow.com/comment/34572144
type: Comment
comment on: http://stackoverflow.com/q/22691718
score: 0
type: QuestionComment
has text: `string.substring(0,2)+"00"+string.substring(4);`

http://stackoverflow.com/comment/34735457
score: 0
type: Comment
type: QuestionComment
has text: Add null checks. For example if( buff != null)
comment on: http://stackoverflow.com/q/22781951

http://stackoverflow.com/comment/34685430
type: Comment
comment on: http://stackoverflow.com/a/22750182
type: AnswerComment
has text: nope, others just simply do not parse any of the record
score: 0

http://stackoverflow.com/comment/34673544
has text: Did I say "Hot Rembo" ?? In any case, thank you. I commented out that section and everything worked. Care to write an answer I can accept?
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/22743380

http://stackoverflow.com/comment/34640112
type: AnswerComment
score: 0
type: Comment
has text: i even changed to String t1=text1.getText(); int id=Integer.parseInt(t1); "Update Out_Patient Set First_Name=?,Last_Name=?,Gender=?,Mobile_Number=?,Address=?,Date_Of_Birth=?,Date_Of_Entry=? where Patient_ID=id" Then i got: Invalid identifier ID
comment on: http://stackoverflow.com/a/22729032

http://stackoverflow.com/comment/34670071
comment on: http://stackoverflow.com/q/22745702
score: 0
type: QuestionComment
has text: @zahz check my answer for using regex to match all the punctuation marks using one `if` condition.
type: Comment

http://stackoverflow.com/comment/34664653
has text: Isn't that what you wanted?
comment on: http://stackoverflow.com/a/22742574
type: AnswerComment
score: 0
type: Comment

http://stackoverflow.com/q/22713977
possible better answer: http://stackoverflow.com/a/22715286
accepted answer: http://stackoverflow.com/a/22714138
has comment: http://stackoverflow.com/comment/34615976
has comment: http://stackoverflow.com/comment/34612797
has comment: http://stackoverflow.com/comment/34614067
has answer: http://stackoverflow.com/a/22715286
has comment: http://stackoverflow.com/comment/34614103
tagged with: parsing
type: AnsweredQuestion
upvote count: 1
type: Question
score: 1
tagged with: java
has answer: http://stackoverflow.com/a/22714138
has title: javascript call from java code
has comment: http://stackoverflow.com/comment/34612784
has body: I'm parsing html page that uses javascript function call to show data. I need that data, I know how to parse the page to get function body, but the question is how to call that function from my java program to receive the same data function returns when is called on the site? EDIT: the concrete web page is http://hedonism.co.uk/wines/, function to display wines is called getWines(), I need all wines info.
answer count: 2
linked to: http://stackoverflow.com/q/814757
tagged with: function
downvote count: 0
tagged with: javascript
favorite count: 0

http://stackoverflow.com/a/22700816
has comment: http://stackoverflow.com/comment/60603825
type: Answer
score: 0
has body: It seems you can't use Groovy metaprogramming to replace methods of Java classes - even public methods - try the following in the Groovy console to confirm: ArrayList.metaClass.remove = { obj -&gt; throw new Exception('remove') } ArrayList.metaClass.remove2 = { obj -&gt; throw new Exception('remove2') } def a = new ArrayList() a.add('it') // returns true because the remove method defined by ArrayList is called, // i.e. our attempt at replacing it above has no effect assert a.remove('it') // throws an Exception because ArrayList does not define a method named remove2, // so the method we add above via the metaClass is invoked a.remove2('it') If you can modify the source code of MyClass, I would either make doSomethingCrazyExpensive protected, or preferably, refactor it so that it's more test-friendly public class MyClass { private ClassOfSomeSort property1; private ClassOfSomeOtherSort property2; private CrazyExpensive crazyExpensive; public MyClass(CrazyExpensive crazyExpensive) { this.crazyExpensive = crazyExpensive; } public void init(){ property1 = new ClassOfSomeSort(); property2 = new ClassOfSomeOtherSort(); crazyExpensive.doSomethingCrazyExpensive(); } } public interface CrazyExpensive { public void doSomethingCrazyExpensive(); } After making the changes above, when testing MyClass you can easily instantiate it with a mock/stub implementation of CrazyExpensive.
answers question: http://stackoverflow.com/q/22696098

http://stackoverflow.com/comment/34664248
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/22742617
has text: I mean, can you use the new file API?
score: 0

http://stackoverflow.com/comment/34582493
comment on: http://stackoverflow.com/a/22697179
has text: I will check the response header but I think we are on the right track because I now get the following error when I run it: ??????....lots and lots of question marks...??????? com.google.gwt.xml.client.impl.DOMParseException: Failed to parse: error on line 1 at column 1: Document is empty
score: 0
type: AnswerComment
type: Comment

http://stackoverflow.com/a/22729540
answers question: http://stackoverflow.com/q/22729473
has body: Check case sensitive. 'V' 'v'...
downvote count: 2
upvote count: 0
score: -2
type: Answer

http://stackoverflow.com/comment/34742644
comment on: http://stackoverflow.com/q/22786149
score: 0
type: Comment
type: QuestionComment
has text: @Jeef: Nope, that would also give -23.

http://stackoverflow.com/q/22796176
has body: I need to include src/test/java files to my jar with dependancies. But when I create the jar it fails because it cannot find the classes. Here is the pom section. Any help would be appreciated. And i compile with: mvn clean assembly:single maven-assembly-plugin jar-with-dependencies package single
has answer: http://stackoverflow.com/a/22866570
tagged with: pom.xml
has answer: http://stackoverflow.com/a/22796524
type: UnansweredQuestion
has title: How to modify pom file to add src/test/java files to maven jar with dependancies
tagged with: maven-assembly-plugin
upvote count: 1
tagged with: maven
has comment: http://stackoverflow.com/comment/34760990
linked to: http://stackoverflow.com/q/9752972
score: 1
tagged with: java
type: Question
has comment: http://stackoverflow.com/comment/34760715
has answer: http://stackoverflow.com/a/22796249
downvote count: 0
tagged with: jar-with-dependencies
favorite count: 0
has comment: http://stackoverflow.com/comment/34760856
answer count: 3

http://stackoverflow.com/q/22675796
accepted answer: http://stackoverflow.com/a/22675964
possible better answer: http://stackoverflow.com/a/22675848
score: 0
answer count: 2
has title: mkdir() Java keeps throwing IOException
has comment: http://stackoverflow.com/comment/34544358
has comment: http://stackoverflow.com/comment/34544285
has body: I am trying to create a directory in my current working directory with the title of a url. However, I am converting that url to a hash and then to a hexadecimal so the name of the directory I am trying to create is something like 273212b1. However whenever I execute the code it throws an IOException and cannot make the directory. I am not sure what I am doing wrong. Even if I do something like File directory = new File ("Users/whatever/Documents" + dirname); it doesn't work.
has answer: http://stackoverflow.com/a/22675964
has comment: http://stackoverflow.com/comment/34544340
tagged with: mkdir
tagged with: java
has comment: http://stackoverflow.com/comment/34544252
tagged with: file
type: Question
has comment: http://stackoverflow.com/comment/34544288
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/22675848

http://stackoverflow.com/a/22710870
upvote count: 1
answers question: http://stackoverflow.com/q/22702941
downvote count: 1
has body: Below key points you can google and understand. 1. Trusted certificates and keystores/truststores 2. Concept of private and public key. How browser send the certificate key to server and it gets authenticated. 3. Keytool utility, to convert certificates from one form to another. 4. Importing the trusted certificates and keys to trustore, though java has its "cacerts" file by default, but you can create you own and import certificates into it. 5. Explore certificates, read about thumbprint, algorithms used 6. Create you own custom factory as well.
score: 0
type: Answer

http://stackoverflow.com/comment/34594783
score: 1
has text: assuming you don't want to store it off separately, you could just use a [depth first search](http://en.wikipedia.org/wiki/Depth-first_search) to find the max element in the min heap.
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/22703549

clr
type: Tag
tags question: http://stackoverflow.com/q/22659489
tag name: clr

http://stackoverflow.com/q/22740582
answer count: 3
tagged with: inputstream
has answer: http://stackoverflow.com/a/22740637
accepted answer: http://stackoverflow.com/a/22740637
linked to: http://stackoverflow.com/q/1485708
has title: Java URL Without Protocol
type: AnsweredQuestion
score: 2
downvote count: 0
tagged with: url
favorite count: 0
possible better answer: http://stackoverflow.com/a/22740764
type: Question
has answer: http://stackoverflow.com/a/22740764
has body: I'm trying to open an InputStream to a certain URL as given by the service's API. However, it does not have a set protocol (it's not http or https) and without one, I am getting the following error. Is there any way to get a request without a protocol? Exception: Exception in thread "main" java.net.MalformedURLException: no protocol. Code: String url = "maple.fm/api/2/search?server=1"; InputStream is = new URL(url).openStream(); UPDATE: I now updated the code to: Code: String url = "http://maple.fm/api/2/search?server=1"; InputStream is = new URL(url).openStream(); and now I'm getting the following error: Exception: Exception in thread "main" java.io.IOException: Server returned HTTP response code: 403 for URL: http://maple.fm/api/2/search?server=1
linked to: http://stackoverflow.com/q/13670692
linked to: http://stackoverflow.com/q/4474293
upvote count: 2
has answer: http://stackoverflow.com/a/22740648
tagged with: java

http://stackoverflow.com/a/34973201
type: Answer
has body: Its presence prevents the introduction of a new class of multithreading bugs involving local variables. Local variables in Java have until now been immune to race conditions and visibility problems because they are accessible only to the thread executing the method in which they are declared. But a lambda can be passed from the thread that created it to a different thread, and that immunity would therefore be lost if the lambda, evaluated by the second thread, were given the ability to mutate local variables. Even the ability to read the value of mutable local variables from a different thread would introduce the necessity for synchronization or the use of volatile in order to avoid reading stale data.
answers question: http://stackoverflow.com/q/22777915
score: 0

http://stackoverflow.com/a/22712794
has comment: http://stackoverflow.com/comment/34610933
has comment: http://stackoverflow.com/comment/34610976
type: Answer
has comment: http://stackoverflow.com/comment/34611435
has comment: http://stackoverflow.com/comment/34611510
has comment: http://stackoverflow.com/comment/34610869
upvote count: 1
downvote count: 1
has comment: http://stackoverflow.com/comment/34610581
has comment: http://stackoverflow.com/comment/34611456
answers question: http://stackoverflow.com/q/22712745
score: 0
has body: You should just use a standard regex. I generally use \b[A-Z0-9._%+-]+@[A-Z0-9.-]+\.[A-Z]{2,4}\b. Have a look at http://www.regular-expressions.info/email.html for different examples.

http://stackoverflow.com/comment/34570844
type: AnswerComment
has text: @Ilya: The sorting network could be the fastest, but I bet the hard-coding method would outperform Arrays.sort() by a good bit, just by avoiding method calls and such.
type: Comment
comment on: http://stackoverflow.com/a/22690616
score: 0

http://stackoverflow.com/q/22688519
has answer: http://stackoverflow.com/a/22690062
upvote count: 2
tagged with: java
has title: GWT places and activities - getting duplicate UI
answer count: 1
tagged with: gwt
accepted answer: http://stackoverflow.com/a/22690062
score: 2
type: AnsweredQuestion
downvote count: 0
has comment: http://stackoverflow.com/comment/34568848
favorite count: 0
type: Question
has body: I am new to GWT and trying to implement activities and places. I am facing a problem with the UI. I can't post an image because I am new to Stackoverflow and doesn't have 10 reputation points but I am seeing a panel on the left twice. I have also attached the launcher code and UI binder code. public class SmartEBRM implements EntryPoint { //private Place defaultPlace = new SmartEBRMViewPlace("World!"); @SuppressWarnings("deprecation") @Override public void onModuleLoad() { // TODO Auto-generated method stub ClientFactory clientFactory = GWT.create(ClientFactory.class); EventBus eventBus = clientFactory.getEventBus(); PlaceController placeController = clientFactory.getPlaceController(); // Start ActivityManager for the main widget with our ActivityMapper ActivityMapper activityMapper = new AppActivityMapper(clientFactory); ActivityManager activityManager = new ActivityManager(activityMapper, eventBus); SmartEBRMViewImpl smartViewImpl = new SmartEBRMViewImpl(); activityManager.setDisplay (smartViewImpl.getHTMLPannel()); // Start PlaceHistoryHandler with our PlaceHistoryMapper AppPlaceHistoryMapper historyMapper= GWT.create(AppPlaceHistoryMapper.class); PlaceHistoryHandler historyHandler = new PlaceHistoryHandler(historyMapper); SmartEBRMViewPlace smartViewPlace = new SmartEBRMViewPlace(); historyHandler.register(placeController, eventBus, smartViewPlace); historyHandler.handleCurrentHistory(); RootPanel.get().add(smartViewImpl); } } and public class SmartEBRMViewImpl extends Composite implements SmartEBRMView{ private static SmartEBRMViewImplUiBinder uiBinder = GWT .create(SmartEBRMViewImplUiBinder.class); @UiField DockLayoutPanel docLayoutPanel; @UiField StackPanel stackPanel; @UiField Button enterpriseView; @UiField Button testComponent; @UiField SimplePanel centerPanel; private Presenter listener; interface SmartEBRMViewImplUiBinder extends UiBinder&lt;Widget, SmartEBRMViewImpl&gt; { } public SmartEBRMViewImpl() { initWidget(uiBinder.createAndBindUi(this)); } publi…

http://stackoverflow.com/comment/34628566
type: Comment
comment on: http://stackoverflow.com/q/22721279
score: 0
type: QuestionComment
has text: Sorry, not sure what you need now. You can take a look into `CommonAnnotationBeanPostProcessor`, which has `setJndiFactory` option, which actually is used to resolve `@Resource` annotation.

http://stackoverflow.com/q/22681090
downvote count: 0
tagged with: java
possible better answer: http://stackoverflow.com/a/50706156
has answer: http://stackoverflow.com/a/22681245
accepted answer: http://stackoverflow.com/a/22681245
type: Question
score: 3
has answer: http://stackoverflow.com/a/63925539
upvote count: 3
tagged with: batch-file
answer count: 3
tagged with: jar
has body: I have to run a jar several time in one shot and redirect the output to a different files. so i am using a batch which is as follows : start java -jar app.jar > log1.out ; start java -jar app.jar > log2.out ; start java -jar app.jar > log3.out ; pause it launches the three parallel instance. But output does not get redirected to file, it shows output on console only . Thanks in advance.
favorite count: 0
has answer: http://stackoverflow.com/a/50706156
tagged with: command-line
type: AnsweredQuestion
has title: Output redirection in batch while using start command

http://stackoverflow.com/comment/34566762
score: 0
type: Comment
type: QuestionComment
has text: Go and install Windows 95 (or maybe DOS 5.0 with Windows 3.1).
comment on: http://stackoverflow.com/q/22688688

http://stackoverflow.com/comment/34681251
type: QuestionComment
has text: Yeah, you could debug this with pencil and paper and see what's happening. Unfortunately, @Sotirios has spoiled it for everyone :(
score: 0
comment on: http://stackoverflow.com/q/22751803
type: Comment

http://stackoverflow.com/q/22719576
tagged with: algorithm
has body: I wrote a classic queue floodfill: public static void floodFill(int y, int x, byte originalvalue, byte newvalue, byte[][] arr) { Deque queue = new ArrayDeque(); queue.add(new int[]{y, x}); while (!queue.isEmpty()) { int[] t = (int[]) queue.poll(); y = t[0]; x = t[1]; if (arr[y][x] == originalvalue) { arr[y][x] = newvalue; for (int i = 0; i &lt; 8; i++) { if (x + dx[i] &lt; arr[0].length &amp;&amp; y + dy[i] &lt; arr.length &amp;&amp; x + dx[i] &gt; -1 &amp;&amp; y + dy[i] &gt; -1 &amp;&amp; arr[y + dy[i]][x + dx[i]] == originalvalue) { queue.add(new int[]{y + dy[i], x + dx[i]}); } } } } } And now I want to write scan line Flood Fill, which is much faster. I can't find any pseudocode, and I don't understand this code. Can you help me optimize my flood fill or write scan line one? I call this flood fill for a byte array with dimensions 1000–2000 by 1000–2000 (not necessarily square) for a large area once, and then about 1000 to 1,000,000 times for smaller areas.
has answer: http://stackoverflow.com/a/22720070
has comment: http://stackoverflow.com/comment/34623389
score: 0
answer count: 1
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/34624354
tagged with: java
type: Question
tagged with: flood-fill
has title: Flood Fill scan line

http://stackoverflow.com/comment/34511218
comment on: http://stackoverflow.com/q/22657409
type: QuestionComment
type: Comment
has text: this is simple just parse over all the jsons create User from them and from Post.json assign that post to User
score: 0

http://stackoverflow.com/a/22700035
has comment: http://stackoverflow.com/comment/34655200
score: 3
has comment: http://stackoverflow.com/comment/34633196
has comment: http://stackoverflow.com/comment/34652832
has body: Take a look at Response.getEntity().
has comment: http://stackoverflow.com/comment/100172000
upvote count: 3
answers question: http://stackoverflow.com/q/22696437
type: Answer
has comment: http://stackoverflow.com/comment/34674069
downvote count: 0

http://stackoverflow.com/comment/34663138
has text: Ok, I understand that layout you've provided. However, how would I link players who are occasional coaches as I mentioned in my question?
type: Comment
comment on: http://stackoverflow.com/a/22741525
score: 0
type: AnswerComment

http://stackoverflow.com/comment/34496766
type: Comment
has text: Yep, well. Now its edited and it makes sense.
type: QuestionComment
score: 0
comment on: http://stackoverflow.com/q/22648967

http://stackoverflow.com/q/22766911
has title: Apache Derby: java.sql.SQLSyntaxErrorException
tagged with: sql
answer count: 1
has body: I've just started learning about SQL, and am trying to make a table and fill it with some data I have on an CSV-file. The following is the application trying to do this: public sqlThingy() throws Exception { File spritesheetsCreate = new File("sql/spritesheetsCreate.sql"); File spritesheetsData = new File("sql/spritesheetsData.sql"); Class.forName("org.apache.derby.jdbc.EmbeddedDriver").newInstance(); Connection conn = DriverManager .getConnection("jdbc:derby:TESTNAME;create=true"); //CREATE TABLE try (PreparedStatement statement = conn .prepareStatement(readFile(spritesheetsCreate))) { statement.execute(); } //FILL TABLE WITH DATA try (PreparedStatement ps = conn.prepareStatement(readFile(spritesheetsData))) { try (CSVReader rdr = new CSVReader(new FileReader(new File( "res/spritesheets.csv")), ',', '"', 1)) { for (String[] row : rdr.readAll()) { ps.setString(1, row[0]); ps.setString(2, row[1]); ps.setInt(3, Integer.valueOf(row[2])); ps.execute(); } } } } private static String readFile(File f) throws Exception { String contents = ""; try (Scanner sc = new Scanner(f)) { contents = sc.useDelimiter("\\Z").next(); } return contents; } public static void main(String[] args) throws Exception { ResourceLoaderSQL test = new ResourceLoaderSQL(); } The two SQL-files used by my app, look like this: spritesheetsCreate.sql: CREATE TABLE spritesheetstable( name VARCHAR(7) NOT NULL PRIMARY KEY , spritesheetlocation VARCHAR(15) , tilesize INTEGER ) spritesheetsData.sql: INSERT INTO spritesheetstable("name", "spritesheetlocation", "tilesize") VALUES (?,?,?) The CSV-file looks like this: spritesheets.csv: name,spritesheet-location,tilesize spot1,location/loc1,10 spot2,location/loc2,20 spot3,location/loc3,30 spot4,location/loc4,40 The error I get when this beauty-to-be runs, is: Exception in thread "main" java.sql.SQLSyntaxErrorException: 'name' is not a column in table or VTI 'APP.SPRITESHEETSTABLE'. at org.apache.derby.impl.jdbc.SQLExceptionFactory40.getSQLException(Unknown Source)…
has comment: http://stackoverflow.com/comment/34708299
score: 0
tagged with: http://stackoverflow.com/tag/csv
has comment: http://stackoverflow.com/comment/34708381
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/34708701
has answer: http://stackoverflow.com/a/22767152
type: Question
tagged with: java
has comment: http://stackoverflow.com/comment/34708311
tagged with: derby
accepted answer: http://stackoverflow.com/a/22767152

http://stackoverflow.com/comment/34705720
comment on: http://stackoverflow.com/q/22764039
has text: Umm, how exactly do you expect to GetExtra if you never PutExtra?
type: Comment
type: QuestionComment
score: 0

http://stackoverflow.com/q/22688378
has answer: http://stackoverflow.com/a/22688464
score: 0
answer count: 3
tagged with: android
has answer: http://stackoverflow.com/a/22688522
type: UnansweredQuestion
has title: Exception Unparseable date
type: Question
tagged with: java
has answer: http://stackoverflow.com/a/22688465
has body: SimpleDateFormat readDate = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss.SSSZ"); String dtc = "2014-03-27T11:31:42.798Z"; Date date = null; try { date = readDate.parse(dtc); } catch (ParseException e) { Log.d("myLog", "dateExcep " + e); } try{} catch{} have exception: 03-27 16:29:48.459: D/myLog(19388): dateExcep java.text.ParseException: Unparseable date: "2014-03-27T11:31:42.798Z" (at offset 23)

http://stackoverflow.com/q/22703706
score: 0
has comment: http://stackoverflow.com/comment/34596517
answer count: 1
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/22706653
tagged with: keystore
has title: JAVA SSL Generate a new keystore certificate for each client on server side
tagged with: java
type: Question
has body: I am trying to make my help-desk chat application secure. On my client side, I created it so that each client would create their certificate and keystore at runtime (so not every client has the same keystore), and exactly same on server. However, on the server side, this takes place before the while loop that accepts connections from clients. This means that the server is using the same certificate for each connection, which would make it very easy for a malicious user to send data to the server simply by using the server's certificate (which is the same the whole time the server is up). Can I somehow create the certificate and keystore IN the while loop in the server, and somehow use that certificate for the new incoming connection (sslsocket.accept). (BTW, I can only use one server port for all connections). The following is my client implementation (snippet): String domainName ="localhost"; KeyPairGenerator keyPairGenerator; Security.addProvider(new org.bouncycastle.jce.provider.BouncyCastleProvider ()); keyPairGenerator = KeyPairGenerator.getInstance("RSA"); keyPairGenerator.initialize(1024); KeyPair KPair = keyPairGenerator.generateKeyPair(); X509V3CertificateGenerator v3CertGen = new X509V3CertificateGenerator(); v3CertGen.setSerialNumber(BigInteger.valueOf(Math.abs(new SecureRandom().nextInt()))); v3CertGen.setIssuerDN(new X509Principal("CN=" + domainName + ", OU=None, O=None L=None, C=None")); v3CertGen.setNotBefore(new Date(System.currentTimeMillis() - 1000L * 60 * 60 * 24 * 30)); v3CertGen.setNotAfter(new Date(System.currentTimeMillis() + (1000L * 60 * 60 * 24 * 365*10))); v3CertGen.setSubjectDN(new X509Principal("CN=" + domainName + ", OU=None, O=None L=None, C=None")); v3CertGen.setPublicKey(KPair.getPublic()); v3CertGen.setSignatureAlgorithm("MD5WithRSAEncryption"); X509Certificate pkCertificate = v3CertGen.generateX509Certificate(KPair.getPrivate()); KeyStore keystore = KeyStore.getInstance("JKS"); keystore.load(null, null); Random rand = new Random();…
tagged with: ssl

http://stackoverflow.com/comment/34749871
comment on: http://stackoverflow.com/a/22786460
score: 0
type: AnswerComment
has text: @sathya link added bottom have a look through it, you will get enough explanation there.
type: Comment

http://stackoverflow.com/q/22735183
tagged with: java
type: Question
has body: I am starting work with grails. I am quite confused in grails about using this &lt;&lt; (bitwise left shift) operator. I think it is use for assigning some value/object like assignedTo &lt;&lt; assignedValue def outputBook = { output &lt;&lt; Book.read(1) } Is this the definite concept or not ?
tagged with: grails-2.0
downvote count: 0
tagged with: grails
accepted answer: http://stackoverflow.com/a/22735484
tagged with: groovy
has title: What does the << operator definite usages in grails?
answer count: 1
favorite count: 0
has comment: http://stackoverflow.com/comment/34651480
upvote count: 1
tagged with: grails-plugin
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/22735484
score: 1

http://stackoverflow.com/comment/82716039
has text: Javadoc says this about limit's param: `maxSize: the number of elements the stream should be limited to`. So, shouldn't it be `.limit(1)` instead of `.limit(2)` ?
comment on: http://stackoverflow.com/a/22717262
type: AnswerComment
type: Comment
score: 1

http://stackoverflow.com/q/22728880
has body: I need to extract from venue *country*, city from google search result. For example I search for "EEE Symposium on Computational intelligence for Image Processing". I'm using googles custom search api. I get a snippet like this, "snippet": "The Computer Security Foundations Symposium is an annual conference for researchers in ... It was created in 1988 as a workshop of the IEEE Computer Society Technical Committee on Security and ... CSF-26 was held at Tulane University, New Orleans, LA, June 26-28, 2013. ... CSFW-19 program and 5- minute talks.", How do I extract 'Tulane University, New Orleans' from the response....mind you there are multiple results but lets assume I take only the 1st one which contains this..
answer count: 1
score: 0
type: UnansweredQuestion
tagged with: java
tagged with: google-search-api
has answer: http://stackoverflow.com/a/22729089
type: Question
has title: extracting country, city and venue from google search

http://stackoverflow.com/q/22654309
linked to: http://stackoverflow.com/q/4197507
tagged with: java
has answer: http://stackoverflow.com/a/22654381
type: Question
answer count: 2
possible better answer: http://stackoverflow.com/a/22654381
has answer: http://stackoverflow.com/a/22675427
has body: The xpath.evaluate parsing in android takes about 8-9 seconds for each. I use about 8 different xpath evaluate methods and my program takes about 1 min 35 seconds to load. I'm using an AsyncTask for this purpose and I don't want to implement other parsers which are not included in the standard JDK. One of the many laggy xpath evaluate code blocks : for (int i=1;i&lt;=36;i++){ InputSource source16 = new InputSource(new StringReader(hourly)); try{ humidity = xpath.evaluate("/response/hourly_forecast/forecast["+i+"]/humidity", source16); } catch (Exception e) { e.printStackTrace(); } }
score: 0
tagged with: android
has title: XPath XML data parsing in android very slow
tagged with: http://stackoverflow.com/tag/xml
tagged with: xpath
accepted answer: http://stackoverflow.com/a/22675427
type: AnsweredQuestion

http://stackoverflow.com/q/22725537
possible better answer: http://stackoverflow.com/a/22822592
has answer: http://stackoverflow.com/a/22725767
linked to: http://stackoverflow.com/q/51668246
answer count: 13
has comment: http://stackoverflow.com/comment/102927632
tagged with: java-stream
has answer: http://stackoverflow.com/a/36334855
has answer: http://stackoverflow.com/a/79464378
tagged with: lambda
tagged with: java-8
has answer: http://stackoverflow.com/a/35160464
score: 318
has comment: http://stackoverflow.com/comment/45876182
tagged with: java
has comment: http://stackoverflow.com/comment/50382510
has answer: http://stackoverflow.com/a/40915317
has answer: http://stackoverflow.com/a/22726869
has comment: http://stackoverflow.com/comment/45747994
has answer: http://stackoverflow.com/a/57696853
has body: The new Java 8 stream framework and friends make for some very concise Java code, but I have come across a seemingly-simple situation that is tricky to do concisely. Consider a List&lt;Thing&gt; things and method Optional&lt;Other&gt; resolve(Thing thing). I want to map the Things to Optional&lt;Other&gt;s and get the first Other. The obvious solution would be to use things.stream().flatMap(this::resolve).findFirst(), but flatMap requires that you return a stream, and Optional doesn't have a stream() method (or is it a Collection or provide a method to convert it to or view it as a Collection). The best I can come up with is this: things.stream() .map(this::resolve) .filter(Optional::isPresent) .map(Optional::get) .findFirst(); But that seems awfully long-winded for what seems like a very common case. Anyone have a better idea?
has answer: http://stackoverflow.com/a/58281027
has answer: http://stackoverflow.com/a/53064733
has answer: http://stackoverflow.com/a/46340850
has comment: http://stackoverflow.com/comment/34649902
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/22735184
downvote count: 0
has title: Using Java 8's Optional with Stream::flatMap
has answer: http://stackoverflow.com/a/27215810
has answer: http://stackoverflow.com/a/22822592
favorite count: 0
upvote count: 318
has comment: http://stackoverflow.com/comment/55042383
type: Question
has comment: http://stackoverflow.com/comment/46268463
accepted answer: http://stackoverflow.com/a/22726869

http://stackoverflow.com/a/22764058
has comment: http://stackoverflow.com/comment/34704056
has comment: http://stackoverflow.com/comment/34703856
downvote count: 0
has comment: http://stackoverflow.com/comment/34704133
score: 1
has comment: http://stackoverflow.com/comment/34704385
answers question: http://stackoverflow.com/q/22752198
has comment: http://stackoverflow.com/comment/34705672
has body: Using JDK 8: java version "1.8.0" Java(TM) SE Runtime Environment (build 1.8.0-b132) Java HotSpot(TM) 64-Bit Server VM (build 25.0-b70, mixed mode) On Ubuntu 13.10 I ran the following: import java.util.Random; import java.util.function.BiFunction; public class MaxPerformance { private final BiFunction&lt;Integer, Integer, Integer&gt; max; private final int[] array; public MaxPerformance(BiFunction&lt;Integer, Integer, Integer&gt; max, int[] array) { this.max = max; this.array = array; } public double time() { long start = System.nanoTime(); int m = Integer.MIN_VALUE; for (int i = 0; i &lt; array.length; ++i) m = max.apply(m, array[i]); m = Integer.MIN_VALUE; for (int i = 0; i &lt; array.length; ++i) m = max.apply(array[i], m); // total time over number of calls to max return ((double) (System.nanoTime() - start)) / (double) array.length / 2.0; } public double averageTime(int repeats) { double cumulativeTime = 0; for (int i = 0; i &lt; repeats; i++) cumulativeTime += time(); return (double) cumulativeTime / (double) repeats; } public static void main(String[] args) { int size = 1000000; Random random = new Random(123123123L); int[] array = new int[size]; for (int i = 0; i &lt; size; i++) array[i] = random.nextInt(); double tMath = new MaxPerformance(Math::max, array).averageTime(100); double tAlt1 = new MaxPerformance(MaxPerformance::max1, array).averageTime(100); double tAlt2 = new MaxPerformance(MaxPerformance::max2, array).averageTime(100); System.out.println("Java Math: " + tMath); System.out.println("Alt 1: " + tAlt1); System.out.println("Alt 2: " + tAlt2); } public static int max1(final int a, final int b) { if (a &gt;= b) return a; return b; } public static int max2(final int a, final int b) { return (a &gt;= b) ? a : b; // same as JDK implementation } } And I got the following results (average nanoseconds taken for each call to max): Java Math: 15.443555810000003 Alt 1: 14.968298919999997 Alt 2: 16.442204045 So on a long run it looks like the second implement…
has comment: http://stackoverflow.com/comment/34705647
upvote count: 1
has comment: http://stackoverflow.com/comment/34704098
has comment: http://stackoverflow.com/comment/34704327
type: Answer
has comment: http://stackoverflow.com/comment/34703758

http://stackoverflow.com/comment/34550240
type: QuestionComment
comment on: http://stackoverflow.com/q/22679106
score: 0
has text: A side note; last question you asked you tagged urgent, disappeared and didn't answer comments posted on the question for 18 hours. People add comments to get help answering your question since your question does not contain enough info. Reposting the same question instead of answering questions people ask in the comments to your question is not helpful from your side.
type: Comment

http://stackoverflow.com/a/66766654
has body: Checked Java 11 implementation: private static void initPhase1() { lineSeparator = props.getProperty("line.separator"); } public static String lineSeparator() { return lineSeparator; } So altering system property at runtime doesn't change System.lineSeparator(). For this reason some projects re-read system property directly, see my answer: How to avoid CRLF (Carriage Return and Line Feed) in Logback - CWE 117 The only viable option is to set system property during app startup. For Bash it is as simple as: java -Dline.separator=$'\n' -jar my.jar. For POSIX shell it is better to save that character in some variable first: LF=' ' java -Dline.separator="$LF" -jar my.jar If you are not sure debug it: printf %s "$LF" | wc -c 1 printf %s "$LF" | od -x 0000000 000a For Gradle I use: tasks.withType(Test).configureEach { systemProperty 'line.separator', '\n' } bootRun { systemProperty 'line.separator', '\n' }
score: 0
type: Answer
answers question: http://stackoverflow.com/q/22681534

http://stackoverflow.com/a/22718481
has body: You can solve the equation for t (or let others do this for you: Wolfram alpha solution) and implement the resulting formula: class SheepHerd { public static void main(String[] args) { for (double t = 0; t &lt;= 25; t++) { double N = 220 / (1 + 10 * (Math.pow(.83, t))); System.out.println( "for t=" + t + " result is " + N + " check: " + computeYears(N)); } System.out.println(computeYears(80)); } public static double computeYears(double N) { double a = Math.log(22.0 / N - 0.1); double b = Math.log(100.0 / 83.0); return -a / b; } }
score: 0
answers question: http://stackoverflow.com/q/22718260
type: Answer

http://stackoverflow.com/q/22701016
answer count: 2
possible better answer: http://stackoverflow.com/a/22701093
has comment: http://stackoverflow.com/comment/34590205
has answer: http://stackoverflow.com/a/22701093
has body: I am trying to set a list of images in a PDF document using iText with Java, i could just insert some of them in the first page but i don't know how to jump to the next pages in order to put the rest of my pictures for(int i = 0; i &lt; 25; i++) { Image myImg = Image.getInstance("/home/code/img"+i+".png"); imgPaper.setAbsolutePosition(50, 728-(y*58)); document.add(myImg); y++; }
tagged with: http://stackoverflow.com/tag/pdf
accepted answer: http://stackoverflow.com/a/22704760
has title: Insert images in different pdf pages
linked to: http://stackoverflow.com/q/4158336
has comment: http://stackoverflow.com/comment/34589918
type: AnsweredQuestion
score: 0
tagged with: java
linked to: http://stackoverflow.com/q/4284691
tagged with: itext
has answer: http://stackoverflow.com/a/22704760
type: Question

http://stackoverflow.com/q/22770570
has comment: http://stackoverflow.com/comment/34764520
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/34717464
tagged with: php
score: 3
has answer: http://stackoverflow.com/a/22798249
upvote count: 3
tagged with: java
has comment: http://stackoverflow.com/comment/34717291
tagged with: httprequest
tagged with: post
has title: HttpRequest with JAVA (libGdx) and processing it with PHP
has comment: http://stackoverflow.com/comment/34727418
type: Question
tagged with: libgdx
has comment: http://stackoverflow.com/comment/34716762
has body: I could really use some help here. I'm learning HttpRequest with libGDX, and I'm stuck with the setContent(); Here is the Java code I'm trying to run. And it works fine, except one little problem: It doesn't send the variables "name" and "score" to the httptest.php file. However the php file runs normaly, inserting empty values into the database. Eclipse even shows me the result about the success with an empty name and a 0 score: Status code : 200 Result : connected succesfully inserted and his score: 0 So it looks like the two programs communicate, except the java doesn't send the data to the php. I run out of ideas, and dont know what to do. The java code: Map&lt;String, String&gt; parameters = new HashMap&lt;String, String&gt;(); parameters.put("name", "testname1"); parameters.put("score", "56"); HttpRequest request = new HttpRequest(HttpMethods.POST); request.setUrl("www.myurl.com/httptest.php"); request.setContent(HttpParametersUtils.convertHttpParameters(parameters)); // request.setContent("name=testname&amp;score=10"); Gdx.net.sendHttpRequest(request, new HttpResponseListener() { @Override public void handleHttpResponse(HttpResponse httpResponse) { Gdx.app.log("Status code ", "" + httpResponse.getStatus().getStatusCode()); Gdx.app.log("Result ", httpResponse.getResultAsString()); } @Override public void failed(Throwable t) { Gdx.app.log("Failed ", t.getMessage()); } }); The php code: &lt;?php $name=$_POST["name"]; $scoreget=$_POST["score"]; $score=(int)$scoreget; if (is_int ($score)) { // Create connection $con=mysqli_connect($mycon); // Check connection if (mysqli_connect_errno()) { echo "Failed to connect to MySQL: " . mysqli_connect_error(); } else{echo"connected ";} $sql= "INSERT INTO scores (name, score, text) VALUES ('$name', '$score','')"; if (!mysqli_query($con, $sql)) { die('Error: ' . mysqli_error($con)); }else{ echo "succesfully inserted ".$name." and his score: ".$score; } }else{ echo "Invalid numeric type"; } ?&gt; I also tested the httptest.php …
answer count: 1
has comment: http://stackoverflow.com/comment/34727481
downvote count: 0
favorite count: 0

http://stackoverflow.com/a/22791190
has body: private void addAttribute(Map&lt;String, String&gt; attributes, String key, String value) { if (StringUtils.isNotBlank(value)) { attributes.put(key, value); } } public void addAttributes(Map&lt;String, String&gt; attributes, Employee employee) { addAttribute(attributes, EMP_FIRST_NAME_ATTR, employee.getFirstName()); addAttribute(attributes, EMP_LAST_NAME_ATTR, employee.getLastName()); addAttribute(attributes, EMP_EMAIL_ATTR, employee.getEmail()); }
upvote count: 1
answers question: http://stackoverflow.com/q/22791101
type: Answer
downvote count: 0
score: 1

http://stackoverflow.com/a/22807208
type: Answer
has body: you cannot compare more than 2 variables at a time following. a == b == c instead of this you need to compare like following (a == b) &amp;&amp; (b == c) also accorind to the definition of identity matrix identity matrix or unit matrix of size n is the n × n square matrix with ones on the main diagonal and zeros elsewhere so your concept is also wrong .. just check if the diagonal values are 1 and others are 0.
answers question: http://stackoverflow.com/q/22807101
score: 1
upvote count: 1
downvote count: 0

http://stackoverflow.com/q/22653916
tagged with: java
type: Question
downvote count: 0
answer count: 1
favorite count: 0
tagged with: regex
has title: Need regular expression expertise
accepted answer: http://stackoverflow.com/a/22653960
has comment: http://stackoverflow.com/comment/34505058
upvote count: 1
has body: I need help figuring out a regular expression for the rule: 6 characters, starting with letter R (uppercase), and followed by digits where at least one digit is not 0. My attempt so far is "[R][0-9]{5}[1-9]+" but I keep getting a false when it should be returning true for R01001. I'm stumped, Any help would be appreciated.
has answer: http://stackoverflow.com/a/22653960
type: AnsweredQuestion
score: 1

http://stackoverflow.com/q/22753171
has answer: http://stackoverflow.com/a/22753393
has comment: http://stackoverflow.com/comment/34683567
has comment: http://stackoverflow.com/comment/34683391
type: Question
has answer: http://stackoverflow.com/a/22753336
has answer: http://stackoverflow.com/a/22753505
has body: When working with just xls I can create workbooks just fine, however when working with xlsx I cant seem to get it to work. I am using the poi-ooxml.jar and am trying to use the command new XSSFWorkbook(); However I get an error message everytime, any thoughts? Exception in thread "main" java.lang.NoClassDefFoundError: org/apache/poi/ss/usermodel/Workbook at java.lang.ClassLoader.defineClass1(Native Method) at java.lang.ClassLoader.defineClass(Unknown Source) at java.security.SecureClassLoader.defineClass(Unknown Source) at java.net.URLClassLoader.defineClass(Unknown Source) at java.net.URLClassLoader.access$000(Unknown Source) at java.net.URLClassLoader$1.run(Unknown Source) at java.security.AccessController.doPrivileged(Native Method) at java.net.URLClassLoader.findClass(Unknown Source) at java.lang.ClassLoader.loadClass(Unknown Source) at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source) at java.lang.ClassLoader.loadClass(Unknown Source) at java.lang.ClassLoader.loadClassInternal(Unknown Source) at Testing2.main(Testing2.java:20) Caused by: java.lang.ClassNotFoundException: org.apache.poi.ss.usermodel.Workbook at java.net.URLClassLoader$1.run(Unknown Source) at java.security.AccessController.doPrivileged(Native Method) at java.net.URLClassLoader.findClass(Unknown Source) at java.lang.ClassLoader.loadClass(Unknown Source) at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source) at java.lang.ClassLoader.loadClass(Unknown Source) at java.lang.ClassLoader.loadClassInternal(Unknown Source) ... 13 more
score: 0
has comment: http://stackoverflow.com/comment/34683450
answer count: 3
linked to: http://stackoverflow.com/q/7400096
has comment: http://stackoverflow.com/comment/34683301
type: UnansweredQuestion
has title: Apache POI - how to create workbook for xlsx
tagged with: excel
tagged with: apache-poi
tagged with: java

http://stackoverflow.com/comment/64004225
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/22655754
has text: I hope you did find a solution because as far as I know it is not possible using Apache POI
score: 1

http://stackoverflow.com/a/22772066
has body: Or rather. You should add a Logger to your code. Then you should wrote like this try { Clients c = (Clients) query.getSingleResult(); return true; } catch {NoResultException e){ log.debug("Problem to login for user % ", CID , e); return false; }
type: Answer
has comment: http://stackoverflow.com/comment/34718765
answers question: http://stackoverflow.com/q/22771837
score: 0
has comment: http://stackoverflow.com/comment/34719019
has comment: http://stackoverflow.com/comment/34717839

http://stackoverflow.com/a/22735624
answers question: http://stackoverflow.com/q/22735605
has body: You're missing break in all your cases. Due to that, the switch falls through, and all the cases are executed. Insert break at appropriate places: switch (month) { case 1: case 3: case 5: case 7: case 8: case 10: case 12: if (day &gt; 31) System.out.print(date + " is an invalid date."); else System.out.print(date + " is a valid date."); break; // Here case 4: case 6: case 9: case 11: if (day &gt; 30) System.out.print(date + " is an invalid date."); else System.out.print(date + " is a valid date."); break; // Here case 2: if (year % 4 == 0) if (day &gt; 29) System.out.print(date + " is an invalid day."); else System.out.print(date + " is a valid date and leap year."); else if (day &gt; 28) System.out.print(date + " is an invalid day."); else System.out.print(date + " is a valid date."); break; // Here default: System.out.println("The date: " + date + " has an invalid month"); } And please make a habbit of always enclosing your ifs and elses with curly braces.
score: 3
type: AcceptedAnswer
downvote count: 0
type: Answer
upvote count: 3
accepted answer of: http://stackoverflow.com/q/22735605

http://stackoverflow.com/q/22762227
tagged with: java
type: Question
tagged with: opencv
tagged with: java-native-interface
has body: Apologies if my answer already lies somewhere on the Internet, but I have been at this for days now and there simply does not seem to exist an answer to my problems. I have looked at most other similar questions posted by other users, and I have tried every solution that has been offered, but it stubbornly refuses to work. I've been trying to get a simple Android + OpenCV + JNI code running. I have configured all the necessary settings, including the Android &amp; Application .mk files and I have also made sure all my OpenCV libraries are correctly imported, which they seem to be. My code does not give me any errors before launching, but once the application has been launched, I get a terrible'java.lang.UnsatisfiedLinkError: Native method not found: com.test.opencvcameratest.MainActivity.convertNativeGray(I)I' error for which there seems to be no logical reason as I'm fairly certain I've taken all the necessary steps to get to this point. I've included my code below, and I'd be extremely grateful to anyone who can help me resolve this baffling mystery. package com.test.opencvcameratest; import org.opencv.android.BaseLoaderCallback; import org.opencv.android.CameraBridgeViewBase; import org.opencv.android.CameraBridgeViewBase.CvCameraViewFrame; import org.opencv.android.CameraBridgeViewBase.CvCameraViewListener2; import org.opencv.android.LoaderCallbackInterface; import org.opencv.android.OpenCVLoader; import org.opencv.core.Mat; import android.app.Activity; import android.os.Bundle; import android.util.Log; import android.view.SurfaceView; import android.view.WindowManager; public class MainActivity extends Activity implements CvCameraViewListener2 { //implement cvcameraviewlistener2 for camera functionality private Mat mRgba; private Mat mGray; private CameraBridgeViewBase mOpenCvCameraView; public native int convertNativeGray(int n); private final static String TAG = "MainActivity"; private BaseLoaderCallback mLoaderCallback = new BaseLoaderCallback(this) { @Overr…
has answer: http://stackoverflow.com/a/22802780
accepted answer: http://stackoverflow.com/a/22802780
upvote count: 1
answer count: 1
favorite count: 0
tagged with: android
has title: Perplexing UnsatisfiedLinkError when attempting to launch Android + OpenCV file with JNI component
tagged with: c++
type: AnsweredQuestion
downvote count: 0
score: 1

http://stackoverflow.com/q/22735038
possible better answer: http://stackoverflow.com/a/22735159
has answer: http://stackoverflow.com/a/22735159
answer count: 2
downvote count: 0
favorite count: 0
accepted answer: http://stackoverflow.com/a/22735074
has body: I tried to connect to a MySQL database in java in eclipse but I have this error when I run my program: URLDecoder: Illegal hex characters in escape (%) pattern - For input string: "pa" Here is my code: public static void main(String[] args) { try { Connection con=null; Statement stm=null; ResultSet resultSet=null; String host = "localhost:3306"; String db = "mysqlconn"; String driver = "com.mysql.jdbc.Driver"; String user = "newuser"; String pass = "123456"; Class.forName(driver).newInstance(); //String result = java.net.URLDecoder.decode(, "UTF-8"); con = (Connection) DriverManager.getConnection("jdbc:mysql://localhost:3306/myslconn?user=root%password=123456"); stm = ((java.sql.Connection) con).createStatement(); String sorgu = "SELECT * FROM mysqlconn"; resultSet = stm.executeQuery(sorgu); while(resultSet.next()) { System.out.println(resultSet.getString("id")); //System.out.println(resultSet.getString("marka")); } } catch(Exception ex) { System.err.println("Hata ! "); System.err.println(ex.getMessage()); } }
has title: mysql Connection with java
type: AnsweredQuestion
upvote count: 3
tagged with: java
tagged with: mysql
type: Question
score: 3
has answer: http://stackoverflow.com/a/22735074

http://stackoverflow.com/a/22800160
answers question: http://stackoverflow.com/q/22799998
upvote count: 6
type: AcceptedAnswer
downvote count: 1
type: Answer
has comment: http://stackoverflow.com/comment/34818499
has body: When looking at Insertion Sort, first consider the algorithm - From the animation, you should be able to tell that it's in-place. With that in mind, I think you wanted something like this - int[] orgArray = { 5, 4, 1, 6, 3, 144, 2, 14 }; int[] newArray = new int[orgArray.length]; // Copy the original array. System.arraycopy(orgArray, 0, newArray, 0, orgArray.length); for (int x = 1; x &lt; newArray.length; x++) { int currentNum = newArray[x]; // &lt;-- the current number changes on every loop int y = x; // The actual condition on which to shift up! for (; y &gt; 0 &amp;&amp; newArray[y - 1] &gt; currentNum; y--) { newArray[y] = newArray[y - 1]; } // All shifts done, insert the correct place. newArray[y] = currentNum; } System.out.println("Ascending order : " + Arrays.toString(newArray)); Which outputs, Ascending order : [1, 2, 3, 4, 5, 6, 14, 144]
accepted answer of: http://stackoverflow.com/q/22799998
score: 5

http://stackoverflow.com/q/22672846
has comment: http://stackoverflow.com/comment/34702741
score: 15
has comment: http://stackoverflow.com/comment/34696047
tagged with: google-play-services
answer count: 2
possible better answer: http://stackoverflow.com/a/24840901
has comment: http://stackoverflow.com/comment/34689639
has comment: http://stackoverflow.com/comment/34822968
has answer: http://stackoverflow.com/a/24840901
has comment: http://stackoverflow.com/comment/42532878
has comment: http://stackoverflow.com/comment/34790523
favorite count: 0
has comment: http://stackoverflow.com/comment/34837889
tagged with: android
has title: java.lang.SecurityException: attempting to read gservices without permission
has comment: http://stackoverflow.com/comment/34959206
accepted answer: http://stackoverflow.com/a/22855880
has comment: http://stackoverflow.com/comment/34571553
upvote count: 15
has comment: http://stackoverflow.com/comment/34821951
type: AnsweredQuestion
downvote count: 0
tagged with: java
has answer: http://stackoverflow.com/a/22855880
type: Question
has comment: http://stackoverflow.com/comment/42539183
has body: I have recently changed from adMob 6.4.1 to Google Play Services rev 15 and have just received notice of a new crash report that I do not understand: java.lang.SecurityException: attempting to read gservices without permission: Neither user 10158 nor current process has com.google.android.providers.gsf.permission.READ_GSERVICES. at android.os.Parcel.readException(Parcel.java:1425) at android.os.Parcel.readException(Parcel.java:1379) at xs.a(SourceFile:133) at xo.a(SourceFile:133) at xo.a(SourceFile:118) at ud.d(SourceFile:88) at ud.b(SourceFile:129) at ua.a(SourceFile:239) at ua.a(SourceFile:176) at aas.a(SourceFile:118) at abz.run(SourceFile:14) at acb.run(SourceFile:30) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1080) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:573) at java.lang.Thread.run(Thread.java:856) I did some research, and all the results are either outdated, or are related to Google+ / Google Maps, neither of which I use in the app. I've never read anywhere in the GPS Developer guide for adMob that I needed to add the READ GSERVICES permission... Anyone know what this is about?

http://stackoverflow.com/q/22740572
tagged with: ajax
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/22740677
accepted answer: http://stackoverflow.com/a/22740677
has answer: http://stackoverflow.com/a/71558219
has comment: http://stackoverflow.com/comment/64465488
tagged with: java
has title: Can not send FormData from JSP page using jquery-AJAX to Servlet
type: Question
has body: Trying to send POST data from JSP file using jQuery-AJAX to servlet, but getting null values in servlet post request. On JSP page , in console it is displaying proper data and in post request it is showing me that it is sending data, i have checked that using firebug in mozilla. But getting null values in servlet. JSP-Code: Hello World! tbl1 tbl2 tbl3 col1 col2 col3 op1 op2 op3 condtn1 condtn2 condtn3 Servlet Code: @WebServlet(name = "queryoutput", urlPatterns = {"/queryoutput"}) public class QueryOutput extends HttpServlet { public QueryOutput() { super(); // TODO Auto-generated constructor stubatavu } @Override protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { } @Override protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { response.setContentType("application/json;charset=UTF-8"); System.out.println(" inside do post table::" +request.getParameter("mytablename")); System.out.println(" inside do post col name:: " +request.getParameter("mycolumnname")); System.out.println(" inside do post operator::" +request.getParameter("myoperator")); System.out.println(" inside do post user input::" +request.getParameter("mytxtuserinput")); response.setContentType("application/json;charset=UTF-8"); PrintWriter out=response.getWriter(); out.flush(); } }
tagged with: servlets
score: 0
answer count: 2
possible better answer: http://stackoverflow.com/a/71558219
tagged with: jsp
tagged with: jquery

http://stackoverflow.com/comment/34689539
has text: @user3480264, see my updated answer. The problem is with the versioning
type: Comment
score: 0
comment on: http://stackoverflow.com/a/22756566
type: AnswerComment

http://stackoverflow.com/a/22797956
has body: I am guessing you are storing 99928.000000 as a string, if you are able to keep leading zeroes. In this case, you should be able to get what you want by using string splitting on the decimal point. String foo = "99928.000000" foo = foo.split("\\.")[0]
answers question: http://stackoverflow.com/q/22797801
score: 0
type: Answer

http://stackoverflow.com/comment/34529530
score: 0
has text: `static` methods must be called from `static` context.
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/22667671

http://stackoverflow.com/a/22715189
type: Answer
downvote count: 0
score: 1
answers question: http://stackoverflow.com/q/22715121
upvote count: 1
has body: @Override the toString in your extension class. A simple for loop should do it

http://stackoverflow.com/comment/34522965
type: QuestionComment
has text: Yup, the value is the bitmap (which is null). But it's not in Android 2.3+ and I have no idea why!?
comment on: http://stackoverflow.com/q/22663450
score: 0
type: Comment

http://stackoverflow.com/comment/34697208
comment on: http://stackoverflow.com/a/22760268
has text: Im not sure where in my mainactivity.java file I must move the save button setup to..
type: Comment
score: 0
type: AnswerComment

http://stackoverflow.com/a/22667961
score: 0
answers question: http://stackoverflow.com/q/22667671
type: Answer
has body: Well, to start with, you have a while loop with a condition while (x == 'y') - but you never change the value of x. The result of this is that the loop will never end (infinite loop). Your next problem is that you don't define what dA and dB are in the calling context, only in the static function. Since the called function defines two parameters as ints, when you call it, you should be calling it as RollTheDice(5, 6) or you should assign int values to dA and dB (by the way, you know that when you are calling the function, the variables in the call do not have to have the same names as the variables in the function parameters, right?). int xA = 5; int xB = 6; System.out.println(RollTheDice(xA, xB)); Finally, all this is assuming that there's a missing void Main() { line at the top.

http://stackoverflow.com/q/22735677
tagged with: jersey
has comment: http://stackoverflow.com/comment/34652205
answer count: 1
has comment: http://stackoverflow.com/comment/34652431
score: 0
has comment: http://stackoverflow.com/comment/34653149
has comment: http://stackoverflow.com/comment/34652015
has body: I am trying to store the latitude and longitude of a tweet in a JSON object. It works fine when I just use the geo location. ex. obj.put("coordinates", tweet.getGeoLocation()); When I change it to get just the latitude or longitude is throws a null pointer exception. ex. obj.put("lat", tweet.getGeoLocation().getLatitude()); Code: JSONArray array = new JSONArray(); try { Query query = new Query("query"); QueryResult result; result = twitter.search(query); tweets = result.getTweets(); for (Status tweet : tweets) { JSONObject obj = new JSONObject(); obj.put("userName", tweet.getUser().getScreenName()); obj.put("text", tweet.getText()); obj.put("lat", tweet.getGeoLocation().getLatitude()); obj.put("lon", tweet.getGeoLocation().getLongitude()); String json = obj.toString(); array.put(obj); } System.out.println(array); } catch (TwitterException te) { te.printStackTrace(); System.out.println("Failed to search tweets: " + te.getMessage()); System.exit(-1); } return array; } This is the error: SEVERE: Servlet.service() for servlet [Jersey REST Service] in context with path [/Jersey] threw exception java.lang.NullPointerException Update: It seems to be half working now, it does actually get the latitude and longitude now, but there is still an error. Here is the output log. Mar 29, 2014 8:24:25 PM com.sun.jersey.spi.container.ContainerResponse mapMappableContainerException SEVERE: The RuntimeException could not be mapped to a response, re-throwing to the HTTP container java.lang.NullPointerException at sample.hello.resources.TweetUsingTwitter4jExample.getTweets(TweetUsingTwitter4jExample.java:70) at sample.hello.resources.HelloResource.sayHello(HelloResource.java:25) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:606) at com.sun.jersey.spi.contain…
has title: Twitter4J - null pointer exception when using getLatitude()
has answer: http://stackoverflow.com/a/22737198
accepted answer: http://stackoverflow.com/a/22737198
type: AnsweredQuestion
tagged with: twitter4j
tagged with: java
tagged with: http://stackoverflow.com/tag/json
tagged with: twitter
type: Question

http://stackoverflow.com/q/22703712
upvote count: 2
score: 2
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/22704600
tagged with: eofexception
tagged with: java
has body: I am writing a chat room code and each message is sent back and forth between client and server constantly. I have made all the messages into serialized objects and am using them to pass the information back and forth. Unfortunately this has led to an EOFException being thrown at the very first time the object is being read. The error code is as follows: Exception in thread "main" java.io.EOFException at java.io.DataInputStream.readInt(Unknown Source) at java.io.ObjectInputStream$BlockDataInputStream.readInt(Unknown Source) at java.io.ObjectInputStream.readInt(Unknown Source) at Serverside.ChatObject.readObject(ChatObject.java:36) 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 java.io.ObjectStreamClass.invokeReadObject(Unknown Source) at java.io.ObjectInputStream.readSerialData(Unknown Source) at java.io.ObjectInputStream.readOrdinaryObject(Unknown Source) at java.io.ObjectInputStream.readObject0(Unknown Source) at java.io.ObjectInputStream.readObject(Unknown Source) at Clientside.Client.run(Client.java:161) at Clientside.Client.main(Client.java:233) I am not sure if this is caused by the ObjectOutputStream never being closed, but if so, how do I work around this? Would I have to reopen the stream every single time an object is going to be written and can the input stream be left in the loop to wait for data? This is my custom object read/write code: private void writeObject(java.io.ObjectOutputStream stream) throws IOException{ stream.writeObject(type); stream.writeObject(chatroom); stream.writeObject(target); stream.writeObject(sender); stream.writeObject(message); stream.writeObject(users); stream.close(); } private void readObject(java.io.ObjectInputStream stream) throws IOException, ClassNotFoundException{ type = stream.readInt(); chatroom = stream.readInt(); targe…
tagged with: objectinputstream
type: Question
has title: Why is my ObjectInputStream throwing an EOFException?
answer count: 2
has answer: http://stackoverflow.com/a/22704600
downvote count: 0
possible better answer: http://stackoverflow.com/a/22703851
favorite count: 0
tagged with: objectoutputstream
has answer: http://stackoverflow.com/a/22703851
tagged with: custom-object

http://stackoverflow.com/q/22784669
answer count: 1
type: UnansweredQuestion
tagged with: android
tagged with: java
has comment: http://stackoverflow.com/comment/34741598
has body: I need to parse a given phone number to separate the country code from the actual phone number. Is there a way through which I can achieve this?
has comment: http://stackoverflow.com/comment/34739824
type: Question
has comment: http://stackoverflow.com/comment/34739763
has title: Getting phone number from number containing country code too
has answer: http://stackoverflow.com/a/22784739
has comment: http://stackoverflow.com/comment/34739691
score: 0
has comment: http://stackoverflow.com/comment/34740281

http://stackoverflow.com/a/22752386
has comment: http://stackoverflow.com/comment/34682262
has body: I would recommend using a RelativeLayout for the root layout and use the property android:layout_alignParentBottom="true" for the "version". Then wrap the other Views in a LinearLayout. Something like <LinearLayout android:layout_width="match_parent" android:layout_height="wrap_content" <EditText android:id="@+id/edittext1" android:layout_width="0dp" android:layout_weight="3" android:layout_height="wrap_content" /> <TextView android:id="@+id/textview1" android:layout_width="0dp" android:layout_height="wrap_content" android:layout_weight="2" android:text="NEW" android:textColor="#444444" android:paddingLeft="5dip" android:textSize="10pt" /> <EditText android:id="@+id/edittext2" android:layout_width="0dp" android:layout_weight="3" android:layout_height="wrap_content" /> <TextView android:id="@+id/textview2" android:layout_width="0dp" android:layout_weight="2" android:layout_height="wrap_content" android:text="NEW" android:textColor="#444444" android:paddingLeft="5dip" android:textSize="10pt" /> <TextView android:id="@+id/textview3" android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="Version 1.0" android:textColor="#444444" android:paddingLeft="5dip" android:textSize="10pt" android:layout_alignParentBottom="true" android:layout_centerHorizontal="true" /> I haven't had a chance to really test it but this should get you pretty close. I wrapped the two sets of Views in the center in a LinearLayout then gave each their own LinearLayout so they can make use of weight (which you can adjust to your needs). The parent LinearLayout is centered vertical so that those 4 Views will be centered the way I believe you want.
type: AcceptedAnswer
downvote count: 0
accepted answer of: http://stackoverflow.com/q/22752204
has comment: http://stackoverflow.com/comment/34682229
answers question: http://stackoverflow.com/q/22752204
upvote count: 2
type: Answer
score: 2
has comment: http://stackoverflow.com/comment/34682443
has comment: http://stackoverflow.com/comment/34682211

http://stackoverflow.com/a/22661513
type: AcceptedAnswer
answers question: http://stackoverflow.com/q/22660991
type: Answer
accepted answer of: http://stackoverflow.com/q/22660991
has body: You can not retrieve a session variable in a flow before you set it. Use the Object Store Module to persist data between calls / flow instances.
has comment: http://stackoverflow.com/comment/34531128
score: 0

http://stackoverflow.com/comment/34606754
type: QuestionComment
type: Comment
has text: You need to replace my_user with someone's user name.
score: 0
comment on: http://stackoverflow.com/q/22710518

http://stackoverflow.com/comment/114561090
score: 0
type: Comment
type: QuestionComment
has text: Your question is about cacheConsumers but your message is about cacheProducers. Please correct it.
comment on: http://stackoverflow.com/q/22672419

http://stackoverflow.com/comment/34667716
type: QuestionComment
score: 0
comment on: http://stackoverflow.com/q/22744650
has text: While technically there are some options (involving questionable techniques like transparent panels and `null`-layouts, or a `JLayeredPane`), I wonder why you are having a dedicated panel for the border. Why not paint the enemies in the GamePanel ... at the border?
type: Comment

http://stackoverflow.com/a/22804155
upvote count: 2
has body: 2-D array is a array of arrays. So each array can have variable length (which represents columns in case of 2-D array). You can get length of individual arrays using args[0].length; args[1].length; and so on and length of whole 2-D array using args.length which is number of rows in 2-D array. Related question: Multi-Dimension length array reflection java
has comment: http://stackoverflow.com/comment/34774812
type: Answer
has comment: http://stackoverflow.com/comment/34776244
score: 2
downvote count: 0
answers question: http://stackoverflow.com/q/22804048

http://stackoverflow.com/a/22777278
type: Answer
answers question: http://stackoverflow.com/q/22777249
upvote count: 1
has body: Try this.. Change startActivity(new Intent("com.google.android.gms.Vehicle")); to startActivity(new Intent(MainActivity.this,Vehicle.class)); private void destination_next_buttonClick() { startActivity(new Intent(MainActivity.this,Vehicle.class)); }
downvote count: 0
score: 1

http://stackoverflow.com/comment/34707016
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/22766117
has text: Why is this a two dimensional array? Make it one dimensional and sort normally.

http://stackoverflow.com/q/22802605
has answer: http://stackoverflow.com/a/22806118
score: 2
tagged with: java
has body: Have a very basic scenario (at least in Maven world): We use latest grails 2.3.6 We have Core project(plugin) We have multiple other projects(app1, app2, app3) depending on Core project Resolution block inside of BuildConfig has "pom true" and dependencies between modules are set up inside of pom.xml This set up works pretty well outside of intellij - you build and deploy Core project to your local maven repo then you build other projects. But in intelliJ I would expect to be able to modify both project(app1 and core) at the same time without having to rebuild core project every time I touch it. I imported app1 to intellij then added core as a module. Then everything compiled and built fine BUT whenever I try to click on a reference to a class in core from app1 it opens another dependency from target/work/plugins/app1 I tried disabling that directory but it didn't work... Any suggestions?
tagged with: grails
linked to: http://stackoverflow.com/q/8152183
type: Question
upvote count: 2
has title: Multi-module Grails project in Intellij
tagged with: intellij-idea
answer count: 1
favorite count: 0
downvote count: 0
type: UnansweredQuestion
tagged with: maven

http://stackoverflow.com/q/22777111
tagged with: java
has comment: http://stackoverflow.com/comment/34726562
type: Question
tagged with: session
score: 0
has comment: http://stackoverflow.com/comment/34726676
has title: Iterating through an ArrayList<Object> "cannot be resolved or is not a field"
tagged with: jsp
has comment: http://stackoverflow.com/comment/34726805
linked to: http://stackoverflow.com/q/4535423
has comment: http://stackoverflow.com/comment/34726644
type: UnansweredQuestion
has body: Error An error occurred at line: 18 in the jsp file: /BookStoreHome.jsp title cannot be resolved or is not a field 15: &lt;% 16: ArrayList&lt;Book&gt; book_list = (ArrayList&lt;Book&gt;)session.getAttribute("books"); 17: for (int i = 0; i &lt; book_list.size(); i++) {%&gt; 18: &lt;%= book_list.get(i).title %&gt;, 19: &lt;% } %&gt; 20: 21: &lt;/body&gt; First I am setting the books as an ArrayList and storing in a session. User Logic Class ArrayList&lt;Book&gt; book_list = bsl.selectBooks(); session.setAttribute("books", book_list); Book Class public class Book { public String isbn; public String title; public double price; public String genre; public int format; public String publisher; public int publisherYear; public int count; public String author; public String date; public Book(String _isbn, String _title, double _price, String _genre, int _format, String _publisher, int _publisheryear, int _count, String _author){ title = _title; isbn = _isbn; price = _price; genre = _genre; format = _format; publisher = _publisher; publisherYear = _publisheryear; count = _count; author = _author; }
has comment: http://stackoverflow.com/comment/34726785
answer count: 0
linked to: http://stackoverflow.com/q/5893183

http://stackoverflow.com/comment/34606882
has text: You are not wrong, what I can think about is that this situation is a result of a "common practice" (even in javascript we can find similar behaviours) like Mike just wrote.
comment on: http://stackoverflow.com/a/22710260
score: 0
type: AnswerComment
type: Comment

http://stackoverflow.com/comment/34572780
has text: What Java Runtime are you taking about (manufacturer, platform & version)?
comment on: http://stackoverflow.com/q/22691658
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/a/22799516
type: Answer
answers question: http://stackoverflow.com/q/22799502
has body: The bracket position makes no difference; white space is not relevant in java. You can write everything on one line if you like; even the entire program. Though, for readability sake, you should split it up! :)
score: 0
has comment: http://stackoverflow.com/comment/34766998

http://stackoverflow.com/q/22798309
tagged with: testing
has body: I was playing around with TestNG and found that @AfterMethod &amp; @BeforeMethod is getting invoked more than once when I'm using dataProvider. Is it possible to invoke a method only once after the @Test got executed with all the parameters passed from dataProvider. Like can we invoke 'tearDown' method only once after 'testPrimeNumberChecker' got called for 5 times by dataProvider. import org.testng.Assert; import org.testng.annotations.BeforeMethod; import org.testng.annotations.DataProvider; import org.testng.annotations.Test; public class ParamTestWithDataProvider1 { private PrimeNumberChecker primeNumberChecker; private static final Logger logger = Logger.getLogger(ParamTestWithDataProvider1.class); @BeforeMethod public void initialize() { logger.info("Before Method Fired !! - " ); primeNumberChecker = new PrimeNumberChecker(); } @@AfterMethod public void tearDown() { logger.info("After Method Fired !! " ); } @DataProvider(name = "test1") public static Object[][] primeNumbers() { return new Object[][] { { 2, true }, { 6, false }, { 19, true }, { 22, false }, { 23, true } }; } @Test(dataProvider = "test1") public void testPrimeNumberChecker(Integer inputNumber, Boolean expectedResult) { logger.info(inputNumber + " " + expectedResult); Assert.assertEquals(expectedResult, primeNumberChecker.validate(inputNumber)); } }
type: AnsweredQuestion
downvote count: 0
possible better answer: http://stackoverflow.com/a/22807570
has answer: http://stackoverflow.com/a/22859108
has answer: http://stackoverflow.com/a/22807570
favorite count: 0
type: Question
accepted answer: http://stackoverflow.com/a/22859108
has answer: http://stackoverflow.com/a/63582265
tagged with: testng
score: 4
tagged with: java
has title: TestNG @AfterMethod with DataProvider
answer count: 3
tagged with: unit-testing
upvote count: 4

http://stackoverflow.com/comment/34819959
type: Comment
comment on: http://stackoverflow.com/a/22808664
type: AnswerComment
score: 1
has text: upvoting both of you just for the comaradarie shown in discussing and solving the problem at hand :)

http://stackoverflow.com/a/22805344
score: 0
type: Answer
has body: Do UUID in Java for String objects will be the same if those strings are equal? No, since this prints false: final String s = "Mémé dans les orties "; final UUID uuid1 = UUID.nameUUIDFromBytes(s.getBytes(StandardCharsets.UTF_8)); final UUID uuid2 = UUID.nameUUIDFromBytes(s.getBytes(StandardCharsets.UTF_16LE)); System.out.println(uuid1.equals(uuid2)); You need to encode the String into a byte array and use the same encoding on both sides. What is more, a UUID is not a hash per se; if you want hashes like sha1, sha256 etc, have a look at Guava
answers question: http://stackoverflow.com/q/22805183

http://stackoverflow.com/a/22775564
type: Answer
score: 0
has body: You're sending to port 5555 but you're receiving on port 5556. You'd be better off keeping the server's DatagramSocket open for the life of the process.
answers question: http://stackoverflow.com/q/22772756

http://stackoverflow.com/a/22734939
upvote count: 7
downvote count: 0
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/22734767
type: Answer
answers question: http://stackoverflow.com/q/22734767
score: 7
has body: You need to add the .jar files your app need to $TOMCAT/webapps/$YOUR_WEB_APP/WEB-INF/lib/ and then restart tomcat.

http://stackoverflow.com/comment/34544277
comment on: http://stackoverflow.com/q/22675242
score: 0
type: Comment
has text: It gave me +5 so here is the link to them from postimage.org: http://postimg.org/image/q6mypo7rp/ and http://postimg.org/image/g1prww0rb/
type: QuestionComment

http://stackoverflow.com/q/22666439
type: UnansweredQuestion
has title: Can't get Nested Fragments to work, Can't resolve getChildFragmentManager
has comment: http://stackoverflow.com/comment/34536573
tagged with: android-fragments
tagged with: java
type: Question
has comment: http://stackoverflow.com/comment/34527442
tagged with: android-nested-fragment
answer count: 1
has body: I've been working on this problem for hours now. My simple app displays a google map in a fragment. Upon some actions I want an fragment overlay on top of this map, so upon recieving a onClickListener event, I'm trying to run: void addfragment() { Fragment placeDetails = new PlaceDetailsFragment(); FragmentTransaction transaction = getChildFragmentManager().beginTransaction(); transaction.add(R.id.details, placeDetails).commit(); } per the example at http://developer.android.com/about/versions/android-4.2.html#NestedFragments I auto imported the following classes: import android.app.Fragment; import android.app.FragmentTransaction; Every type and method could be resolved, except getChildFragmentManager. After doing some digging, I sort of had to guess that getChildFragmentManager is not part of the normal Fragment lib, but i had to install the support libraries, v4 especially. So I installed v7, which also includes the v4 jar, and went back to re-import the fragment classes: import android.support.v4.app.Fragment; import android.support.v4.app.FragmentTransaction; GetChildFragmentManager still can't be resolved. I tried manually adding import android.support.v4.app.FragmentManager; since, getChildFragmentManager is a method of fragment that should return a FragmentManager, but still no resolving. I feel as if i'm doing something very wrong, and googling doesn't help me much. They keep talking about moving the v4.jar to the ActionBarSherlock's lib directory, but I don't have nor need that in this project. I might get a normal Action Bar later, but I can't see why that would be needed for nested fragments. Also, I am compiling with API 18, to a minSDKversion 18 and targetSDK version 18, so why would I even need the support library? It's a 4.2 feature, SDK 17, it should be in SDK 18 as well, correct? Wouldn't the use of the support library only be for lower SDK's, as stated in the docs? The Android Support Library also now supports nested fragments, so you can implemen…
score: 0
has answer: http://stackoverflow.com/a/22667148
tagged with: android
has comment: http://stackoverflow.com/comment/34527170
tagged with: android-support-library
linked to: http://stackoverflow.com/q/6847460

http://stackoverflow.com/q/22787018
type: UnansweredQuestion
has body: I am working on a Eclipse RPC project. I need to save and restore everything of all views . I am not using EMF in my project so i can not use all EMF API's. Now what can I use is IMemento. IViewPart have a saveState method with IMemento as a parameter. I am invoking saveState() and try to put this in view. Sample code: @Override public void saveState(IMemento memento) { ColorBarModel model = _multiColorBarContainer.getColorBar().getColorBarUIModel().getModel(); boolean isCutOff = _multiColorBarContainer.getColorBar().getColorBarUIModel().isCutOffEnabled(); String colorMapName = model.getColorMap().getColorMapName(); memento.putString("colorMapName", model.toString()); memento.createChild("colorMapName1", model.toString()); String selectionsMomento = memento.getString("colorMapName"); IStructuredSelection ss = new StructuredSelection(memento.getChild("colorMapName1")); } I need to save model which is a reference of class (ColorBarModel.java is model for my view), so that i can save the model state and restore it on invoking. But IMemento only provide putString(), createChild() method Can someone guide me to how can I save the class object through IMemento and restore it when ever needed? I am able to save the reference ID of that class , but I am not sure how to fetch property and behaviour of that class through referenceId in string form. Is it possible to fetch that somehow?
answer count: 4
has comment: http://stackoverflow.com/comment/34789511
has answer: http://stackoverflow.com/a/22868219
has title: How to save view part with EMF
upvote count: 3
has comment: http://stackoverflow.com/comment/34745249
has answer: http://stackoverflow.com/a/22812543
type: Question
score: 3
tagged with: java
tagged with: eclipse
downvote count: 0
tagged with: eclipse-plugin
favorite count: 0
tagged with: eclipse-rcp
has answer: http://stackoverflow.com/a/48642691
has answer: http://stackoverflow.com/a/36715407

gmail
type: Tag
tags question: http://stackoverflow.com/q/22778480
tag name: gmail
tags question: http://stackoverflow.com/q/22772876

http://stackoverflow.com/comment/34649487
has text: you can use an sqlite db and query it, but you can also return a MatrixCursor with the search items, i dont know which one is better for your case, you choose, what is different? it is sooo simple
comment on: http://stackoverflow.com/q/22733524
score: 0
type: QuestionComment
type: Comment

http://stackoverflow.com/comment/34629818
type: Comment
has text: I guess what I'm struggling with is the constructor method, and how to define that aBook variable. Where would I place these?
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/22722157

http://stackoverflow.com/comment/34682239
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/22752564
has text: The error message is quite clear. You have an illegal modifier. In particular, the "static" keyword is causing the error.

http://stackoverflow.com/a/22698125
has comment: http://stackoverflow.com/comment/34586627
score: 6
type: Answer
has comment: http://stackoverflow.com/comment/34585023
has comment: http://stackoverflow.com/comment/34586303
upvote count: 6
has comment: http://stackoverflow.com/comment/34585379
has comment: http://stackoverflow.com/comment/34586785
has comment: http://stackoverflow.com/comment/34586766
has comment: http://stackoverflow.com/comment/34586149
has comment: http://stackoverflow.com/comment/34587291
has comment: http://stackoverflow.com/comment/34586882
has body: Answer There is an extremely easy solution if you know that: -45 &lt; roundedRect.angle &lt; 45 roundedRect.size.height &gt; roundedRect.size.width If that is true, then the points, in clockwise order, will ALWAYS be in this order: pts[0], pts[3], pts[2], pts[1] As an aside, if it doesn't harm your program too much, the points are delivered in counterclockwise order, starting with the top left... then you wouldn't have to do any reordering / sorting. Other cases: height &gt; width &amp;&amp; 135 &lt; roundedRect.angle &lt; 225 The clockwise order starting from the top left is 2,3,0,1 The counterclockwise order from top left is 2,1,0,3. width &gt; height &amp;&amp; -135 &lt; roundedRect.angle &lt; -45 The clockwise order starting from the top left is 3,2,1,0 The counterclockwise order from top left is 3,0,1,2 width &gt; height &amp;&amp; 45 &lt; roundedRect.angle &lt; 135 The clockwise order starting from the top left is 1,0,3,2 The counterclockwise order from top left is 1,2,3,0 The remaining cases would all imply that the rectangle is bigger from left to right than it is from top to bottom, which cannot happen in your scenario. Also, if the angle is outside these ranges, you can add or subtract 360 successively to get an angle in one of these ranges. Explanation (tl;dr) We know this from how OpenCV calculates the values of those points. You can figure this out with a little experimentation. Here's a little program I wrote that demonstrates it: import java.awt.BorderLayout; import java.awt.Dimension; import java.awt.EventQueue; import java.awt.Graphics; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import javax.swing.JComponent; import javax.swing.JFrame; import javax.swing.JPanel; import javax.swing.Timer; import org.opencv.core.Point; import org.opencv.core.RotatedRect; import org.opencv.core.Size; public class TestFrame extends JFrame { public static void main(String... args) { final TestFrame frame = new TestFrame(); EventQueue.invokeL…
answers question: http://stackoverflow.com/q/22696539
accepted answer of: http://stackoverflow.com/q/22696539
has comment: http://stackoverflow.com/comment/34585127
type: AcceptedAnswer
downvote count: 0

http://stackoverflow.com/q/22681629
has comment: http://stackoverflow.com/comment/34554119
score: -1
tagged with: sorting
has answer: http://stackoverflow.com/a/22681742
accepted answer: http://stackoverflow.com/a/22681743
answer count: 3
upvote count: 0
has comment: http://stackoverflow.com/comment/34554180
possible better answer: http://stackoverflow.com/a/22681742
has answer: http://stackoverflow.com/a/22681787
favorite count: 0
has title: Sorting array of doubles
tagged with: double
has body: I've array of doubles and I'm sorting it using Arrays.sort problem is that in the output array I've something like this(this is array output after reverse): 0.002385171991295645 ... 9.914204103773398E-4 ... 1.00139601969068E-4 9.975711760353395E-5 and so on, as we can see shortest number are at the top and longest are at the bottom. Numbers in given range e.g. E-4 are sorted good. I've even created a sample code to test this: double l1 = 0.002385171991295645; double l2 = 9.914204103773398E-4; if(l1 &gt; l2) { System.out.println("TRUE"); } else { System.out.println("FALSE"); } And it gives me "TRUE", how to sort this array?
has comment: http://stackoverflow.com/comment/34554146
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/34554145
tagged with: java
has answer: http://stackoverflow.com/a/22681743
downvote count: 1
type: Question
tagged with: arrays

http://stackoverflow.com/comment/34611778
score: 0
has text: @InnocentKiller According to what you write you should change Prevvalue only inside slidermenu. just before you choose to open new activity. Cause it should hold previous not current. But in your example you are holding current activity when trying to assign it inside OnCreate
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/22712674

http://stackoverflow.com/a/22797106
has comment: http://stackoverflow.com/comment/34762585
answers question: http://stackoverflow.com/q/22797068
downvote count: 0
type: Answer
has comment: http://stackoverflow.com/comment/34762610
upvote count: 1
has body: while(redo = true); This is an assignment instead of a comparison. This will always be true. while(redo == true); is what you meant to type, but while(redo); is what you really want because it makes it impossible to commit the assignment-instead-of-comparison error. When you compare a constant other than a boolean and a variable it's always best to put the constant first for the same reason. if (1 == someInt) instead of if (someInt == 1) If you accidentally use = instead of == the constant-first form won't compile.
score: 1

http://stackoverflow.com/a/22901860
upvote count: 1
type: AcceptedAnswer
answers question: http://stackoverflow.com/q/22789966
type: Answer
accepted answer of: http://stackoverflow.com/q/22789966
downvote count: 0
score: 1
has body: I think however what you really want is for the namespaces of the types to be the same. The namespaces of the services don't really matter all that much. As long as the types have a common namespace you'll achieve some degree of commonality. I can't speak for .NET, but in the Java world, wsimport of three separate WSDLs will generate three sets of code. However, if the types are in a common namespace across the WSDLs / schemas, then two of the three times generate the same identical code. If generating from the three WSDLs into the same client project (jar, war, etc) should result in overwriting the common bits of code twice. In your common classes, you can annotate them to have a specific xml namespace. If I recall, not doing so causes them to be declared in the namespace of the service within the generated WSDL's associated XSDs. package com.example.services.base; @XmlRootElement @XmlType(namespace="http://services.example.com/base") public class BaseRequest { //... }

http://stackoverflow.com/q/22756153
has answer: http://stackoverflow.com/a/25064342
has comment: http://stackoverflow.com/comment/72067570
has comment: http://stackoverflow.com/comment/34688871
has comment: http://stackoverflow.com/comment/34688796
has comment: http://stackoverflow.com/comment/37563297
has answer: http://stackoverflow.com/a/25065054
tagged with: maven
has answer: http://stackoverflow.com/a/28735245
has answer: http://stackoverflow.com/a/30592708
type: Question
has comment: http://stackoverflow.com/comment/34689047
linked to: http://stackoverflow.com/q/4076601
has answer: http://stackoverflow.com/a/31876250
has comment: http://stackoverflow.com/comment/77678128
tagged with: java
score: 465
has answer: http://stackoverflow.com/a/29053564
tagged with: eclipse
has answer: http://stackoverflow.com/a/25266076
linked to: http://stackoverflow.com/q/26936848
has answer: http://stackoverflow.com/a/26122621
upvote count: 465
has answer: http://stackoverflow.com/a/33632479
answer count: 14
linked to: http://stackoverflow.com/q/16262948
has answer: http://stackoverflow.com/a/30161602
downvote count: 0
tagged with: jsp
has title: The superclass "javax.servlet.http.HttpServlet" was not found on the Java Build Path
linked to: http://stackoverflow.com/q/45357109
has comment: http://stackoverflow.com/comment/34688850
favorite count: 0
has answer: http://stackoverflow.com/a/24102549
has answer: http://stackoverflow.com/a/28683062
has answer: http://stackoverflow.com/a/25108272
has answer: http://stackoverflow.com/a/22756202
type: UnansweredQuestion
duplicate of: http://stackoverflow.com/q/4076601
has body: I have a project created by Maven integration in Eclipse. All work fine, but in the work space in all JSP files have this: The superclass "javax.servlet.http.HttpServlet" was not found on the Java Build Path To the first string where place: &lt;%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%&gt; When I create a basic dynamic web project and JSP in - all is fine, no errors.

jar
tags question: http://stackoverflow.com/q/22695553
tags question: http://stackoverflow.com/q/22763506
tags question: http://stackoverflow.com/q/22682809
tags question: http://stackoverflow.com/q/22681798
tags question: http://stackoverflow.com/q/22769799
tags question: http://stackoverflow.com/q/22694623
tags question: http://stackoverflow.com/q/22716209
tags question: http://stackoverflow.com/q/22739553
tags question: http://stackoverflow.com/q/22794839
tags question: http://stackoverflow.com/q/22676792
tags question: http://stackoverflow.com/q/22733807
tags question: http://stackoverflow.com/q/22695901
tags question: http://stackoverflow.com/q/22690550
tags question: http://stackoverflow.com/q/22777054
tags question: http://stackoverflow.com/q/22737371
tags question: http://stackoverflow.com/q/22738257
tags question: http://stackoverflow.com/q/22659716
tags question: http://stackoverflow.com/q/22662586
tags question: http://stackoverflow.com/q/22680462
type: Tag
tags question: http://stackoverflow.com/q/22799878
tags question: http://stackoverflow.com/q/22675443
tags question: http://stackoverflow.com/q/22805416
tags question: http://stackoverflow.com/q/22648384
tags question: http://stackoverflow.com/q/22735340
tags question: http://stackoverflow.com/q/22783023
tags question: http://stackoverflow.com/q/22796370
tags question: http://stackoverflow.com/q/22667237
tags question: http://stackoverflow.com/q/22789142
tags question: http://stackoverflow.com/q/22684795
tags question: http://stackoverflow.com/q/22707655
tags question: http://stackoverflow.com/q/22678192
tags question: http://stackoverflow.com/q/22651402
tags question: http://stackoverflow.com/q/22791474
tag name: jar
tags question: http://stackoverflow.com/q/22754018
tags question: http://stackoverflow.com/q/22765189
tags question: http://stackoverflow.com/q/22710526
tags question: http://stackoverflow.com/q/22781101
tags question: http://stackoverflow.com/q/22685103
tags question: http://stackoverflow.com/q/22681090
tags question: http://stackoverflow.com/q/22667063
tags question: http://stackoverflow.com/q/22662173
tags question: http://stackoverflow.com/q/22776177
tags question: http://stackoverflow.com/q/22735524
tags question: http://stackoverflow.com/q/22745710
tags question: http://stackoverflow.com/q/22707476
tags question: http://stackoverflow.com/q/22784502
tags question: http://stackoverflow.com/q/22796053
tags question: http://stackoverflow.com/q/22755238
tags question: http://stackoverflow.com/q/22684092
tags question: http://stackoverflow.com/q/22697324
tags question: http://stackoverflow.com/q/22795183
tags question: http://stackoverflow.com/q/22802016

http://stackoverflow.com/comment/34759693
comment on: http://stackoverflow.com/a/22795250
type: Comment
has text: Could you please explain in more detail? Or provide an example? Thanks in advance.
type: AnswerComment
score: 0

http://stackoverflow.com/q/22743109
tagged with: java
has comment: http://stackoverflow.com/comment/34665324
has body: In this i'm trying to get the dates from mysql database and display those dates in a jDayChooser by setting a color.But in JPanel jPanel = jDayChooser1.getDayPanel() im getting the error 'NullPointerException'. public Calender() { // retrieving the dates from db getDates c = new getDates(); Date[] a = c.Dates(); Calendar cal = Calendar.getInstance(); int day = cal.get(Calendar.DAY_OF_MONTH); int month = cal.get(Calendar.MONTH); int year = cal.get(Calendar.YEAR); JPanel jPanel = jDayChooser1.getDayPanel(); Component component[] = jPanel.getComponents(); for(int i=0;i&lt;a.length;i++) { if(month == a[i].getMonth() &amp;&amp; year == a[i].getYear()) { component[ a[i].getDay()].setBackground(Color.blue); } } initComponents(); } here's the stack trace... Exception in thread "AWT-EventQueue-0" java.lang.NullPointerException at greetingcard.Calender.&lt;init&gt;(Calender.java:37) at greetingcard.Calender$1.run(Calender.java:100) at java.awt.event.InvocationEvent.dispatch(InvocationEvent.java:251) at java.awt.EventQueue.dispatchEventImpl(EventQueue.java:721) at java.awt.EventQueue.access$200(EventQueue.java:103) at java.awt.EventQueue$3.run(EventQueue.java:682) at java.awt.EventQueue$3.run(EventQueue.java:680) at java.security.AccessController.doPrivileged(Native Method) at java.security.ProtectionDomain$1.doIntersectionPrivilege(ProtectionDomain.java:76) at java.awt.EventQueue.dispatchEvent(EventQueue.java:691) at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:242) at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:161) at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:150) at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:146) at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:138) at java.awt.EventDispatchThread.run(EventDispatchThread.java:91) BUILD SUCCESSFUL (total time: 5 seconds)
tagged with: calendar
type: Question
tagged with: jdatechooser
has comment: http://stackoverflow.com/comment/34665442
has comment: http://stackoverflow.com/comment/34665002
score: 0
tagged with: nullpointerexception
has comment: http://stackoverflow.com/comment/34665577
answer count: 1
linked to: http://stackoverflow.com/q/16234388
has title: Getting NullPointerException in JPanel jPanel = jDayChooser1.getDayPanel()
has comment: http://stackoverflow.com/comment/34666251
type: UnansweredQuestion
tagged with: swing
has answer: http://stackoverflow.com/a/22770724
has comment: http://stackoverflow.com/comment/34664813

http://stackoverflow.com/comment/34581805
comment on: http://stackoverflow.com/q/22691820
has text: Yeah I didn't try literally EVERYTHING, but I DID try that... And like the next 5 pages of Google .-.
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/59347920
score: 2
type: AnswerComment
has text: The socketTimeout value is seconds / milliseconds ? is quite unclear to me from the java docs, as it is not specified.
type: Comment
comment on: http://stackoverflow.com/a/22722260

http://stackoverflow.com/comment/34643186
type: AnswerComment
score: 0
type: Comment
has text: @RaulGuiu Thanks, just implemented that but I'm getting an error in the accept method on line "new Thread (new ClientSocket(clientSocket)).start();" It says ClientSocket cannot be resolved to a type
comment on: http://stackoverflow.com/a/22730388

http://stackoverflow.com/a/22690157
has comment: http://stackoverflow.com/comment/34666439
score: 0
answers question: http://stackoverflow.com/q/22689069
has body: What is the point of this if statement? // set background to current time lastTimeBg = TimeUtils.nanoTime(); // move the separator every 100000 nanoseconds if(TimeUtils.nanoTime() - lastTimeBg &gt; 1000000) { Do you really want to see if it took 100000 nanoseconds to get from the the line before the if to the if itself? Oh and try just using com.badlogic.gdx.utils.Timer.
type: Answer

http://stackoverflow.com/q/22731941
answer count: 2
has answer: http://stackoverflow.com/a/22732345
downvote count: 0
favorite count: 0
possible better answer: http://stackoverflow.com/a/22732345
has body: EntityManager maintains first level cache for retrieved objects, but if you want to have threadsafe aplication you're creating and closing entityManager for each transaction. So whats the point of the level 1 cache if those entities are created and closed for every transaction? Or entityManager cache is usable if youre working in single thread?
has answer: http://stackoverflow.com/a/22732351
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/34646474
tagged with: java
linked to: http://stackoverflow.com/q/22732416
tagged with: first-level-cache
type: Question
score: 5
accepted answer: http://stackoverflow.com/a/22732351
upvote count: 5
tagged with: jpa
has title: JPA and first level cache, whats the point?

http://stackoverflow.com/a/22716132
has body: You can take a look at how they do it in Spring Batch Admin too, the JobExecutionController in particular.
type: Answer
score: 0
answers question: http://stackoverflow.com/q/22686718

http://stackoverflow.com/comment/34681628
comment on: http://stackoverflow.com/q/22733176
score: 0
has text: I don't see much of anything wrong with just using the _Environment_ in this manner. It doesn't save much in terms of injecting it via Guice and doesn't take away from testability.
type: Comment
type: QuestionComment

http://stackoverflow.com/a/22730055
score: -1
upvote count: 2
downvote count: 3
has comment: http://stackoverflow.com/comment/34643323
has comment: http://stackoverflow.com/comment/34643556
has body: C++11 has a lot of new features for string literals. Bjarne Stroustrup's C++11 FAQ - Raw string literals Wikipedia - C++11 - New string literals
has comment: http://stackoverflow.com/comment/34641893
type: Answer
answers question: http://stackoverflow.com/q/22729927

http://stackoverflow.com/comment/34579858
score: 1
has text: @Sam please see this repository: https://bitbucket.org/mvlasceanu/programming-workshop-ludo-game/src/06dfc0eaa5b5c0f5ac436768ace8a07c6e2f67ab/src/dk/itu/pw/ludo/ludoboard/?at=master
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/22694596

http://stackoverflow.com/a/22778579
answers question: http://stackoverflow.com/q/22778509
type: Answer
score: 3
upvote count: 3
has body: OutputStreamWriter osw NO! A Writer is made to write text, not binary. In the first place, it looks like you read text as well, which you shouldn't. Use an InputStream to read the original content, and an OutputStream to write into the file: final OutputStream out = /* open your file using a FileOutputStream here */; final byte[] buf = new byte[8096]; // size as appropriate // "in" is the InputStream from the socket int count; try { while ((count = in.read(buf)) != -1) out.write(buf, 0, count); out.flush(); } finally { out.close(); }
downvote count: 0

http://stackoverflow.com/comment/34546814
comment on: http://stackoverflow.com/a/22677243
has text: The line that spits the problem is `if (inventoryItem.getPartNumber() == partNumber)` That gets highlighted and says the error.
score: 0
type: AnswerComment
type: Comment

http://stackoverflow.com/q/22682432
answer count: 1
tagged with: web
favorite count: 0
has body: I'm building a Play! framework application and i'm required to implement a pki authentication with a smart card. I've been searching for a few weeks and can't seem to find exactly what I'm looking for. I want that with the client entering the site a window will pop that enables the client to enter his smart card PIN code in order for him to authenticate to the app. After the client enters his PIN code the app will verify him if the code is right and recieve the identity from the card and from that point he will be able to continue freely.
type: UnansweredQuestion
has title: Java smart card authenticaton PKI
has answer: http://stackoverflow.com/a/22683001
downvote count: 0
score: 1
tagged with: java
type: Question
tagged with: security
upvote count: 1

http://stackoverflow.com/comment/34563376
comment on: http://stackoverflow.com/a/22686688
has text: Accepting the answer would be greatly appreciated ;)
score: 0
type: AnswerComment
type: Comment

http://stackoverflow.com/q/22656891
has comment: http://stackoverflow.com/comment/34513704
tagged with: jmenuitem
has body: my question in very simple. I have a JPopupMenu that shown two JMenuItem. The only way I have found to know which item are clicked using class MenuActionListener implements ActionListener { public void actionPerformed(ActionEvent e) { System.out.println("Selected: " + e.getActionCommand()); } } but the command e.getActionCommand() print the text inside the item. I would like get an index from 0 to n to known which item are clicked and not the text (that can be modified). Is it possible ?
type: Question
upvote count: 2
possible better answer: http://stackoverflow.com/a/22657622
accepted answer: http://stackoverflow.com/a/22660668
answer count: 3
has title: JPopupMenu know which JMenuItem are clicked
downvote count: 1
favorite count: 0
tagged with: jpopupmenu
has answer: http://stackoverflow.com/a/22660668
has comment: http://stackoverflow.com/comment/34510502
has comment: http://stackoverflow.com/comment/34516501
has answer: http://stackoverflow.com/a/39164868
tagged with: swing
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/22657622
score: 1
tagged with: java

http://stackoverflow.com/a/22694900
has body: I don't know why you would code the Shuffle logic yourself. Java Collections has a built-in Shuffle: http://docs.oracle.com/javase/7/docs/api/java/util/Collections.html#shuffle(java.util.List). There is one that takes a Random too: http://docs.oracle.com/javase/7/docs/api/java/util/Collections.html#shuffle(java.util.List, java.util.Random) Turn your Array into a List, let Collections shuffle it, turn the list back to an array.
score: 2
upvote count: 2
downvote count: 0
answers question: http://stackoverflow.com/q/22694804
has comment: http://stackoverflow.com/comment/34578313
type: Answer

http://stackoverflow.com/comment/34536975
comment on: http://stackoverflow.com/q/22669602
type: Comment
type: QuestionComment
has text: There's the synchronization, so there's no waiting.
score: 0

http://stackoverflow.com/comment/34727155
comment on: http://stackoverflow.com/q/22777504
score: 0
type: QuestionComment
type: Comment
has text: my program giving me an html file where all data is available

http://stackoverflow.com/comment/34596762
type: Comment
has text: @user3467373 No problem at all. :-)
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/22704133

http://stackoverflow.com/a/30572331
has body: Following [jhipster releases] (https://jhipster.github.io/2015/05/31/jhipster-release-2.14.2.html): How to upgrade Update your version of JHipster with: npm update -g generator-jhipster And then you can update your project when you run again yo jhipster You can also update your entities by running again the entity sub-generator, for example if your entity is named Foo yo jhipster:entity Foo
answers question: http://stackoverflow.com/q/22680663
has comment: http://stackoverflow.com/comment/61706249
has comment: http://stackoverflow.com/comment/61722894
score: 9
type: Answer
upvote count: 9
downvote count: 0

http://stackoverflow.com/a/22746417
has comment: http://stackoverflow.com/comment/34686066
has comment: http://stackoverflow.com/comment/34673153
type: Answer
has comment: http://stackoverflow.com/comment/34674546
has comment: http://stackoverflow.com/comment/34673405
has comment: http://stackoverflow.com/comment/34673486
has comment: http://stackoverflow.com/comment/34687113
score: 3
has body: The real issue here that annotation configuration is loaded before any imported XML and you really have to move the property-placeholder configuration to the @Configuration: @Configuration @PropertySource("classpath:db.properties") public class HibernateConfiguration { @Bean public static PropertySourcesPlaceholderConfigurer propertySourcesPlaceholderConfigurer() { return new PropertySourcesPlaceholderConfigurer(); } } Pay attention, please, for the propertySourcesPlaceholderConfigurer bean definition. Without it you can get access to you properties from file only using autowired Environment. From here that property-placeholder configuration will be available for imported xml too. For more info see PropertySource JavaDocs
downvote count: 1
has comment: http://stackoverflow.com/comment/34675293
has comment: http://stackoverflow.com/comment/34696907
has comment: http://stackoverflow.com/comment/34674847
upvote count: 4
has comment: http://stackoverflow.com/comment/34674279
has comment: http://stackoverflow.com/comment/34675009
answers question: http://stackoverflow.com/q/22745684
has comment: http://stackoverflow.com/comment/34674152

http://stackoverflow.com/comment/34509489
type: Comment
comment on: http://stackoverflow.com/a/22656383
score: 0
type: AnswerComment
has text: glad that it met your expectations.

http://stackoverflow.com/q/22759795
has comment: http://stackoverflow.com/comment/34700286
answer count: 1
tagged with: hbase
has title: org.apache.hadoop.hbase.MasterNotRunningException
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/34727781
has answer: http://stackoverflow.com/a/22778394
has body: Here i am trying to create table using hbase. Here org.apache.hadoop.hbase.MasterNotRunningException will appear. HBaseConfiguration hbaseConfiguration = new HBaseConfiguration(new Configuration()); HTableDescriptor htable = new HTableDescriptor("Test"); htable.addFamily(new HColumnDescriptor("Id")); htable.addFamily(new HColumnDescriptor("Name")); HBaseAdmin hbaseAdmin = new HBaseAdmin(hbaseConfiguration); hbaseAdmin.createTable(htable);
tagged with: java
type: Question
tagged with: hadoop
score: 0

http://stackoverflow.com/q/22653599
type: Question
has comment: http://stackoverflow.com/comment/34504550
downvote count: 5
has title: Difference between obj1 = obj.clone() and obj1= obj
has answer: http://stackoverflow.com/a/22653680
has comment: http://stackoverflow.com/comment/34504525
has comment: http://stackoverflow.com/comment/34504517
answer count: 4
favorite count: 0
type: UnansweredQuestion
score: -4
has answer: http://stackoverflow.com/a/22653647
upvote count: 1
has body: Can someone please explain the difference between obj1 = obj.clone() and obj1 = obj?
has answer: http://stackoverflow.com/a/22653644
tagged with: clone
has answer: http://stackoverflow.com/a/22653650
tagged with: java

http://stackoverflow.com/a/22696333
has body: Methods, including main, have to have their encode enclosed in curly braces. So: public static void main (String[] args); should be public static void main (String[] args) { Also, curly braces { } and parentheses ( ) have to balance either other out. This can be tricky when writing an "anonymous class" used as a listener. Frame frame = newCricleDraw(); frame.addWindowListener(new WindowAdapter() {public void windowClosing (WindowEvent we) { system.exit(0); } // This closes the { two lines above } // This closes the { just before "public" At this point, you have an open (, just before the word new, so you can't close it with a }. Change };//end of listener to this (using a right parenthesis): ); // end of listener Then, you need a semicolon after this: frame.setSize(600,600);
type: Answer
answers question: http://stackoverflow.com/q/22696134
downvote count: 0
score: 2
upvote count: 2

http://stackoverflow.com/q/22696499
type: Question
possible better answer: http://stackoverflow.com/a/22696553
accepted answer: http://stackoverflow.com/a/22696586
has answer: http://stackoverflow.com/a/22696553
has title: How synchronization block works?
score: 0
answer count: 2
tagged with: synchronization
has body: Bug Code public class Scheduler { private Object lock = new Object(); private int interval; private int period; public Scheduler(int interval , int period) { this.interval = interval; this.period = period; } public synchronized void setInterval(int interval) { this.interval = interval; } public synchronized void setPeriod(int period) { this.period = period; } public void updateScheduler(int interval , int period) { synchronized(lock) { setPeriod(period); setInterval(interval); } } } I have some threadsafe issues in my code to find those , I ran thread safe eclipse plugin in my project. Thread Safe Report Mixed synchronization in Scheduler Class Bug Description For the avoidance of dataraces, it is important that fields that are accessed concurrently are consistently guarded by a common lock. If the same lock object is not held each time a field is accessed, a datarace can occur. Fixed Code public class Scheduler { private Object lock = new Object(); private int interval; private int period; public Scheduler(int interval , int period) { this.interval = interval; this.period = period; } public void setInterval(int interval) { synchronized(lock) { this.interval = interval; } } public void setPeriod(int period) { synchronized(lock) { this.period = period; } } public void updateScheduler(int interval , int period) { synchronized(lock) { setPeriod(period); setInterval(interval); } } } I tested this code , it works fine. My question is , I am invoking setPeriod and setInteval from inside of updateScheduler. When updateScheduler is called , the object lock is already locked then i am calling setInterval and updateScheduler but the lock was not released. I am expecting the code will end up in dead lock. But , it is not happened why?
has answer: http://stackoverflow.com/a/22696586
type: AnsweredQuestion
tagged with: java
tagged with: multithreading

http://stackoverflow.com/q/22661757
upvote count: 3
tagged with: keystore
has answer: http://stackoverflow.com/a/22664039
accepted answer: http://stackoverflow.com/a/22664039
has title: Encrypt followed by decrypt does not return original byte array?
has comment: http://stackoverflow.com/comment/34519701
has comment: http://stackoverflow.com/comment/34519366
has body: I have a PrivateKeyEntry entry in my Java KeyStore (.jks) file. I am able to build a KeyStore instance from this .jks file as follows: KeyStore keystore = KeyStore.getInstance("JKS"); keystore.load(keystoreFileInputStream, passwordCharArray); I am able to extract PrivateKey and PublicKey instances from keystore as follows: PrivateKey privateKey = (PrivateKey) keystore.getKey(alias, passwordCharArray); PublicKey publicKey = keystore.getCertificate(alias).getPublicKey(); I encrypt an array of bytes inputBytes as follows: Cipher cipher = Cipher.getInstance("RSA/ECB/NoPadding"); cipher.init(Cipher.ENCRYPT_MODE, publicKey); byte[] encryptedBytes = cipher.doFinal(inputBytes, 0, 128); I do the reverse and decrypt encryptedBytes as follows: Cipher cipher = Cipher.getInstance("RSA/ECB/NoPadding"); cipher.init(Cipher.DECRYPT_MODE, privateKey); byte[] decryptedBytes = cipher.doFinal(encryptedBytes, 0, 128); However, the bytes in decryptedBytes are significantly different from the bytes in inputBytes. They should be the same. What have I done wrong?! If it's important, I created by Java KeyStore file using KeyTool. Specifically, the following command: keytool -genkey -alias my_alias -keyalg RSA -keystore my_keystore.jks -keysize 1024
tagged with: encryption
has comment: http://stackoverflow.com/comment/34519502
type: AnsweredQuestion
score: 3
downvote count: 0
tagged with: java
tagged with: rsa
type: Question
answer count: 1
has comment: http://stackoverflow.com/comment/34520830
tagged with: keytool
favorite count: 0

http://stackoverflow.com/a/22723928
downvote count: 0
has body: You may certainly have two Scanner objects read from the same File object simultaneously. Advancing one will not advance the other. Example Assume that the contents of myFile are 123 abc. The snippet below File file = new File("myFile"); Scanner strFin = new Scanner(file); Scanner numFin = new Scanner(file); System.out.println(numFin.nextInt()); System.out.println(strFin.next()); ... prints the following output... 123 123 However, I don't know why you would want to do that. It would be much simpler to use a single Scanner for your purposes. I called mine fin in the following snippet. String next; ArrayList&lt;Integer&gt; readIntegers = new ArrayList&lt;&gt;(); while (fin.hasNext()) { next = fin.next(); while (next.equals("load") { next = fin.next(); while (isInteger(next)) { readIntegers.Add(Integer.parseInt(next)); next = fin.next(); } } }
answers question: http://stackoverflow.com/q/22723630
type: Answer
has comment: http://stackoverflow.com/comment/57018957
has comment: http://stackoverflow.com/comment/57019111
upvote count: 2
has comment: http://stackoverflow.com/comment/57019258
score: 2

http://stackoverflow.com/q/22726946
accepted answer: http://stackoverflow.com/a/22727085
score: 0
answer count: 2
linked to: http://stackoverflow.com/q/936377
tagged with: generics
has answer: http://stackoverflow.com/a/22727085
has comment: http://stackoverflow.com/comment/34636856
has comment: http://stackoverflow.com/comment/34636741
has answer: http://stackoverflow.com/a/22727091
type: AnsweredQuestion
tagged with: java
has body: I am getting a compilation error. I want my static method here to return a factory that creates and return Event&lt;T&gt; object. How can I fix this? import com.lmax.disruptor.EventFactory; public final class Event&lt;T&gt; { private T event; public T getEvent() { return event; } public void setEvent(final T event) { this.event = event; } public final static EventFactory&lt;Event&lt;T&gt;&gt; EVENT_FACTORY = new EventFactory&lt;Event&lt;T&gt;&gt;() { public Event&lt;T&gt; newInstance() { return new Event&lt;T&gt;(); } }; }
has comment: http://stackoverflow.com/comment/34636999
has comment: http://stackoverflow.com/comment/34636728
type: Question
has title: Generic static factory
possible better answer: http://stackoverflow.com/a/22727091
has comment: http://stackoverflow.com/comment/34636714

http://stackoverflow.com/q/22786968
has comment: http://stackoverflow.com/comment/53172436
has comment: http://stackoverflow.com/comment/53330641
tagged with: excel
has comment: http://stackoverflow.com/comment/34745701
has answer: http://stackoverflow.com/a/35538313
has comment: http://stackoverflow.com/comment/38358866
has comment: http://stackoverflow.com/comment/54906560
has answer: http://stackoverflow.com/a/25292049
has answer: http://stackoverflow.com/a/28824677
tagged with: java
has comment: http://stackoverflow.com/comment/53319728
has comment: http://stackoverflow.com/comment/38370557
downvote count: 1
type: Question
has comment: http://stackoverflow.com/comment/34744114
has comment: http://stackoverflow.com/comment/53192628
has answer: http://stackoverflow.com/a/26185462
has body: I would like to know if anyone has any advice on handling damaged files with Apache POI I am trying to open a file and am receiving this message: Exception in thread "main" org.apache.poi.hssf.record.RecordInputStream$LeftoverDataException: Initialisation of record 0x1C left 2 bytes remaining still to be read. at org.apache.poi.hssf.record.RecordInputStream.hasNextRecord(RecordInputStream.java:156) at org.apache.poi.hssf.record.RecordFactoryInputStream.nextRecord(RecordFactoryInputStream.java:231) at org.apache.poi.hssf.record.RecordFactory.createRecords(RecordFactory.java:480) at org.apache.poi.hssf.usermodel.HSSFWorkbook.&lt;init&gt;(HSSFWorkbook.java:301) at org.apache.poi.ss.usermodel.WorkbookFactory.create(WorkbookFactory.java:95) at ExcelImporter.EditFileImportDialog.main(EditFileImportDialog.java:409) Here is an SSCCE import org.apache.poi.openxml4j.exceptions.InvalidFormatException; import org.apache.poi.ss.usermodel.Workbook; import org.apache.poi.ss.usermodel.WorkbookFactory; public class EditFileImportDialog { /* Omitted irrelevent code */ public static void main(String[] args) { File file = new File("Z:\\Path\\To\\File_causing_the_trouble.xls"); try { Workbook wb = WorkbookFactory.create(file); // Line 409 for ref to the exception stack trace System.out.println(wb); } catch (InvalidFormatException e) { e.printStackTrace(); } catch (IOException e) { e.printStackTrace(); } } } This happens with this file only, and the exception is not thrown if I open the file in excel and save it, then try to open it with POI. Any suggestion as to how I could handle this? EDIT: As a note, my issue may be related to this question, but upgrading POI did not fix my issue and there are dissimilarities with the described file. I have searched around for similar answers but perhaps if someone knows what's wrong with the excel file itself, I can write something to patch the file. EDIT 2 The file creation is not in my control. Excel fixes the file itself just upon opening and re-…
upvote count: 36
has comment: http://stackoverflow.com/comment/38198400
has comment: http://stackoverflow.com/comment/34744344
has comment: http://stackoverflow.com/comment/34745171
has title: Damaged file handling
has comment: http://stackoverflow.com/comment/37417345
has comment: http://stackoverflow.com/comment/38370513
has comment: http://stackoverflow.com/comment/53302732
score: 35
has comment: http://stackoverflow.com/comment/34757216
has comment: http://stackoverflow.com/comment/53342431
has answer: http://stackoverflow.com/a/31156627
favorite count: 0
has comment: http://stackoverflow.com/comment/53193111
tagged with: apache-poi
answer count: 5
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/53330782

http://stackoverflow.com/a/22806087
has body: Try creating your socket with parameter-less constructor and use connect() method with port and timeout parameter. This will prevent endless freeze.
downvote count: 2
has comment: http://stackoverflow.com/comment/34778443
answers question: http://stackoverflow.com/q/22805923
score: -2
upvote count: 0
type: Answer

http://stackoverflow.com/comment/34584825
comment on: http://stackoverflow.com/a/22698282
type: AnswerComment
score: 0
type: Comment
has text: Are you saying that there is absolutely no output, or that you are not seeing all the output you expect? Is the program exiting normally, or is the console displaying an uncaught exception?

http://stackoverflow.com/q/22704806
tagged with: java
tagged with: adt
has body: tutorial link So I pick from apk 8 through current one kitkat. I create application/project, The import android.support.v7.app.ActionBar is never used. The import android.os.Build is never used. and then I get the above errors from the MainActivity.java file regarding these two lines: import android.support.v7.app.ActionBar; import android.os.Build; And the graphical view of activity_main.xml shows no "Hello world!" text, and it sends me to the fragment_main.xml where the "Hello world!" text is on the top left. I'm pretty sure the tutorial I'm following is a bit outdated since it didn't show fragment xml and kitkat version. So was this all normal?
tagged with: eclipse
has comment: http://stackoverflow.com/comment/34596878
answer count: 2
accepted answer: http://stackoverflow.com/a/22704902
downvote count: 0
favorite count: 0
tagged with: android
has answer: http://stackoverflow.com/a/22705013
tagged with: http://stackoverflow.com/tag/xml
has comment: http://stackoverflow.com/comment/34596767
score: 1
has title: New to Android development and while following tutorial by teamtreehouse, I keep getting errors
has comment: http://stackoverflow.com/comment/34596840
possible better answer: http://stackoverflow.com/a/22705013
upvote count: 1
has answer: http://stackoverflow.com/a/22704902
type: Question
type: AnsweredQuestion

http://stackoverflow.com/q/22726896
type: AnsweredQuestion
downvote count: 0
score: 1
favorite count: 0
tagged with: timer
type: Question
accepted answer: http://stackoverflow.com/a/22726957
tagged with: java
upvote count: 1
tagged with: swing
answer count: 1
has title: Table model update + fireTableDataChanged() disrupts table selection
has answer: http://stackoverflow.com/a/22726957
has body: I have a JTable that tracks the amount of time a person has been waiting to be seated at a restaurant. My problem is that every second, when the timer 'ticks', the selection that is on a row is removed. In other words, if you click a row it becomes highlighted with a blue background and outline, but then when the timer ticks the blue goes away. ActionListener actListner = new ActionListener() { public void actionPerformed(ActionEvent event) { aTable.updateTime(); } }; Timer timer = new Timer(1000, actListner); timer.start(); This is in the main class public void updateTime() { data.updateTime(); fireTableDataChanged(); } This is in the table model public void updateTime() { Date newTime = new Date(); for (int i = 0; i &lt; startTime.size(); i++) { this.setTimeWaiting(i, hoursMin.format(new Date(newTime.getTime() - startTime.get(i).getTime()))); } } This is in the data model.
tagged with: jtable

http://stackoverflow.com/q/22739196
answer count: 1
tagged with: arraylist
has comment: http://stackoverflow.com/comment/34658198
tagged with: opengl-es-2.0
tagged with: android
has comment: http://stackoverflow.com/comment/34658170
type: AnsweredQuestion
has title: Android: Creating storage array for enemies
has body: I have a ArrayList for dynamically creating enemies in a game. When populating the list intuitively, the game crashes suddenly, presumably with a null pointer exception. The array is declared as such: ... ArrayList&lt;EntityPlayer&gt; EnemyList; and populated with the enemy contents: ... EnemyList.add(new EntityPlayer(mMVPMatrix, mActivityContext, R.drawable.enemy)); Suddenly, at this point, the program crashes with log: 03-30 01:03:02.066: W/dalvikvm(1348): threadid=11: thread exiting with uncaught exception (group=0xa6185908) 03-30 01:03:02.066: E/AndroidRuntime(1348): FATAL EXCEPTION: GLThread 102 03-30 01:03:02.066: E/AndroidRuntime(1348): java.lang.NullPointerException 03-30 01:03:02.066: E/AndroidRuntime(1348): at com.example.rr.ApplicationClass.GLRenderClass.onDrawFrame(GLRenderClass.java:143) 03-30 01:03:02.066: E/AndroidRuntime(1348): at android.opengl.GLSurfaceView$GLThread.guardedRun(GLSurfaceView.java:1516) 03-30 01:03:02.066: E/AndroidRuntime(1348): at android.opengl.GLSurfaceView$GLThread.run(GLSurfaceView.java:1240) The goal of this is to spawn a new enemy in an "if" statement, and use the methods stored in the element's instantiation of EntityPlayer. I can declare separate instances of EntityPlayer manually, but I have better control in this system. (Which is meant to mimic a vector class in C++)
type: Question
tagged with: java
has comment: http://stackoverflow.com/comment/34658056
has comment: http://stackoverflow.com/comment/34658054
has answer: http://stackoverflow.com/a/22739286
accepted answer: http://stackoverflow.com/a/22739286
tagged with: class
score: 0

http://stackoverflow.com/comment/34495673
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/22648342
score: 2
has text: "a user base that is geared toward users with some programming experience." of which a good chunk seems to have forgotten that they were newbies too once.

http://stackoverflow.com/q/22797177
answer count: 1
tagged with: arraylist
score: 0
has answer: http://stackoverflow.com/a/22797219
has comment: http://stackoverflow.com/comment/34762755
favorite count: 0
has comment: http://stackoverflow.com/comment/34763436
has comment: http://stackoverflow.com/comment/34762750
linked to: http://stackoverflow.com/q/3038392
has body: "Each of the functions should be run with array inputs, of size 100, 1000 and 10000; where each value in any array should be an integer from 1 – 1000 inclusive. Each sorting function should be run on arrays of the following types: random numbers, sorted lists and almost sorted lists" Below I have created three arrays. First one fills Array of 10000 randomly with integers from 1-1000. Second fills array of 10000 with integers from 1-10000. Third Shuffles array of 10000 which include integers from 1-10000. My problem is I can't get my 2nd and 3rd Array of 10000 to only include values from 1-1000. Is is even possible? I'm new to this. Any help will be appreciated!! int [] inputTenThousand = new int[10000]; // Random 10000 for (int a = 0; a &lt; inputTenThousand.length; a++) { inputTenThousand [a] = (int) (Math.random () * 1000); } int [] inputTenThousand2 = new int[10000] // Sorted 10000 for (int a = 0; a &lt; inputTenThousand2.length; a++) { inputTenThousand2[a] = a + 1; } List&lt;Integer&gt; TenThousandList = new ArrayList&lt;Integer&gt;(); for (int i = 1; i &lt; 10001; i++) { TenThousandList.add(i); } Collections.shuffle(TenThousandList); int[] inputTenThousand3 = new int[TenThousandList.size()]; // Almost Sorted 10000 for (int i = 0; i &lt; TenThousandList.size(); i++) { inputTenThousand3[i] = TenThousandList.get(i); } for (int i = 0; i &lt; inputTenThousand3.length; i++) { inputTenThousand3[i] = TenThousandList.get(i); }
upvote count: 1
has comment: http://stackoverflow.com/comment/34762645
accepted answer: http://stackoverflow.com/a/22797219
type: AnsweredQuestion
tagged with: java
downvote count: 1
type: Question
has title: How would you make an array of 10000 with only values of 1-1000 inclusive?
tagged with: arrays

http://stackoverflow.com/q/22768457
has answer: http://stackoverflow.com/a/22781913
score: 0
tagged with: messagebroker
has answer: http://stackoverflow.com/a/22768648
has body: I have a requirement to create a word document. So I am trying to use docx4j. I get a runtime error. java.lang.NoClassDefFoundError: org.docx4j.openpackaging.packages.WordprocessingMLPackage I am sure I have docx4j3.0.1 and all the dependencies added to my build path. Is there an issue with the class initialization mechanism? Any ideas?
type: UnansweredQuestion
tagged with: java
type: Question
tagged with: docx4j
answer count: 2
has title: NoClassDefFoundError while using docx4j in IBM message broker v8

http://stackoverflow.com/q/22737176
downvote count: 1
has comment: http://stackoverflow.com/comment/34654608
type: Question
has title: What is the difference between the two following lines of java code?
has comment: http://stackoverflow.com/comment/34654762
upvote count: 9
has answer: http://stackoverflow.com/a/22737200
has comment: http://stackoverflow.com/comment/34654360
tagged with: java
tagged with: switch-statement
linked to: http://stackoverflow.com/q/16255270
has answer: http://stackoverflow.com/a/22737442
possible better answer: http://stackoverflow.com/a/22737468
has answer: http://stackoverflow.com/a/22737468
favorite count: 0
answer count: 3
accepted answer: http://stackoverflow.com/a/22737442
score: 8
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/34654790
duplicate of: http://stackoverflow.com/q/16255270
has comment: http://stackoverflow.com/comment/34654560
has body: Excuse me for my ignorance. I couldn't understand the difference between the following seemingly similar lines of code. final int num1 = 1; final int num2; num2 = 2; What makes the num2 not eligible for a switch case constant? switch (expression) { case num1: System.out.println("Case A"); case num2: System.out.println("Case B"); }

http://stackoverflow.com/comment/34538340
score: 0
type: Comment
type: AnswerComment
has text: Fair enough. I guess the question is, how would I go about generating this random number and secondly, how would I then take that element and implement it into my JLabel?
comment on: http://stackoverflow.com/a/22672504

http://stackoverflow.com/a/27896721
has body: Another way to get what you want (based on Maurice Naftalin's answer): List&lt;Card&gt; cards = IntStream.rangeClosed(1, 4) .mapToObj(value -&gt; IntStream.rangeClosed(1, 13) .mapToObj(suit -&gt; new Card(value, suit)) ) .flatMap(Function.identity()) .collect(Collectors.toList()) ; Additional points to note: you have to map the int values to Stream streams, then flatMap said streams via Function.identity(), since flatMapToObj does not exists, yet said operation is translatable to a map to Stream, then an identity flatMap.
downvote count: 0
answers question: http://stackoverflow.com/q/22649978
type: Answer
upvote count: 6
has comment: http://stackoverflow.com/comment/47902405
score: 6

http://stackoverflow.com/q/22735636
favorite count: 0
tagged with: binary-tree
has answer: http://stackoverflow.com/a/22735698
accepted answer: http://stackoverflow.com/a/22735698
linked to: http://stackoverflow.com/q/409784
has body: first time commenter here. I'm trying to add char arrays to a Binary Tree in java. The problem is that when I try to make the char array into a node (prior to adding the node to the tree), the node is not a char array but a reference. Here is my making-things-a-node class: public class TreeNode { char[] data; TreeNode left, right, parent; public TreeNode(char[] data) { this.data = data; left = right = parent = null; } } and here is the line I'm using to pass the char array to the node class: TreeNode theNode = new TreeNode(dictionary); where dictionary is a char array. And when I print theNode I get something like this: ([C@58623a98). I think the problem might be with the this.data but I'm not sure. Can anyone help me? Update: when I print dictionary I get the char array I started with.
has comment: http://stackoverflow.com/comment/34651770
linked to: http://stackoverflow.com/q/5785745
type: AnsweredQuestion
has title: Binary tree passing by reference maybe?
downvote count: 0
score: 1
tagged with: java
type: Question
has answer: http://stackoverflow.com/a/22735794
has comment: http://stackoverflow.com/comment/34651774
tagged with: arrays
possible better answer: http://stackoverflow.com/a/22735794
answer count: 2
linked to: http://stackoverflow.com/q/40480
upvote count: 1
has comment: http://stackoverflow.com/comment/34651954

http://stackoverflow.com/a/22672118
downvote count: 0
has body: You've got a bunch of different answers here. I think one reason for that is the question is incomplete. You are asking for "disadvantages of using a thread pool," but you didn't say, disadvantages compared to what? A thread pool solves a particular problem. There are other problems where "thread" or "threads" is part of the solution, but "thread pool" is not. "Thread pool" usually is the answer, when the question is, how to achieve parallel execution of many, short-lived, CPU-intensive tasks, on a multi-processor system. Threads are useful, even on a uni-processor, for other purposes. The first question I ask about any long-running thread, for example, is "what does it wait for." Threads are an excellent tool for organizing a program that has to wait for different kinds of event. You would not use a thread pool for that, though.
score: 4
answers question: http://stackoverflow.com/q/22663194
type: Answer
upvote count: 4

http://stackoverflow.com/q/22708320
downvote count: 0
favorite count: 0
tagged with: sql
has title: Add in select of Hibernate criteria 'case ... when ... then ... end' as new field
answer count: 0
type: UnansweredQuestion
upvote count: 1
score: 1
tagged with: java
tagged with: hibernate
has body: I want add equivalent SQL in Hibernate criteria SELECT ... CASE WHEN a=1 then 2 WHEN a=2 then 3 WHEN a=3 then 0 WHEN a=4 then 1 END as newfield ... I buid big criteria and I don't whan rewrite in HQL If I cann't add in Hibernate criteria (using criteria's methods), maybe, I can add in criteria how part of the query (kind sql injection criteria)
type: Question

http://stackoverflow.com/comment/34513101
comment on: http://stackoverflow.com/q/22658463
has text: Already it is in a JSON array form... you can use it directly... no need of parsing the string...
type: Comment
type: QuestionComment
score: 0

import
tags question: http://stackoverflow.com/q/22768615
type: Tag
tag name: import
tags question: http://stackoverflow.com/q/22753101
tags question: http://stackoverflow.com/q/22804430
tags question: http://stackoverflow.com/q/22780355

http://stackoverflow.com/comment/34689580
has text: Even better: `new RotatingQueue<>[15]`? (Java 7 is out, even Java 8)
comment on: http://stackoverflow.com/q/22756619
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/a/22717246
score: 4
accepted answer of: http://stackoverflow.com/q/22714917
has body: try this ByteBuffer buf = ByteBuffer.allocate(500); buf.putInt(1); ... ... byte[] a = new byte[buf.position()]; buf.rewind(); buf.get(a);
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/34621251
type: Answer
upvote count: 4
has comment: http://stackoverflow.com/comment/34622136
downvote count: 0
has comment: http://stackoverflow.com/comment/34621929
answers question: http://stackoverflow.com/q/22714917
has comment: http://stackoverflow.com/comment/34619608

http://stackoverflow.com/comment/34520374
comment on: http://stackoverflow.com/q/22661660
has text: @ErnestFriedman-Hill Sorry, it is int.
type: Comment
type: QuestionComment
score: 0

http://stackoverflow.com/a/22713861
has comment: http://stackoverflow.com/comment/34612830
has comment: http://stackoverflow.com/comment/34612602
answers question: http://stackoverflow.com/q/22713288
type: AcceptedAnswer
downvote count: 0
has body: Your problem must be somewhere else in your code, possibly you are modifying the start/now dates. The following gives equal results: DateTime start = new DateTime(); DateTime now = DateTime.parse(start.toString()); DateTime end = DateTime.parse("2015-03-28T12:56:35.137+01:00"); System.out.println("Start=" + start); System.out.println("Now =" + now); You can also use the Period from JodaTime to do the pretty printing, perhaps a bit easier to read: Period period = new Period(start, end, PeriodType.yearMonthDayTime()); System.out.print(period.getYears() + " years, "); System.out.print(period.getMonths() + " months, "); // etc.
has comment: http://stackoverflow.com/comment/34612915
type: Answer
accepted answer of: http://stackoverflow.com/q/22713288
upvote count: 3
score: 3

http://stackoverflow.com/q/22724492
tagged with: java
upvote count: 1
type: Question
tagged with: colors
has comment: http://stackoverflow.com/comment/34632924
downvote count: 0
tagged with: awtrobot
favorite count: 0
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/34632866
has title: Get pixel color (Robot) when running full screen application
linked to: http://stackoverflow.com/q/10723034
has body: I'm having this issue that I cannot find a solution for. I'm using Robot.getPixelColor() to get color of pixel at mouse pointer and it works great, however if I run a full screen application or game, it will display the color of the pixel in the background of the game (behind he game, in this case my desktop) instead of the color on the game. Has anyone run in to similar issues? The code is basically: Robot robot = new Robot(); Color currentColor = robot.getPixelColor((int)MouseInfo.getPointerInfo().getLocation().getX(),(int)MouseInfo.getPointerInfo().getLocation().getY()); and then the color is placed as background of a jlabel.
has comment: http://stackoverflow.com/comment/34632951
answer count: 0
tagged with: pixel
score: 1

http://stackoverflow.com/comment/34705164
has text: Try `Info2.isEmpty()`. And please name it `info2` instead.
comment on: http://stackoverflow.com/q/22765218
type: Comment
type: QuestionComment
score: 2

http://stackoverflow.com/q/22777605
tagged with: internationalization
has title: How to write formatted integers to file in i18n-friendly way in Java?
has comment: http://stackoverflow.com/comment/34727492
tagged with: java
tagged with: filewriter
tagged with: file
tagged with: streamwriter
type: Question
has comment: http://stackoverflow.com/comment/34727495
has body: I'm currently using try { BufferedWriter writer = new BufferedWriter(new OutputStreamWriter(new FileOutputStream("open_sites_20,txt"), "UTF-8")); writer.write(String.format("%4d%4d%n", i, j)); writer.close(); } catch (IOException e) { System.err.print("error: " + e.toString() + "\n"); }; where i, j are integers. FindBugs reports that the above has the following bad practice Reliance on default encoding Found a call to a method which will perform a byte to String (or String to byte) conversion, and will assume that the default platform encoding is suitable. This will cause the application behaviour to vary between platforms. Use an alternative API and specify a charset name or Charset object explicitly. Any suggestion how this can be improved? Platform: IntelliJ IDEA 13.1.1 + FindBugs-IDEA 0.9.992.
score: 0
has answer: http://stackoverflow.com/a/22794144
answer count: 1
has comment: http://stackoverflow.com/comment/34727416
type: UnansweredQuestion

permissions
tag name: permissions
type: Tag
tags question: http://stackoverflow.com/q/22779916
tags question: http://stackoverflow.com/q/22679052
tags question: http://stackoverflow.com/q/22735287
tags question: http://stackoverflow.com/q/22718439

http://stackoverflow.com/a/22708287
has comment: http://stackoverflow.com/comment/34602942
has comment: http://stackoverflow.com/comment/34604167
has comment: http://stackoverflow.com/comment/34603590
upvote count: 1
has body: I am guessing your are using maven since you mention the "target folder" What happens is that since your imported the project from the maven pom.xml intellij build it by following maven. In maven the default project structure is this This in maven everything you copy in the resources folder, will be copied to your root classpath. so if you make for resources/myFolder/my.txt then in the build you will have copied to your classpath myFolder/my.txt Anyway if you are not using maven all you have to do is go to Project structure (ctrl+alt+shift+s) - Modules - go to your module - mark the folder that your want to add as resource
has comment: http://stackoverflow.com/comment/34603501
score: 1
has comment: http://stackoverflow.com/comment/34603295
has comment: http://stackoverflow.com/comment/34602671
accepted answer of: http://stackoverflow.com/q/22706117
has comment: http://stackoverflow.com/comment/34605543
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/34602886
answers question: http://stackoverflow.com/q/22706117
has comment: http://stackoverflow.com/comment/34604219
has comment: http://stackoverflow.com/comment/34603438
type: Answer

http://stackoverflow.com/comment/34609121
comment on: http://stackoverflow.com/a/22674145
score: 0
type: AnswerComment
has text: That's right, your solutions was easier to implement into my existing code and it works when I move the ImageView's around using the Tween Engine. Think that would be rather complicated with rupps solution. However, I will try something similar to rupps solution when I switch to the LibGDX framework, cause the framework uses the (continuous) render approach instead of having ImageView's. (At least it's how I understood it, so far)
type: Comment

http://stackoverflow.com/q/22791485
favorite count: 0
has answer: http://stackoverflow.com/a/22791524
tagged with: scala
score: 6
has title: Override a java method that expects a double array
type: AnsweredQuestion
downvote count: 0
tagged with: java
has answer: http://stackoverflow.com/a/22792336
type: Question
has body: Say I define the following java interface: public interface A { public Double[] x(); } And then try to implement it in scala as follows: class B extends A { val v: Array[Double] = Array(2.3, 6.7) override def x() = v } The compiler gives me the following error: type mismatch; [error] found : Array[scala.Double] [error] required: Array[java.lang.Double] [error] override def x() = v Can someone tell me the recommended way to automatically convert this array? Thanks Des
upvote count: 6
possible better answer: http://stackoverflow.com/a/22792336
answer count: 3
has answer: http://stackoverflow.com/a/22792427
has comment: http://stackoverflow.com/comment/34754892
accepted answer: http://stackoverflow.com/a/22792427

http://stackoverflow.com/comment/34732256
score: 0
comment on: http://stackoverflow.com/q/22776355
has text: Better to use a property file. Can we?
type: Comment
type: QuestionComment

http://stackoverflow.com/a/22663839
downvote count: 0
score: 1
has comment: http://stackoverflow.com/comment/34571138
has comment: http://stackoverflow.com/comment/34551417
upvote count: 1
has comment: http://stackoverflow.com/comment/34572656
has body: In my experience, that type of memory problem with ServiceMix 3 is often an indication of a problem with the MEP handling of one of the components or endpoints in your flows. Some of the JBI components, endpoints and services keep a list of pending exchanges, so if some of those message exchange patterns fail to get terminated correctly, those exchanges will never be removed from the list. The best way to troubleshoot this, would be by taking a heap dump (e.g. using jmap) and then looking at the MessageExchange implementation instances in there. You'll probably find a bunch of very similar MessageExchanges that are being kept in memory. Once you have those, you can look at the exchange properties to figure out which endpoint/component is causing the problem. There are also a few issues that were fixed in later ServiceMix 3.x releases that could be the cause of this. Be sure to give things a go on the 3.4.1 version or check the release notes for those more recent versions.
type: Answer
has comment: http://stackoverflow.com/comment/34573306
answers question: http://stackoverflow.com/q/22662900
has comment: http://stackoverflow.com/comment/34569693

http://stackoverflow.com/q/22792343
has comment: http://stackoverflow.com/comment/34753725
score: 3
tagged with: enums
has title: Hibernate JPA mapping having a map which value is a list
upvote count: 3
tagged with: java
tagged with: hibernate
type: Question
tagged with: hashmap
has comment: http://stackoverflow.com/comment/34790771
linked to: http://stackoverflow.com/q/939235
tagged with: jpa
downvote count: 0
has comment: http://stackoverflow.com/comment/34754324
has comment: http://stackoverflow.com/comment/127361912
has comment: http://stackoverflow.com/comment/130447151
has comment: http://stackoverflow.com/comment/34754505
favorite count: 0
answer count: 0
has body: I'm looking how to map in JPA a hashmap with its value being a list. I've 2 entities: EntityA { @Id @GeneratedValue private Integer id; @MapKey(name = "nature") @MapKeyEnumerated(EnumType.STRING) @OneToMany(mappedBy = "entityA", cascade = CascadeType.ALL) private Map&lt;NatureEnum, List&lt;EntityB&gt;&gt; mapEntityB = new HashMap&lt;NatureEnum, List&lt;EntityB&gt;&gt;(); } EntityB { @Id @GeneratedValue private Integer id; @ManyToOne @JoinColumn(name = "ID_ENTITYA", nullable = false) private EntityA entityA; @Column(name = "NATURE", nullable = false) @Enumerated(EnumType.STRING) private NatureEnum nature; } You will have guessed that of course the map doesn't work as it's missing something telling it it's not just one EntityB in it. The rest does work and if i change the map by a regular List it works fine. So how can i manage to "group by" my EntityB in one list depending on the value of Nature? Thanks in advance for your help.
type: UnansweredQuestion

http://stackoverflow.com/a/64459669
score: 0
type: Answer
answers question: http://stackoverflow.com/q/22695924
has body: My suspicion is StrictMode$AndroidBlockGuardPolicy.onNetwork of your Logcat. Try to add: StrictMode.ThreadPolicy policy = new StrictMode.ThreadPolicy.Builder().permitAll().build(); StrictMode.setThreadPolicy(policy); inside onCreate() and before addListenerOnButton(). It is also a good idea to double check AndroidManifest.xml for granted permissions.

http://stackoverflow.com/comment/34629594
type: Comment
has text: I'll give this a shot now and let you know how it goes :) Sounds like a nice solution.
comment on: http://stackoverflow.com/a/22723066
type: AnswerComment
score: 0

http://stackoverflow.com/a/22683263
answers question: http://stackoverflow.com/q/22683196
type: Answer
has comment: http://stackoverflow.com/comment/34558827
upvote count: 1
score: 1
has comment: http://stackoverflow.com/comment/34563267
downvote count: 0
has comment: http://stackoverflow.com/comment/34563798
has body: You forgot to add the apache common fileupload jar. http://apache.mirrors.lucidnetworks.net//commons/fileupload/binaries/commons-fileupload-1.3.1-bin.zip Download it and add in your classpath. If not work yet check with servlet-api.jar http://mirrors.ibiblio.org/pub/mirrors/maven/javax.servlet/jars/servlet-api-2.3.jar

http://stackoverflow.com/comment/35363564
score: 0
type: AnswerComment
type: Comment
has text: Your solution fixed my footer at the bottom of the screen, but that is not what i am trying to achieve. I want it to be bellow the list and when i expand 1 group item i want to push footer lower. At the moment expanded list is pushed bellow footer, when expanded.
comment on: http://stackoverflow.com/a/23084643

http://stackoverflow.com/q/22688688
favorite count: 0
downvote count: 0
has comment: http://stackoverflow.com/comment/34566394
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/34566762
has title: I want to write my java program from command prompt(no netbeans, no notepad)
score: 2
has comment: http://stackoverflow.com/comment/34566323
has comment: http://stackoverflow.com/comment/34566266
tagged with: command-prompt
has answer: http://stackoverflow.com/a/22688936
has comment: http://stackoverflow.com/comment/82528827
tagged with: java
has comment: http://stackoverflow.com/comment/34566456
has comment: http://stackoverflow.com/comment/34567310
has comment: http://stackoverflow.com/comment/34567072
has comment: http://stackoverflow.com/comment/34567217
type: Question
upvote count: 2
has comment: http://stackoverflow.com/comment/34566471
has comment: http://stackoverflow.com/comment/34566766
answer count: 1
has body: Anyone here remember how to write a java program from command prompt. Earlier (5-6 years back) before BlueJ came, we use to write java programs in a Blue Black screen that is similar to one in TurboC++. My system has netbeans installed, all paths are proper, I can even compile the programs by writing them in a text file with .java extension. But i would like to do that in previous environment(see the image below), where we use to create the files, save them as .java, then go back to command prompt and execute the statements. I got the image from google, but didn't find a way to open this.
has comment: http://stackoverflow.com/comment/34567077
has comment: http://stackoverflow.com/comment/34566616
has comment: http://stackoverflow.com/comment/34566354
has comment: http://stackoverflow.com/comment/34566658
linked to: http://stackoverflow.com/q/11045077
has comment: http://stackoverflow.com/comment/34566796
has comment: http://stackoverflow.com/comment/34566542
has comment: http://stackoverflow.com/comment/34566567

http://stackoverflow.com/comment/34683893
type: Comment
type: QuestionComment
has text: You are expecting a `Person` response. What is your request payload type? You are setting the content type to JSON; do you have Jackson on the classpath?
comment on: http://stackoverflow.com/q/22750403
score: 0

http://stackoverflow.com/q/22784284
has comment: http://stackoverflow.com/comment/34739161
has title: Creating a source package folder in a CounterClockWise project programmatically
has comment: http://stackoverflow.com/comment/34740328
tagged with: counterclockwise
type: Question
has comment: http://stackoverflow.com/comment/34740613
tagged with: clojure
score: 0
has answer: http://stackoverflow.com/a/22785358
has comment: http://stackoverflow.com/comment/34740171
answer count: 1
has body: I have an existing java project and in that project there is a procedure that should programmatically create packages with source files inside them. It uses the standard File.mkdir() method to create all the unexisting directories for the package and then creates and writes the source files in there. All works fine except that only the top folder created for a package path is marked by Eclipse as a package. The lower level folders remain just folders. For example, if I create a directory structure for package "org.prj.hey.this.is.cool", where "org.prj" is the existing path for my main project package, it then creates the rest of the path "/hey/this/is/cool" and only "hey" becomes an Eclipse package. I have found no way to make Eclipse recognize the "this", "is" and "cool" folders as packages. I haven't found any clues on this in the .project and .classpath files either.. So how do I make the whole branch of created folders be recognized by Eclipse as packages? UPDATE: (screenshot) Found out that the issue is due to the file extension (see the picture). Is there any way to make Eclipse recognize .clj files as source files?
tagged with: project
tagged with: java
type: UnansweredQuestion
tagged with: eclipse

http://stackoverflow.com/q/22714738
type: Question
has body: My company has a large SQL Server database that was created and maintained with Microsoft SQL Server 2008. I am new to working with SQL Server on a large scale like this. I want to be able to automate some of the common maintenance operations that we do and I want to do so using Java. My question is this: How do I use a Java application to execute SQL statements on our database? I also would like to be able to use this application to create a small test database so that I can test some of the functions on a small scale before I use them on the live database. I have been doing some reading online and found information on using JDBC to create the connection with the database and then use a connection object with a statement object to execute a statement. The problem is that this requires drivers and I cant seem to pin down with driver will do what i need it to do. Is there an easier way to do this? If not, where can I find a driver that will do what I need it to do. Thank you for your help!
has comment: http://stackoverflow.com/comment/34614274
tagged with: database
accepted answer: http://stackoverflow.com/a/22714877
tagged with: sql-server
has title: Working with SQL Server Database in Java
score: 0
answer count: 1
tagged with: jdbc
has comment: http://stackoverflow.com/comment/34614589
has answer: http://stackoverflow.com/a/22714877
type: AnsweredQuestion
tagged with: java
has comment: http://stackoverflow.com/comment/34619210

http://stackoverflow.com/q/22767495
score: 0
tagged with: java
tagged with: eclipse
accepted answer: http://stackoverflow.com/a/22767623
tagged with: button
has body: I'm new to android development and I'm currently working on building a pretty basic application. I want 'button1' to open a new activity. Looked around online and I can't work out what I'm doing wrong! Java: package com.testtest.herro; import android.app.Activity; import android.os.Bundle; import android.view.View; import android.widget.Button; import android.widget.TextView; public class FullscreenActivity extends Activity { Button button1, saved; @Override public void onCreate(Bundle savedInstanceState) super.onCreate(savedInstanceState); { setContentView(R.layout.activity_fullscreen); button1 = (Button) findViewById (R.id.button1); }; };} I'm getting the following errors on the public void onCreate method: Syntax errors on token ")", { expected after this token. Overrides android.app.Activity.onCreate Syntax errors on token ")", { expected after this token. The findViewById line has this error: -ids cannot be resolved or is not a field. XML: Any help is greatly appreciated! Thanks.
type: Question
type: AnsweredQuestion
tagged with: android
possible better answer: http://stackoverflow.com/a/22767556
has answer: http://stackoverflow.com/a/22767623
has answer: http://stackoverflow.com/a/22767556
answer count: 2
has title: ids cannot be resolved or is not a field

http://stackoverflow.com/comment/34576092
score: 0
has text: Seems you get the teaser of the entries. Look into your SyndEntry, if there is some link to the full article and call it's feed.
comment on: http://stackoverflow.com/q/22693582
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/34538125
type: Comment
comment on: http://stackoverflow.com/q/22672319
has text: then check for length, check for dots, check for '?' symbols. Then the problem is not the way of extracting the URL part, but that a user could fail in entering
score: 0
type: QuestionComment

http://stackoverflow.com/q/22807435
tagged with: cdi
upvote count: 8
tagged with: weld
score: 8
type: AnsweredQuestion
has body: I have an application which is packaged in an EAR containing many JARs (with EJBs, libraries, 3rd-party-libraries, ...) and a single WAR (again containing some other JARs). The application is deployed in an JEE7 container (Wildfly 8.0.0.Final) and using CDI (Weld 2.1.2.Final shipped with Wildfly). In my understanding, Weld is active application-wide and has a single application-wide view. So it doesn't matter where I want to use CDI - it works. But there are some indications which lead to the assumption that this is not true. E.g. the toString-method of the BeanManager shows different output in different modules: When using the BeanManager in some module which is packaged in the war I get Weld BeanManager for test-ear-1.0-SNAPSHOT.ear/test-webui-frontend-1.0-SNAPSHOT.war/WEB-INF/lib/test-webui-backend-1.0-SNAPSHOT.jar [bean count=76]. If it is used in a library directly contained in the EAR: Weld BeanManager for test-ear-1.0-SNAPSHOT.ear/test-ejb3-dao-1.0-SNAPSHOT.jar/ [bean count=224]. So it seems that these BeanManagers are "responsible for" different parts of the application. Is this true?
has answer: http://stackoverflow.com/a/22807758
type: Question
tagged with: java
has title: Understanding CDI/Weld in multi-module application
answer count: 1
downvote count: 0
accepted answer: http://stackoverflow.com/a/22807758
favorite count: 0

http://stackoverflow.com/q/22682072
accepted answer: http://stackoverflow.com/a/22683315
score: 0
answer count: 3
has body: I try to export a Java-Project with different Libraries included a JavaFX GUI and lots of different stuff to a runnable JAR file. When i run my project in eclipse there is no problem. But when I try to export it to a runnable JAR file and afterwards i try to start is it never opens a window there is just a process running in the background. I don't know how to describe my problem better. But maybe you can help me with this information already. (using eclipse)
has answer: http://stackoverflow.com/a/22683315
tagged with: java
tagged with: javafx
possible better answer: http://stackoverflow.com/a/22682270
has answer: http://stackoverflow.com/a/22682270
type: Question
has comment: http://stackoverflow.com/comment/34555510
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/22682288
has title: Export runnable JAR file
has comment: http://stackoverflow.com/comment/34555905
tagged with: eclipse

http://stackoverflow.com/a/22655991
has body: Well, try this : while(true) { if (!c.isAlive() &amp;&amp; b.isAlive()){ b.interrupt(); } }
answers question: http://stackoverflow.com/q/22655734
score: 0
type: Answer

http://stackoverflow.com/comment/34562182
has text: Please give us a sample binary string. I strongly suspect that using `BigInteger` to parse the data is a bad idea here.
comment on: http://stackoverflow.com/q/22686297
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/q/22739539
has title: ECLIPSE - Exception occurred executing command line
score: 0
has comment: http://stackoverflow.com/comment/34658812
upvote count: 1
has comment: http://stackoverflow.com/comment/34658583
downvote count: 1
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/34658584
tagged with: java
has comment: http://stackoverflow.com/comment/34658723
has comment: http://stackoverflow.com/comment/34658851
has answer: http://stackoverflow.com/a/22739711
has comment: http://stackoverflow.com/comment/34658839
has comment: http://stackoverflow.com/comment/34658612
tagged with: eclipse
type: Question
has comment: http://stackoverflow.com/comment/34658774
has comment: http://stackoverflow.com/comment/34658938
has body: I have a MAC with java 7 and when I try to execute my code eclipse generates this error: Exception occurred executing command line. Cannot run program "/Library/Java/JavaVirtualMachines/jdk1.7.0_51.jdk/Contents/Home/bin/java" (in directory "/Users/mrcf/Documents/Università/EclipseWS/Clean"): error=2, No such file or directory Can you help me? Please, are two days that I try but without success. Thanks.
answer count: 1
favorite count: 0
has comment: http://stackoverflow.com/comment/34658598
has comment: http://stackoverflow.com/comment/34658778
accepted answer: http://stackoverflow.com/a/22739711
has comment: http://stackoverflow.com/comment/34658731

http://stackoverflow.com/comment/34735904
type: AnswerComment
type: Comment
has text: I resoved the missing server problem but same error.
comment on: http://stackoverflow.com/a/22782623
score: 0

http://stackoverflow.com/comment/50086956
type: Comment
comment on: http://stackoverflow.com/a/23573248
has text: Any idea why it is still marked "in progress" here: http://bugs.java.com/bugdatabase/view_bug.do?bug_id=8039915 ? I just tested in oracle 8.0.45 and I'm seeing a problem with half_up rounding.
score: 0
type: AnswerComment

http://stackoverflow.com/q/22703079
has body: First, please note I know the following code is not in JavaScript or jQuery but I just added them as tags of this question in hope of finding a solution for it using Javascript or jQuery. I have a form with three submit buttons. The problem is that, when I submit the form with either of the buttons the result page will be sent to the same address. I need it to be in a different address. Purpose: The code is supposed to show a list of items for a specific category in a page called view. User selects few items and submit the form. Server needs to show the details of the selected items in a page called update (separate address with view page). Then user is able to edit the details of items and submit the form to update the details of those items. Requirement: lets say address is myexample.com/Product/view //shows view page after clicking on edit, it should redirect to following address. myexample.com/Product/update //shows update page ( show details of selected products) Potential Solution: Based on Roman C's answer, after receiving the request, I pass the products list to the other action to show update page, but it shows it as following on the address; therefore, update page does not recognize products parameter as a list. ...products=[1%2C+2]&id=1 Java: List <Integer> products = new ArrayList(); Struts redirect: update /products/Update ${products} ${id} Even if I manually send the following request, the action class does not recognize products parameter as a list. It shows it's size is Zero. ...products=[1,2]&id=1
linked to: http://stackoverflow.com/q/17874274
has answer: http://stackoverflow.com/a/22838566
tagged with: java
has comment: http://stackoverflow.com/comment/34601631
has answer: http://stackoverflow.com/a/22757232
downvote count: 1
type: Question
upvote count: 4
possible better answer: http://stackoverflow.com/a/22838566
answer count: 2
has title: How to redirect user to different pages based on the submit button in Struts 2
accepted answer: http://stackoverflow.com/a/22757232
has comment: http://stackoverflow.com/comment/34766435
tagged with: jsp
has comment: http://stackoverflow.com/comment/34766338
has comment: http://stackoverflow.com/comment/34727507
has comment: http://stackoverflow.com/comment/34680900
tagged with: struts2
has comment: http://stackoverflow.com/comment/34727458
has comment: http://stackoverflow.com/comment/34598250
score: 3
has comment: http://stackoverflow.com/comment/34678437
linked to: http://stackoverflow.com/q/13343954
has comment: http://stackoverflow.com/comment/34766827
favorite count: 0
has comment: http://stackoverflow.com/comment/34766406
has comment: http://stackoverflow.com/comment/34625629
has comment: http://stackoverflow.com/comment/34738488
has comment: http://stackoverflow.com/comment/34765859
has comment: http://stackoverflow.com/comment/34656644
tagged with: actionresult
has comment: http://stackoverflow.com/comment/34680271
has comment: http://stackoverflow.com/comment/34792103
has comment: http://stackoverflow.com/comment/34766300
tagged with: post-redirect-get
type: AnsweredQuestion

http://stackoverflow.com/q/22682008
has title: Change TabContent from the content
tagged with: eclipse
has answer: http://stackoverflow.com/a/22682176
score: 0
answer count: 1
tagged with: android
accepted answer: http://stackoverflow.com/a/22682176
type: AnsweredQuestion
tagged with: java
linked to: http://stackoverflow.com/q/20988505
type: Question
has body: I've got a TabHost with some tabs. I haven't got problem managing them but what I need now is this: I have an "activity" called in the TabContent and i need that a button from that Activity/Layout changes the content of the Tab. How can I do that? I can't find a solution.

http://stackoverflow.com/q/22759082
type: Question
has title: Validation in shared folder in GWT app
tagged with: gwt
tagged with: java
has body: I am new to GWT and I am doing the validations,to avoid duplicate insertion of the patient into data base,I created a class on the shared side and loaded all users from the data base into a list and compared it with the new user data. On Shared Side: package de.chieukam.tutorial.shared; import java.util.Date; import java.util.List; import de.chieukam.tutorial.server.PatientDAO; public class PatientCreationValidation { private PatientDAO patientDAO; private boolean duplicate; public PatientCreationValidation(){ this.patientDAO=new PatientDAO(); this.duplicate=false; } public boolean checkDuplicatePatient(String name,String FirstName,Date date){ List&lt;PatientDTO&gt; findAll=patientDAO.findAll(); for(PatientDTO npatient:findAll){ if(npatient.getLastName().equals(name)){ duplicate=true; break; } } return duplicate; } on client Side: duplicatePatient= patientValidation.checkDuplicatePatient(textName.getText(), textFirstName.getText(), boxBirthday.getValue()); if(duplicatePatient){ GwtSpringHibernate.showAlertBox(" Patient Already Exists "); return; } it gives the error [ERROR] [GwtSpringHibernate] - Line 12: No source code is available for type de.chieukam.tutorial.server.PatientDAO; did you forget to inherit a required module? [ERROR] [GwtSpringHibernate] - Unable to find type 'de.chieukam.tutorial.client.widgets.NewPatientDialog.AddiSelectWidgetUiBinder' [ERROR] [GwtSpringHibernate] - Hint: Check the inheritance chain from your module; it may not be inheriting a required module or a module may not be adding its source path entries properly [ERROR] [GwtSpringHibernate] - Deferred binding failed for 'de.chieukam.tutorial.client.widgets.NewPatientDialog.AddiSelectWidgetUiBinder'; expect subsequent failures.
answer count: 1
score: 0
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/22759188

http://stackoverflow.com/a/22658834
has body: Rewrite getResource() and releaseResource() according to your needs. class MyThreadFactory implements ThreadFactory { // String is the type of resource; change it if nesessary static final ThreadLocal&lt;String&gt; currentResourceKey = new ThreadLocal&lt;String&gt;(); int n = 0; String getResource() { n++; System.out.println("aquired:" + n); return Integer.valueOf(n).toString(); } void releaseResource(String res) { System.out.println("released:" + res); } @Override public Thread newThread(Runnable r) { return new Thread(r) { public void run() { currentResourceKey.set(getResource()); try { super.run(); } finally { releaseResource(currentResourceKey.get()); } } }; } } Test code: ExecutorService pool = Executors.newFixedThreadPool(2,new MyThreadFactory()); for (int k = 0; k &lt; 5; k++) { pool.submit(new Runnable() { public void run() { String res = currentResourceKey.get(); try { Thread.sleep(50); } catch (InterruptedException e) { e.printStackTrace(); } System.out.println(" executed:"+res+" on "+Thread.currentThread().getName()); } }); } pool.shutdown();
upvote count: 1
answers question: http://stackoverflow.com/q/22657019
downvote count: 0
score: 1
type: Answer

http://stackoverflow.com/comment/34719086
type: Comment
has text: I am sorry but I am new to this, Is there anything that I could look up to get more about this?
comment on: http://stackoverflow.com/a/22772829
type: AnswerComment
score: 0

http://stackoverflow.com/a/22794568
answers question: http://stackoverflow.com/q/22794452
type: Answer
score: 0
has body: Bar extends foo and method addFive() is overridden. Which method will be invoked when there are overridden methods is decided at runtime. If you change the name of the methods, for example addFive1() and addFive2() (the latter for class bar), the addFive2() method will be called.The variable a is declared in foo, that's why it comes from this class. Try reading some books. Effective Java, Java the complete reference etc.

http://stackoverflow.com/comment/34761893
has text: And what happens when you saw the documentation for UnicastRemoteObject that caused all this SHOUTING? Have you read it at all? -1
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/22782363
score: 0

http://stackoverflow.com/a/22698982
score: 1
type: AcceptedAnswer
downvote count: 0
type: Answer
accepted answer of: http://stackoverflow.com/q/22698939
has body: You can make the function static and call it statically, or you could grab the instance of it (might need to make it a singleton) and use that.
answers question: http://stackoverflow.com/q/22698939
upvote count: 1

http://stackoverflow.com/comment/34572104
has text: `image` is an `ImageView` that is displayed on your main stage?
comment on: http://stackoverflow.com/q/22691243
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/q/22777498
score: 0
has comment: http://stackoverflow.com/comment/34727898
upvote count: 1
answer count: 1
has body: EDIT:here is the full code: https://dl.dropboxusercontent.com/u/65678182/assignment1.rar Any possible help is highly appreciated! I am trying to make a copy of the breakout game, but I have problems with checking if two objects (the ball and paddle) intersects. I have this method for collision detection for now: public static void handleCollisions() { System.out.println(ball.getBounds()); // just to check that they System.out.println(paddle.getBounds()); //are there and moving correct if (ball.getBounds().intersects(paddle.getBounds())) { System.out.println("collision"); } } I'm pretty sure the getBounds works as they should since I get these outputs from the println: java.awt.Rectangle[x=393,y=788,width=14,height=14] java.awt.Rectangle[x=350,y=350,width=100,height=10] getBounds code: public static Rectangle getBounds() { return new Rectangle(x, y, radius*2, radius*2); } and I can see them moving at one point they are overlapping, but the method never detects it. I'm pretty new to this so hopefully its just some stupid mistake somewhere, and any help is appreciated. I can post some more code if necessary, but would prefer to not.
downvote count: 1
has comment: http://stackoverflow.com/comment/34736645
has comment: http://stackoverflow.com/comment/34727188
favorite count: 0
tagged with: breakout
has comment: http://stackoverflow.com/comment/34730732
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/34729567
tagged with: intersect
has title: How to make my collision check with Intersect between rectangles to work?
tagged with: swing
has comment: http://stackoverflow.com/comment/34727158
tagged with: java
has comment: http://stackoverflow.com/comment/34727923
linked to: http://stackoverflow.com/q/14574045
type: Question
tagged with: graphics
has answer: http://stackoverflow.com/a/22777570
has comment: http://stackoverflow.com/comment/34727223

http://stackoverflow.com/q/22777568
type: AnsweredQuestion
has body: Though this has been discussed in detail in various forums including SO and I have read most of the replies of the experts, But below is the problem is confusing me. I have few integer variables and my requirement is to check null before executing few statements. So first I have declared as int (I don't have knowledge on int and Integer). int a,b,c; if(a == null) { //code here } But complier is not allowing me to declare like this. After searching in google, experts advised me to use Integer instead of int and when I changed like the code below Integer a,b,c; if(a == null) { //code here } This is fine with the compiler as Integer is defined as Object in java and int is not. Now my code has become some declarations with int and some with Integer. Can anyone suggest if declaring Integer will give the same result as int also can I change all my declarations to Integer. Thanks for your time.
has title: why int can't be compared to null but Integer can be compared to null
upvote count: 2
score: 1
tagged with: java
has answer: http://stackoverflow.com/a/22777842
downvote count: 1
type: Question
has answer: http://stackoverflow.com/a/22777624
tagged with: int
answer count: 2
accepted answer: http://stackoverflow.com/a/22777842
possible better answer: http://stackoverflow.com/a/22777624
favorite count: 0
tagged with: integer

http://stackoverflow.com/q/22738397
has answer: http://stackoverflow.com/a/22738477
type: AnsweredQuestion
score: 3
accepted answer: http://stackoverflow.com/a/22738658
tagged with: configuration
tagged with: java
type: Question
answer count: 2
has title: How to apply roles using HttpSecurity (Spring Security)?
downvote count: 0
tagged with: spring-security
favorite count: 0
has answer: http://stackoverflow.com/a/22738658
tagged with: spring
has body: I am using Spring Security 3.2.3.RELEASE And here is code of my WebSecurityConfigurerAdapter @Configuration @EnableWebSecurity public class WebSecurityContext extends WebSecurityConfigurerAdapter { private static final Logger log = LogManager.getLogger(WebSecurityContext.class); @Autowired private AuthenticationProvider authenticationProvider; @Override protected void configure(AuthenticationManagerBuilder auth) throws Exception { log.info("Setting AuthenticationManagerBuilder"); auth.authenticationProvider(authenticationProvider); } @Override protected void configure(HttpSecurity http) throws Exception { log.info("Configuring HttpSecurity"); http .authorizeRequests() .antMatchers("/admin/**").hasRole("ADMIN") .antMatchers("/**").hasRole("USER") .anyRequest().authenticated() .and() .httpBasic(); } } And result is: HTTP Status 403 - Access is denied But if I comment this line: //.antMatchers("/**").hasRole("USER") Everything works fine. Which means (I guess) something wrong with my roles or HttpSecurity. So I started debugging. I double check that my UserDetails have two GrantedAuthorities with names: ADMIN, USER. So any ideas what could cause the problem?
upvote count: 3
possible better answer: http://stackoverflow.com/a/22738477

http://stackoverflow.com/comment/34652191
has text: If I don't initialize as null, the compiler gives me error
comment on: http://stackoverflow.com/a/22735732
type: AnswerComment
score: 0
type: Comment

http://stackoverflow.com/q/22774698
has comment: http://stackoverflow.com/comment/34722604
type: UnansweredQuestion
has body: For lack of a better title, I am looking for the best way to check this: I have an arrow object. I also have objects that I want to code collision for, object1, object2, ... objectx, with objectx being the last object I am checking for. In the collision system of the engine I am using, there is an x1 object, and an x2 object, which can vary for objects in a collision. For example if an arrow hits any object 1 through x, I don't know from the start if the arrow is x1 or x2, but it can be easily checked. I want to write an if statement that is true if one object is an arrow, and the other is one of my many objects. This is what I have so far: if ((x1Type.equals("arrow") || x2Type.equals("arrow")) &amp;&amp; ((x1Type.equals("object1") || x1Type.equals("object2") || x1Type.equals("object3") || ... || x1Type.equals("objectx")) || x2Type.equals("object1") || x2Type.equals("object2") || x2Type.equals("object3") || ... || x2Type.equals("objectx"))) This code works, but I am pretty sure there is a better way to do it. And sorry for being kinda vague, this was a hard to state question.
type: Question
has comment: http://stackoverflow.com/comment/34722537
has comment: http://stackoverflow.com/comment/34722385
score: 0
tagged with: java
has title: Quickest way to check only one of each instance?
answer count: 1
has comment: http://stackoverflow.com/comment/34722487
has answer: http://stackoverflow.com/a/22774828
has comment: http://stackoverflow.com/comment/34722493

http://stackoverflow.com/comment/34676420
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/22749336
has text: public void display(detailTom tomData) is a method to display the contents of tomData which is an arraylist of objects of class detailTom

http://stackoverflow.com/a/22749144
has body: General issues Don't extend JFrame (particularly, don't override the paint method of JFrame). Instead, do the painting in the paintComponent method a class that extends JPanel Create the GUI from the Event Dispatch Thread The main reason for the unexpected result is that you are creating an image that has the size of the frame - but the frame also has a title bar and a border, and these are "covering" parts of the image. The size of the area that is actually available for painting is smaller than the total frame size. Additionally, the getWidth() and getHeight() methods may return garbage as long as the frame is not yet visible on the screen. One approach considering all this could look like in this snippet: import java.awt.Color; import java.awt.Dimension; import java.awt.Graphics; import java.awt.GridLayout; import java.awt.image.BufferedImage; import javax.swing.JFrame; import javax.swing.JPanel; import javax.swing.SwingUtilities; public class Mandelbrot { public static void main(String[] args) { SwingUtilities.invokeLater(new Runnable() { @Override public void run() { createAndShowGUI(); } }); } private static void createAndShowGUI() { JFrame frame = new JFrame(); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); frame.getContentPane().setLayout(new GridLayout(1, 1)); BufferedImage image = createImage(500, 500); ImagePanel imagePanel = new ImagePanel(image); frame.getContentPane().add(imagePanel); frame.pack(); frame.setVisible(true); } private static BufferedImage createImage(int w, int h) { BufferedImage image = new BufferedImage(w, h, BufferedImage.TYPE_INT_RGB); for (int x = 0; x &lt; w; x++) { image.setRGB(x, x, Color.GREEN.getRGB()); } return image; } static class ImagePanel extends JPanel { private final BufferedImage image; ImagePanel(BufferedImage image) { this.image = image; } @Override public Dimension getPreferredSize() { if (super.isPreferredSizeSet()) { return super.getPreferredSize(); } return new Dimension(image.getWidth(), image.getHeight())…
downvote count: 0
type: Answer
answers question: http://stackoverflow.com/q/22748307
upvote count: 3
has comment: http://stackoverflow.com/comment/34679875
score: 3
has comment: http://stackoverflow.com/comment/34677791

http://stackoverflow.com/q/22684316
linked to: http://stackoverflow.com/q/2448843
has answer: http://stackoverflow.com/a/22684405
has comment: http://stackoverflow.com/comment/34558588
accepted answer: http://stackoverflow.com/a/22684375
answer count: 4
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/22688005
tagged with: java
has comment: http://stackoverflow.com/comment/34560094
type: Question
has body: I tried compiling this code in Java: class D { public static void main(String arg[]) { f1(); } static void f1() { int a; int b=5; for(;b&lt;=10;b++) a=b; System.out.println(a); } } But it generates an error that says: Variable 'a' might not have been initialized. Why is this happening, although a is set in the for loop?
has comment: http://stackoverflow.com/comment/34559385
possible better answer: http://stackoverflow.com/a/22684357
has comment: http://stackoverflow.com/comment/34559990
has title: Why Does This Java Code Generate Error?
has answer: http://stackoverflow.com/a/22684357
has answer: http://stackoverflow.com/a/22684375
score: 0

http://stackoverflow.com/comment/34703776
score: 1
type: Comment
type: QuestionComment
has text: empty parentheses mean that the lambda has no arguments
comment on: http://stackoverflow.com/q/22764040

http://stackoverflow.com/comment/34541972
type: AnswerComment
score: 1
comment on: http://stackoverflow.com/a/22674001
has text: hah I meant to understand your question, I have enough with my projects!
type: Comment

http://stackoverflow.com/q/22670934
type: AnsweredQuestion
tagged with: constructor
tagged with: java
type: Question
tagged with: object
has comment: http://stackoverflow.com/comment/34535416
accepted answer: http://stackoverflow.com/a/22670956
has comment: http://stackoverflow.com/comment/34536268
has comment: http://stackoverflow.com/comment/34535448
score: 0
has answer: http://stackoverflow.com/a/22670956
answer count: 1
has comment: http://stackoverflow.com/comment/34535401
has title: Do we have to invoke default constructor from class Object in its' subclass
has body: Is there any difference if I do or do not invoke Object's default constructor in the class: public class BankCustomer { private Person owner; public BankCustomer(Person owner) { this.owner = owner; } } OR public class BankCustomer { private Person owner; public BankCustomer(Person owner) { super(); this.owner = owner; } }

http://stackoverflow.com/a/22777602
has body: Your for loop is counting to daysArray.length, but daysArray is null. Furthermore, your for loops don't make any sense anyway; you're creating and then throwing away lots of identical arrays. It's very unclear what your code is trying to accomplish, since you're asking for a single person's name and then a single number indicating the number of absences. The recommended approach is to (1) use an object that contains both the student's name and the number of absences, keeping this information together in a single record and (2) use a List instead of an array if you don't know how many items you're going to need, since a List is of variable size.
accepted answer of: http://stackoverflow.com/q/22777550
answers question: http://stackoverflow.com/q/22777550
score: 2
type: AcceptedAnswer
downvote count: 0
type: Answer
upvote count: 2

http://stackoverflow.com/comment/34509146
type: QuestionComment
comment on: http://stackoverflow.com/q/22655826
score: 0
has text: I did not used `@WebServlet` any where! Should I?
type: Comment

http://stackoverflow.com/a/22814911
has body: web.xml is configuration file. It has classes(like listeners, filters,filter-mapping, servlet,servlet-mapping), resources and configuration(like context param, diplayname, error-page, session-config) of the application and how the web server uses them to handle web requests. When the web server receives a request for the application, it uses web.xml to map the URL of the request to the code that is supposed to handle the request. Coming to what should be in web.xml and what should be in myproject-servlet.xml: 1)In Spring, ApplicationContext can be hierarchical. One ApplicationContext can have multiple child ApplicationContexts and can only have one parent. Beans in child ApplicationContext can access the beans in parent. 2)DispatcherServlet dispatches requests to handlers(controllers), with configurable handler mappings, view resolution configuration(what view template you use for the application for example jsp). Keeping the two points in mind, our web.xml should be like: contextConfigLocation classpath:service-layer-beans.xml org.springframework.web.context.ContextLoaderListener dispatcher org.springframework.web.servlet.DispatcherServlet contextConfigLocation /WEB-INF/myproject-servlet.xml 1 dispatcher *.htm
type: Answer
score: 0
answers question: http://stackoverflow.com/q/22805512

http://stackoverflow.com/comment/34635305
score: 0
type: AnswerComment
type: Comment
has text: @StephenC so anonymous classes are useful if you want to override an existing method, but don't want to create a new class for just that?
comment on: http://stackoverflow.com/a/22725953

http://stackoverflow.com/q/22808130
has answer: http://stackoverflow.com/a/22809387
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/34872438
has comment: http://stackoverflow.com/comment/34782484
tagged with: report
tagged with: keyword
type: Question
has title: How to get junit report when testcase is executed from java class?
tagged with: java
has comment: http://stackoverflow.com/comment/34782241
has comment: http://stackoverflow.com/comment/34869671
has comment: http://stackoverflow.com/comment/34783068
has body: I'm developping a keyword drivent testing framework. I'd like to get the html report of a junit testcase called within a java class. I'm able to get the html report when the testcase itself is call in a ant task : build, testcase_model, junit. But I'd like to have this ; build, DriveTest (the java class calling the testcase_model), junit. Unfortunately this doesn't generate a report. I call my testcase like this : JUnitCore junit = new JUnitCore(); junit.addListener(new TextListener(System.out)); Result result=junit.run(TestCase_Model.class); Thank you very much people. Jean /!\ UPDATE /!------------------------------------------------- Hello. For now I put aside the "@RunWith(SomeRunner.class)" way. In my DriveTest class I call my TestCase_Model like this : JUnitCore junit = new JUnitCore(); RunListener listener = new RunListener(); junit.addListener(listener); Result result = junit.run(TestCase_Model.class);. My DriveTest target looks like this : &lt;target name="DriveTest (5)"&gt; &lt;mkdir dir="${junit.output.dir}" /&gt; &lt;junit fork="yes" printsummary="withOutAndErr"&gt; &lt;formatter type="xml" /&gt; &lt;test name="tech.DriveTest" todir="${junit.output.dir}" /&gt; &lt;classpath refid="RWD_Testing.classpath" /&gt; &lt;/junit&gt; &lt;/target&gt;. I finally get the report but I just have a global result and not a detailled result (testRun1 -> success, testrun2 -> success). What seems wrong to you ?
has comment: http://stackoverflow.com/comment/34784259
score: 0
has comment: http://stackoverflow.com/comment/34784362
tagged with: automated-tests
tagged with: junit
answer count: 1

http://stackoverflow.com/q/22655197
tagged with: openshift
type: Question
has comment: http://stackoverflow.com/comment/34515434
has title: OpenShift access one WEB-app to another
tagged with: servlets
score: 0
tagged with: tomcat
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/34524569
answer count: 0
tagged with: java
tagged with: web-applications
has body: I installed a tomcat wecontainer on my openshift server. I succesfuly deployed two WEB-app on tomcat. The problem is that im trying to connect from one WEB-app to another. I'm using apache chemistry file share repository. And when im trying to connect to it from my own WEB-app redirectsNotSupported exception appears. I think i need to find out the right address to connect. Anyone have an idea?
has comment: http://stackoverflow.com/comment/34515845

http://stackoverflow.com/q/22671048
has comment: http://stackoverflow.com/comment/34535632
has body: It seems that the value object or data transfer object don't need to managed by spring. the value object is simple enough and don't have any ctor. the "new object" style is good enough and simple. is it? any advice is welcome, thx.
type: Question
has title: About value object and spring
score: 0
has comment: http://stackoverflow.com/comment/34535564
answer count: 0
type: UnansweredQuestion
tagged with: spring
tagged with: java

http://stackoverflow.com/comment/34627827
has text: in my last code i used DefaultTableModel model = new DefaultTableModel(data, columnNames); why did u use DefaultListModel model = (DefaultListModel) list.getModel();
comment on: http://stackoverflow.com/a/22721280
type: AnswerComment
score: 0
type: Comment

http://stackoverflow.com/q/22667855
answer count: 1
downvote count: 0
favorite count: 0
tagged with: geometry
has comment: http://stackoverflow.com/comment/34530334
has title: Getting width and height of a Shape object in JavaFX
upvote count: 2
score: 2
type: AnsweredQuestion
tagged with: 2d
tagged with: java
tagged with: javafx
has answer: http://stackoverflow.com/a/22671525
type: Question
has body: I have a method that takes any subclass of Shape (that can be Circle, Rectangle, Polygon, Line, etc...) and returns a Shape object. public Shape returnShapeObject() { return circle1; } The problem is that once I get the shape object representation of my circle, it no longer has a .getRadius() method. It doesn't have .getWidth() or .getHeight() either. How can I get the radius/width/height of a Shape object in 2d JavaFX then?
accepted answer: http://stackoverflow.com/a/22671525

http://stackoverflow.com/comment/34725117
comment on: http://stackoverflow.com/a/22757651
type: Comment
score: 0
has text: Actually when I debugged the .java in eclipse it did not come to "for (Result rr = scanner.next(); rr != null; rr = scanner.next())", it just stop and wait after "Configuration config = HBaseConfiguration.create()", I use Run as>Java Application to ran the .java , thank you.
type: AnswerComment

http://stackoverflow.com/comment/34510772
type: Comment
type: QuestionComment
has text: Actually all of this is working well. I just want to add a functionnality to make the "Enter" key of my keyboard working on my Button. Right now, this button is only clickable.
score: 0
comment on: http://stackoverflow.com/q/22657100

http://stackoverflow.com/comment/34818432
comment on: http://stackoverflow.com/q/22799601
has text: I did some more testing and here's my findings: As the body falls, it accelerates dues to gravity.When the vertical velocity approaches 2 times the worlds time_step value, this is when the linear velocity starts going crazy. Also, another thing I've noticed is when the above said behavior starts - linear velocity behaves in a "haphazard" fashion - i.e Sometimes it decreases rapidly and Sometimes it goes straight to zero. If I increased the time step to a large value (like 100) - the world updates rather slowly, but the linear velocity issue seems to be addressed. Is this a libgdx/box2d bug?
type: Comment
type: QuestionComment
score: 0

http://stackoverflow.com/comment/34597647
type: Comment
has text: See [Should I avoid the use of set(Preferred|Maximum|Minimum)Size methods in Java Swing?](http://stackoverflow.com/q/7229226/418556) (Yes.)
score: 1
comment on: http://stackoverflow.com/a/22698920
type: AnswerComment

http://stackoverflow.com/q/22651520
answer count: 1
tagged with: jpa
downvote count: 0
has comment: http://stackoverflow.com/comment/34501250
favorite count: 0
tagged with: postgresql
has title: Date is changed after persist in database?
type: AnsweredQuestion
score: 1
tagged with: java
tagged with: hibernate
upvote count: 1
type: Question
tagged with: jodatime
has body: User inputs date from JSP page, and it converts to Joda DateTime, the string output is 2014-03-26T00:00:00.000+09:00 However when I persist this entity containing date filed in database, and retrieve and print out again, it becomes 2014-03-25T09:00:00.000+09:00. I don't know why database make this change to minus one day. I use postgres, hibernate JPA for application development. Thanks in advance.
has answer: http://stackoverflow.com/a/22652103
accepted answer: http://stackoverflow.com/a/22652103

http://stackoverflow.com/q/22752215
tagged with: objectify
tagged with: google-app-engine
has comment: http://stackoverflow.com/comment/34701337
score: 2
has title: objectify v4 - couldn't import static com.googlecode.objectify.objectifyService.ofy;
has comment: http://stackoverflow.com/comment/34715372
answer count: 0
upvote count: 2
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/34709183
type: Question
has body: i'm using eclipse I added the jar files ( both objectify-4.1-javadoc.jar &amp; guava-16.0.1.jar ) I added them to the build path and still this import doesn't work import static com.googlecode.objectify.objectifyService.ofy; i think it somehow recognizes just the packages. ( i should probably mention that objectify v3 worked well ,I was just missing a full documentation , if someone could provide one , i'll be very thankful)
has comment: http://stackoverflow.com/comment/34702506
has comment: http://stackoverflow.com/comment/34708855
tagged with: java
has comment: http://stackoverflow.com/comment/34681876
tagged with: eclipse
has comment: http://stackoverflow.com/comment/34714898
has comment: http://stackoverflow.com/comment/34682597
downvote count: 0
favorite count: 0
has comment: http://stackoverflow.com/comment/34715122

http://stackoverflow.com/comment/34644034
type: AnswerComment
type: Comment
score: 0
comment on: http://stackoverflow.com/a/22731156
has text: Emmm..may I ask what does "capturing" mean?

http://stackoverflow.com/comment/34714955
type: Comment
has text: Maybe I didn't explain very well so I'll try again. The whole point of oauth is that you authenticate once to get a trusted token which can then be used to prove who you are during all subsequent http requests. In order for this to work you will need to pass the oauth token either in the header or body of a request to a protected url, the url's themselves do not need to change you just have to pass additional data in your request. If this is not what you want then oauth may not be for you. I am not a .Net user so I can't give you a .Net version of my example but a quick google should find some
comment on: http://stackoverflow.com/a/22764965
score: 0
type: AnswerComment

http://stackoverflow.com/comment/45877217
has text: @AlexandreSantos can you take a look at my use of PriorityQueue in this question? http://stackoverflow.com/questions/28800287/how-to-restore-the-priorityqueue-to-its-initial-state-before-the-method-call
comment on: http://stackoverflow.com/a/22793421
score: 0
type: AnswerComment
type: Comment

http://stackoverflow.com/comment/34582121
score: 0
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/22697065
has text: They're pretty much one and the same anyway. `String.valueOf(int)` simply wraps `Integer.toString(int)`.

http://stackoverflow.com/a/22656670
has body: Set an attribute variable in your session by: session.setAttribute("var_name","value"); and check the variable in JSP page by: &lt;script&gt; &lt;%if(session.getAttribute("var_name")!=null){%&gt; //write your form validation code alert("In Submit form"); var frm=document.getElementById("myForm"); frm.action="Electionservlet?formidentity=editYPName"; alert("before submit"); frm.submit(); &lt;%} else {%&gt; //redirect the user to Error page or alert("Please login again"); &lt;%}%&gt; &lt;/script&gt;
score: 0
type: Answer
answers question: http://stackoverflow.com/q/22656241
has comment: http://stackoverflow.com/comment/34510438

http://stackoverflow.com/a/22735147
has comment: http://stackoverflow.com/comment/34651622
upvote count: 2
type: AcceptedAnswer
answers question: http://stackoverflow.com/q/22735081
has comment: http://stackoverflow.com/comment/34651421
accepted answer of: http://stackoverflow.com/q/22735081
type: Answer
score: 2
downvote count: 0
has body: Just a guess but have you added this about activity to the manifest? Ok I think you're running out of bitmap space. You need to start recycling your bitmaps! There will be a bitmap method called .Recycle() which you can execute before changing activity! This should hopefully solve your problem! Or you're loading a bitmap which is too large.. Hope this helps!
has comment: http://stackoverflow.com/comment/34651401

http://stackoverflow.com/a/22657848
has comment: http://stackoverflow.com/comment/34511871
answers question: http://stackoverflow.com/q/22648305
has body: u can use log4j or log4j2 am just providing an xml for log4j xml based appender Structure here <?xml version="1.0" encoding="UTF-8"?> <log4j:configuration xmlns:log4j="http://jakarta.apache.org/log4j/" debug="false"> <errorHandler class="org.apache.log4j.helpers.OnlyOnceErrorHandler" /> <errorHandler class="org.apache.log4j.helpers.OnlyOnceErrorHandler" /> <level value="ALL" /> <appender-ref ref="CONSOLE" /> <appender-ref ref="NORMAL_LOG_FILE" /> <appender-ref ref="ERR_LOG_FILE" /> <level value="INFO" /> <appender-ref ref="CONSOLE" /> <appender-ref ref="NORMAL_LOG_FILE" /> <appender-ref ref="ERR_LOG_FILE" /> <appender-ref ref="CONSOLE" /> <appender-ref ref="NORMAL_LOG_FILE" /> </log4j:configuration>
has comment: http://stackoverflow.com/comment/34534758
has comment: http://stackoverflow.com/comment/34597423
type: Answer
has comment: http://stackoverflow.com/comment/34578371
has comment: http://stackoverflow.com/comment/34553553
score: 0

http://stackoverflow.com/comment/34607465
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/22710555
has text: As I have used so many times these types of issue is not with java 8.0.It's the problem of client so dont mentioned here.
score: 0

http://stackoverflow.com/comment/34534996
type: QuestionComment
score: 3
comment on: http://stackoverflow.com/q/22670740
has text: you should probably use `set` (replaces) instead of `add` (inserts).
type: Comment

http://stackoverflow.com/comment/34568249
has text: @Christian: The code was already valid and how I wanted it to be - the `Builder` class is a nested class within `Person`. With your change, the usage at the bottom would have been invalid. It's fairly common (in my experience) to nest the builder for a type within the type itself.
type: AnswerComment
score: 0
type: Comment
comment on: http://stackoverflow.com/a/22687146

http://stackoverflow.com/a/22668076
answers question: http://stackoverflow.com/q/22664574
downvote count: 0
score: 1
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/34533064
has comment: http://stackoverflow.com/comment/34533284
has body: MVC pattern is meant for one machine. So you can have the MVC pattern on your tablet. The controller here is kind of the glue code which instantiates the view and also creates the models (DAOs - Data Access Objects) to get data from the server. This is all independent from what you will use on the server. You could say that on the server you also want to have something similar like MVC - in that case, the controller handles the REST, SOAP, ... - requests and instantiates a DAO which will retrieve the information from a file, database, ... The view afterwards could be seen as a serialiser which creates XML or JSON documents out of the fetched data. What you might rather ask yourself, is if you want to have a Rich- or a Thin-Client. Rich-Clients have more independent logic, can maybe cache the data, ...; while Thin-Clients only display data and forward every performed action to the server.
upvote count: 1
type: Answer
has comment: http://stackoverflow.com/comment/34533196
accepted answer of: http://stackoverflow.com/q/22664574

http://stackoverflow.com/a/22783072
has comment: http://stackoverflow.com/comment/34737556
has body: In your constructor for "MyPane", you're setting the default foreground colour to the default foreground for JTextPane, but then after the constructor you're calling setForeground(Color.red). The issue is the "defaultForegroundColor" member in MyPane doesn't know it's meant to be red. Make the following adjustments: public MyPane(Color defaultForegroundColor) { this.defaultForegroundColor = defaultForegroundColor; this.disabledTextColor = getDisabledTextColor(); } and create it using the following code: final JTextPane pane = new MyPane(Color.red); If you want to change the foreground after construction, do the following: public void setNewForeground(Color c) { this.defaultForegroundColor = c; }
score: 0
has comment: http://stackoverflow.com/comment/34737434
answers question: http://stackoverflow.com/q/22782483
type: Answer

http://stackoverflow.com/comment/34592672
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/22697284
has text: For better help sooner, post an [MCVE](http://stackoverflow.com/help/mcve) (Minimal Complete and Verifiable Example).
score: 0

http://stackoverflow.com/comment/34626887
has text: I was going to suggest implementing a set using `IdentityHashMap` in the background. But why implement when a tool already exists to do it for you?
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/22721449
type: Comment

http://stackoverflow.com/comment/36166544
score: 0
comment on: http://stackoverflow.com/q/22750080
type: Comment
type: QuestionComment
has text: @RC No, "Etc/GMT+2" is equivalent to "UTC-02:00"!!! (note the reversed sign)

http://stackoverflow.com/comment/34714925
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/22770649
score: 0
has text: No, you're not. Read about type erasure.

classpath
tags question: http://stackoverflow.com/q/22722129
tags question: http://stackoverflow.com/q/22805906
tags question: http://stackoverflow.com/q/22792255
tags question: http://stackoverflow.com/q/22664565
type: Tag
tags question: http://stackoverflow.com/q/22744700
tags question: http://stackoverflow.com/q/22747346
tags question: http://stackoverflow.com/q/22664342
tag name: classpath

http://stackoverflow.com/comment/34745795
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/22788031
has text: simple function which generate random string with certain length and yes is use SecureRandom which instance is crateted just once
score: 0

http://stackoverflow.com/comment/34700106
score: 0
type: Comment
type: AnswerComment
comment on: http://stackoverflow.com/a/22761987
has text: it is not. It is only declared.

http://stackoverflow.com/q/22777893
tagged with: java
has title: CXF: WSDLToService Error : Input binding does not exist in imported contract
answer count: 0
has comment: http://stackoverflow.com/comment/34728402
type: UnansweredQuestion
type: Question
has body: I'm using wsdl2java to generate right wsdl which will be then used to generate java code. wsdl2service -transport soap -e sname -p pname -n jaxb service.wsdl However I get "WSDLToService Error : Input binding does not exist in imported contract" message in response. What do i miss and how do I specify binding correctly?
score: 0
has comment: http://stackoverflow.com/comment/34728510
tagged with: cxf

http://stackoverflow.com/a/22781145
accepted answer of: http://stackoverflow.com/q/22780692
answers question: http://stackoverflow.com/q/22780692
type: AcceptedAnswer
downvote count: 0
score: 1
has body: Unfortunately you can't do that in Java. But this is closer with that: HashMap&lt;String, LinkedList&gt; dest = new HashMap&lt;String, LinkedList&gt;(); dest.put("China", ChinaShip); dest.put("Hongkong", HongkongShip); ..... if(dest.containsKey(Destination){ dest.get(Destination).getFirst(); }
type: Answer
has comment: http://stackoverflow.com/comment/34778415
upvote count: 1

http://stackoverflow.com/comment/34506771
type: Comment
type: AnswerComment
comment on: http://stackoverflow.com/a/22654780
score: 0
has text: I've tried to use WhiteBox but since in @Autowired service defined as interface I got exception: org.powermock.reflect.exceptions.FieldNotFoundException: No instance field named "validator" could be found in the class hierarchy of CartService.

http://stackoverflow.com/comment/34671828
comment on: http://stackoverflow.com/q/22745270
has text: @AKS I changed the code and edited my post. Still unable to figure it out.
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/34555153
score: 0
type: QuestionComment
type: Comment
has text: Have written the query to create table first ?
comment on: http://stackoverflow.com/q/22682078

http://stackoverflow.com/q/22668479
has comment: http://stackoverflow.com/comment/34533015
has answer: http://stackoverflow.com/a/22694055
type: AnsweredQuestion
has body: I'm trying to build a simple mailer daemon for a Tomcat 7, MySQL app (and Eclipse). This the first time I have tried to use a ServletContextListener. Everything works perfectly. Except, if I change my mailer code, and Tomcat reloads the class. It then bombs with a JNDI exception where it can't find the database. I'm not comfortable using it as-is. I don't want a class reload to kill the task on the server. Everything works fine after a restart and before the reload. So I must be missing something or doing things in the wrong order. The database connection is done in the DAO. So after restarting, the DAO must be getting severed? Any help would be most appreciated... The error I am getting is: Name [comp/env/jdbc/somedb] is not bound in this Context. Unable to find [comp]. javax.naming.NameNotFoundException: Name [comp/env/jdbc/somedb] is not bound in this Context. Unable to find [comp]. PooledConnection has already been closed. at org.apache.naming.NamingContext.lookup(NamingContext.java:819) at org.apache.naming.NamingContext.lookup(NamingContext.java:167) at org.apache.naming.SelectorContext.lookup(SelectorContext.java:156) at javax.naming.InitialContext.lookup(Unknown Source) at util.DbUtil.getConnection(DbUtil.java:23) at dao.NoticeDao.getNoticesByEvent(NoticeDao.java:49) at dao.NoticeDao.getNoticesByStatus(NoticeDao.java:46) at util.AppMailer.sendMailQueue(AppMailer.java:88) at util.AppMailer.run(AppMailer.java:71) at java.lang.Thread.run(Unknown Source) java.sql.SQLException: PooledConnection has already been closed. at org.apache.tomcat.jdbc.pool.DisposableConnectionFacade.invoke(DisposableConnectionFacade.java:86) at com.sun.proxy.$Proxy7.prepareStatement(Unknown Source) at dao.NoticeDao.getNoticesByEvent(NoticeDao.java:60) at dao.NoticeDao.getNoticesByStatus(NoticeDao.java:46) at util.AppMailer.sendMailQueue(AppMailer.java:88) at util.AppMailer.run(AppMailer.java:71) at java.lang.Thread.run(Unknown Source) Update: For a second attempt, I simplified and separ…
type: Question
tagged with: servletcontextlistener
tagged with: java
accepted answer: http://stackoverflow.com/a/22694055
has title: ServletContextListener losing JNDI connection on restart
tagged with: servlets
score: 0
answer count: 1
tagged with: tomcat

http://stackoverflow.com/q/22656578
has comment: http://stackoverflow.com/comment/34696679
tagged with: ms-word
has comment: http://stackoverflow.com/comment/34697487
has comment: http://stackoverflow.com/comment/34548292
has comment: http://stackoverflow.com/comment/34532612
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/34510691
tagged with: apache-poi
answer count: 0
tagged with: java
has body: Question: How to determine the pagecount of Microsoft Word documents programmatically in Java? First of all: I know POI's SummaryInformation.getPageCount() and I currently use it to determine the pagecount. The problem is that it simply reads the document's statistics and some MS Word versions in the past did not properly update these statistics. So there are documents around the world where this Summary Information is simply wrong. Therefore POI's SummaryInformation.getPageCount() is wrong, too. I need to do a "real" page count which does not rely on document's statistics or I need to update the statistics with the "real" values. The latter I can do with re-saving the document with MS Word but I hope you've some better solution for me. :-) All Java libraries are welcome when they can solve this here. It does not have to be POI.
type: Question
has title: Pagecount of Microsoft Word documents
has comment: http://stackoverflow.com/comment/34696628
score: 0
has comment: http://stackoverflow.com/comment/34509975

http://stackoverflow.com/a/22692355
has body: Yes, you are correct (almost). It's called ternary operator. Your logic is good but you must take care that the variable is initialized outside of the if-else statement. String output; if (val == answer) { output = "42"; } else { output = "We may never know"; } If the variable would be defined inside if and else blocks you would not be able to use it after the } sign because it would fall out of the scope.
type: Answer
answers question: http://stackoverflow.com/q/22692300
score: 0

http://stackoverflow.com/comment/34742748
score: 0
type: AnswerComment
has text: Glad it helped. Do you still have any question or any further question?
type: Comment
comment on: http://stackoverflow.com/a/22786006

http://stackoverflow.com/q/22710733
has comment: http://stackoverflow.com/comment/34606879
has body: I have this SQL query that I run through JDO in java: SELECT idPath, token, isTV, rel FROM path LEFT OUTER JOIN relation ON (path.idTokenN=relation.idTokenN) WHERE path.idPath IN( SELECT DISTINCT path.idPath FROM path WHERE path.isTV='true' ) AND path.idPath IN( SELECT DISTINCT path.idPath FROM path GROUP BY path.idPath HAVING COUNT(*) &gt;= 2 AND COUNT(*) &lt;= 3 ) To run it takes about 3 hours, how can I decrease the execution time? EDIT Using the MySQL DBMS path table: idTokenN idPath token isTV 1 p1 test1 true 2 p1 test2 false 3 p2 test3 true 4 p3 test4 false 5 p3 test5 false 6 p4 test6 false 7 p4 test7 true 8 p4 test8 false 9 p4 test9 false 10 p5 test10 true 11 p5 test11 false 12 p5 test12 false relation table: idTokenN idTokenN2 rel 10 11 test Of course the data in my DB are many, this is just an example!
score: 0
has answer: http://stackoverflow.com/a/22711147
has comment: http://stackoverflow.com/comment/34607061
tagged with: sql
answer count: 1
accepted answer: http://stackoverflow.com/a/22711147
type: AnsweredQuestion
tagged with: java
has title: Increase speed of SQL query execution
tagged with: jdo
has comment: http://stackoverflow.com/comment/34607324
type: Question
has comment: http://stackoverflow.com/comment/34606840

http://stackoverflow.com/comment/34505171
type: AnswerComment
has text: this is essentially what I have described to have already tried.. I get a `SQL Error: 0, SQLState: 24000 The executeQuery method must return a result set. org.hibernate.exception.GenericJDBCException: could not extract ResultSet` error
type: Comment
comment on: http://stackoverflow.com/a/22653643
score: 0

http://stackoverflow.com/comment/34775557
has text: yes I tried this , but I want this optionpane to be always on the top !!! .. so I tried with Jdailog.
score: 0
comment on: http://stackoverflow.com/a/22804600
type: AnswerComment
type: Comment

http://stackoverflow.com/comment/34576252
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/22672857
type: Comment
has text: @raguM.tech: That's true. notifyDataSetChanged() already is included in the Googgle Places Training example.

class
tags question: http://stackoverflow.com/q/22649610
tags question: http://stackoverflow.com/q/22739196
tags question: http://stackoverflow.com/q/22710118
tags question: http://stackoverflow.com/q/22672109
tags question: http://stackoverflow.com/q/22799802
tags question: http://stackoverflow.com/q/22790625
tags question: http://stackoverflow.com/q/22733404
tags question: http://stackoverflow.com/q/22729678
tags question: http://stackoverflow.com/q/22757772
tags question: http://stackoverflow.com/q/22777319
tags question: http://stackoverflow.com/q/22700944
tags question: http://stackoverflow.com/q/22698584
tags question: http://stackoverflow.com/q/22657710
tags question: http://stackoverflow.com/q/22789135
tags question: http://stackoverflow.com/q/22800055
tags question: http://stackoverflow.com/q/22658131
tags question: http://stackoverflow.com/q/22664342
tags question: http://stackoverflow.com/q/22728394
tags question: http://stackoverflow.com/q/22678077
tags question: http://stackoverflow.com/q/22794329
tags question: http://stackoverflow.com/q/22699188
tags question: http://stackoverflow.com/q/22771720
tags question: http://stackoverflow.com/q/22774308
type: Tag
tags question: http://stackoverflow.com/q/22650711
tags question: http://stackoverflow.com/q/22701070
tags question: http://stackoverflow.com/q/22778165
tags question: http://stackoverflow.com/q/22772874
tags question: http://stackoverflow.com/q/22736938
tags question: http://stackoverflow.com/q/22727212
tags question: http://stackoverflow.com/q/22675763
tags question: http://stackoverflow.com/q/22798561
tags question: http://stackoverflow.com/q/22783023
tag name: class
tags question: http://stackoverflow.com/q/22669328
tags question: http://stackoverflow.com/q/22701653
tags question: http://stackoverflow.com/q/22738147
tags question: http://stackoverflow.com/q/22800917
tags question: http://stackoverflow.com/q/22755551
tags question: http://stackoverflow.com/q/22774660
tags question: http://stackoverflow.com/q/22696171
tags question: http://stackoverflow.com/q/22732030
tags question: http://stackoverflow.com/q/22741306
tags question: http://stackoverflow.com/q/22774869
tags question: http://stackoverflow.com/q/22651770
tags question: http://stackoverflow.com/q/22737593
tags question: http://stackoverflow.com/q/22720960
tags question: http://stackoverflow.com/q/22784030
tags question: http://stackoverflow.com/q/22654860

neo4j
tags question: http://stackoverflow.com/q/22777794
tags question: http://stackoverflow.com/q/22745529
tags question: http://stackoverflow.com/q/22713653
tags question: http://stackoverflow.com/q/22710368
tag name: neo4j
tags question: http://stackoverflow.com/q/22705018
tags question: http://stackoverflow.com/q/22740759
tags question: http://stackoverflow.com/q/22803885
tags question: http://stackoverflow.com/q/22736918
tags question: http://stackoverflow.com/q/22801551
tags question: http://stackoverflow.com/q/22753817
tags question: http://stackoverflow.com/q/22679154
tags question: http://stackoverflow.com/q/22729665
tags question: http://stackoverflow.com/q/22730611
tags question: http://stackoverflow.com/q/22765965
tags question: http://stackoverflow.com/q/22717508
type: Tag
tags question: http://stackoverflow.com/q/22729122
tags question: http://stackoverflow.com/q/22799123
tags question: http://stackoverflow.com/q/22677382
tags question: http://stackoverflow.com/q/22751483

http://stackoverflow.com/q/22781613
has comment: http://stackoverflow.com/comment/34779027
has comment: http://stackoverflow.com/comment/34737113
has comment: http://stackoverflow.com/comment/34735323
has comment: http://stackoverflow.com/comment/34735087
favorite count: 0
upvote count: 2
tagged with: double
accepted answer: http://stackoverflow.com/a/22831744
has body: Im trying to read a double from a serial port. I can read it in String, but when I parse the String to Double, the result makes no sense, and it's not the same from the String. This is my code: public void serialEvent(SerialPortEvent event){ switch(event.getEventType()) { case SerialPortEvent.DATA_AVAILABLE: byte[] readBuffer = new byte[8]; try { while (inputStream.available()&gt;0) { int numBytes = inputStream.read(readBuffer); String peso = new String (readBuffer, 0, numBytes, "UTF-8"); System.out.print(new String (readBuffer, 0, numBytes, "UTF-8")); //double d = ByteBuffer.wrap(readBuffer).order(ByteOrder.LITTLE_ENDIAN ).getDouble(); //System.out.print(d); m_dWeightBuffer = Double.parseDouble(peso); System.out.print(m_dWeightBuffer); } //System.out.print(new String (readBuffer, 0, numBytes, "UTF-8")); } catch (IOException ex) {} break; } } But now, you know how I can convert this string to Double? System.out.print(new String (readBuffer, 0, numBytes, "UTF-8")); Output: 000.250 Good m_dWeightBuffer = Double.parseDouble(peso); System.out.print(m_dWeightBuffer); Output: 0.00.0250.0 Bad System.out.println(new String (readBuffer, 0, numBytes, "UTF-8")); Output: 0 0 0 .250
tagged with: serial-port
type: AnsweredQuestion
score: 2
has comment: http://stackoverflow.com/comment/34786204
tagged with: java
type: Question
answer count: 2
possible better answer: http://stackoverflow.com/a/22784081
has title: Read double from serial port
has comment: http://stackoverflow.com/comment/34734422
has answer: http://stackoverflow.com/a/22784081
downvote count: 0
has answer: http://stackoverflow.com/a/22831744

http://stackoverflow.com/comment/34528659
has text: You're getting a number format exception because "Ace" is not something that `parseInt()` would process properly. You could use a variety of methods to make it print out the face card names. A `switch` block with the proper values would be easiest, or a lookup array, or a series of `if` statements...
comment on: http://stackoverflow.com/q/22667136
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/34681386
comment on: http://stackoverflow.com/a/22744643
has text: Yes, most (all?) modern VCSs have that capability and I currently use it frequently in SVN and Git. In a past life, I've been the guy who enforced use of the various process tools, so you're preaching to the choir. But I also frequently do quick clones that live for a very short time before being deleted. For those, I personally find the sans-VCS approach the best tool for the job, but YMMV. The OP will indeed be well-served to learn and use the proper tools, but in the meantime he can use this low-tech method.
score: 0
type: AnswerComment
type: Comment

http://stackoverflow.com/q/22791834
upvote count: 5
tagged with: java
type: Question
answer count: 2
score: 5
has answer: http://stackoverflow.com/a/22791858
downvote count: 0
has title: Why am I getting, "incompatible types: Object cannot be converted to String" with this?
tagged with: http-get
tagged with: android
favorite count: 0
tagged with: android-studio
possible better answer: http://stackoverflow.com/a/22791944
tagged with: android-gradle-plugin
accepted answer: http://stackoverflow.com/a/22791858
has answer: http://stackoverflow.com/a/22791944
has body: I'm trying to use the simplest possible code for calling a Web API REST method from an Android app, and the code that I found here looked very promising: public String callWebService(String requestUrl) { String deviceId = "Android Device"; HttpClient httpclient = new DefaultHttpClient(); HttpGet request = new HttpGet(requestUrl); request.addHeader("deviceId", deviceId); ResponseHandler handler = new BasicResponseHandler(); String result = ""; try { result = httpclient.execute(request, handler); // &lt;= a line too far } catch (ClientProtocolException e) { e.printStackTrace(); } catch (IOException e) { e.printStackTrace(); } httpclient.getConnectionManager().shutdown(); return result; } However, it won't compile, telling me: "incompatible types: Object cannot be converted to String" on this line: result = httpclient.execute(request, handler); It does give a couple of options in an attempt to circumvent the logjam: ...but I don't know which, if any, of these options is the preferred way to solve this dilemma. Is one way "the way"? UPDATE This code, as I said, looks promising to me, however I think it's basically unusable as is, because it gives me the dreaded "NetworkOnMainThreadException" From logcat: 04-01 13:18:41.861 1267-1267/hhs.app E/AndroidRuntime﹕ FATAL EXCEPTION: main . . . java.lang.IllegalStateException: Could not execute method of the activity . . . Caused by: java.lang.reflect.InvocationTargetException . . . Caused by: android.os.NetworkOnMainThreadException
type: AnsweredQuestion

http://stackoverflow.com/q/22715593
type: Question
tagged with: javascript
linked to: http://stackoverflow.com/q/14939298
has comment: http://stackoverflow.com/comment/34615936
has title: How to download file linking to Javascript using Java
score: 0
linked to: http://stackoverflow.com/q/1359689
answer count: 1
has comment: http://stackoverflow.com/comment/34615812
type: UnansweredQuestion
has body: This is not a duplicate . I have a Selenium solution for this, but I do not prefer using Selenium . I hope somevbody could help me with a HttpUrlConnection code that would deal with this javascript directly rather than finding a work around that pop up using Selenium On a webpage I have the following link (covered with an image) Ones I click on this link a pop up window shows up and I can click on the save How can I get this file programmatically using Java? There must be a way to stream the file without even touching that pop up So far I am using Selenium and Java Robot object to hit that save button . But I am sure there must be a way to download it directly .
has answer: http://stackoverflow.com/a/22715740
tagged with: java
tagged with: selenium
has comment: http://stackoverflow.com/comment/34615870
tagged with: http

http://stackoverflow.com/comment/50037414
score: 0
type: Comment
has text: IntelliJ overrides this leaking behavior by using a weak string interner in its classloader: https://github.com/JetBrains/intellij-community/commit/cd4238cf943dcd9ee6dee730ea006e4deb9e74a4
type: QuestionComment
comment on: http://stackoverflow.com/q/22792269

http://stackoverflow.com/comment/34711553
type: Comment
has text: Didn't even see your post, I was tabbed in WoW, I use selenium daily :) will +1 yours
score: 1
type: AnswerComment
comment on: http://stackoverflow.com/a/22767890

http://stackoverflow.com/comment/34727379
comment on: http://stackoverflow.com/q/22776711
score: 0
type: Comment
type: QuestionComment
has text: @dimo414 I compiled this in Java 8 and 7. It doesn't work in either one.

http://stackoverflow.com/q/22655795
type: Question
upvote count: 2
answer count: 2
has answer: http://stackoverflow.com/a/22658061
accepted answer: http://stackoverflow.com/a/22658061
favorite count: 0
has title: Heroku Slug Size exceed Limits More than 300m
has answer: http://stackoverflow.com/a/22661924
has body: My heroku slug size is 389mb, so push is rejected. Now the Point is, if i deploy my same application on new domain (by using heroku create again), the slug size, i am seeing is just 200mb.. Why its different? Then I have tried this approach: Approach 1: by deleting .git folder from my project directory, then again git init. and then deploying again on same heroku app.. It didn't make any differences! Approach 2: By declaring .slugignore file in root of project folder. But its too not making any diff! Approach 3: as per this site, https://github.com/heroku/heroku-repo I have reset my repo like this, heroku repo:reset -a appname But, nothing happened!! What to do now? Can u guide me? Thnx.
tagged with: spring
tagged with: git
tagged with: heroku
score: 2
type: AnsweredQuestion
downvote count: 0
possible better answer: http://stackoverflow.com/a/22661924
tagged with: java

http://stackoverflow.com/comment/34753285
type: Comment
has text: Thank you! I am surprised I did not catch that, yes, that is what I meant.
type: AnswerComment
comment on: http://stackoverflow.com/a/22792182
score: 0

http://stackoverflow.com/comment/34593739
has text: This code has been very useful to me, also following the advices mentioned in the others answers, really appreciate this support.
comment on: http://stackoverflow.com/a/22675879
type: AnswerComment
score: 0
type: Comment

http://stackoverflow.com/a/22785985
answers question: http://stackoverflow.com/q/22785838
type: Answer
has comment: http://stackoverflow.com/comment/34743644
has comment: http://stackoverflow.com/comment/34745376
score: 0
has body: Make sure you're connecting to the right host/port and that these are accessible. To do this, e.g. open a terminal and type telnet &lt;host&gt; &lt;port&gt; from the same machine on which you're running the Java code.

http://stackoverflow.com/comment/34629018
has text: what is the error you are getting? and what is the value of `session.getId()` ?
type: AnswerComment
score: 0
type: Comment
comment on: http://stackoverflow.com/a/22699585

http://stackoverflow.com/a/22770889
score: 3
downvote count: 0
has comment: http://stackoverflow.com/comment/34948335
answers question: http://stackoverflow.com/q/22770771
upvote count: 3
has body: You are printing startTime directly (e.g. the toString() from java.util.Date); if you want your output to match your specified DateFormat you could do - String dateTimePattern = "yyyy-MM-dd HH:mm:ss.SSS"; SimpleDateFormat sdf = new SimpleDateFormat(dateTimePattern); Date startTime = sdf.parse("2014-03-14 04:16:58.666"); System.out.println(sdf.format(startTime)); // &lt;-- use the DateFormat. Which will output 2014-03-14 04:16:58.666
type: Answer

http://stackoverflow.com/comment/34632840
type: AnswerComment
has text: yeah it has event listener. that problem is solved now. it was because of the loop never ends. for ( int i = 1; i<31;); but still got issues with invalid date like 54-30-2014.
type: Comment
comment on: http://stackoverflow.com/a/22722306
score: 0

http://stackoverflow.com/q/22751844
tagged with: libgdx
tagged with: scene2d
tagged with: java
possible better answer: http://stackoverflow.com/a/22754677
has body: I have started a small project to help me learn scene2D in libGDX and keep running into a nullPointerException. My goal is to get the player to jump by using and actions sequence. My issue is that the player does jump up, but once it falls back down the game crashes. I have included the bits of my code that I belive are causing the problems. As I am still fairly new to libGDX and scene2d, I am unfamiliar with the differences between setX() setY() and the setPosition(x,y) methods that might be causing problems. I would also like to know a little more about what exactly delta and parentAlpha are and how to use them correctly The error I get Exception in thread "LWJGL Application" java.lang.NullPointerException at com.badlogic.gdx.scenes.scene2d.actions.MoveToAction.begin(MoveToAction.java:26) at com.badlogic.gdx.scenes.scene2d.actions.TemporalAction.act(TemporalAction.java:48) at com.badlogic.gdx.scenes.scene2d.actions.SequenceAction.act(SequenceAction.java:65) at com.badlogic.gdx.scenes.scene2d.Actor.act(Actor.java:85) at com.chiefpeanut.noodle.Tony.act(Tony.java:48) at com.badlogic.gdx.scenes.scene2d.Group.act(Group.java:48) at com.badlogic.gdx.scenes.scene2d.Stage.act(Stage.java:225) at com.chiefpeanut.noodle.GameScreen.render(GameScreen.java:54) at com.badlogic.gdx.Game.render(Game.java:46) at com.badlogic.gdx.backends.lwjgl.LwjglApplication.mainLoop(LwjglApplication.java:207) at com.badlogic.gdx.backends.lwjgl.LwjglApplication$1.run(LwjglApplication.java:114) The important part of my player class public class Tony extends Actor{ public Rectangle bounds; public float posX; public float posY; MoveToAction jumpUp; MoveToAction jumpDown; public Tony() { posX = 10f; posY = 10f; bounds = new Rectangle(); setHeight(100); setWidth(100); //scale(1, 1); setPosition(10, 10); setX(10f); setY(10f); setPosition(10, 10); jumpUp = new MoveToAction(); jumpUp.setPosition(10, 80); jumpUp.setDuration(2f); jumpDown = new MoveToAction(); jumpDown.setPosition(10, 10); jumpDown.setDurat…
type: Question
has title: libGDX MoveToAction nullPointerException
answer count: 2
score: 0
has comment: http://stackoverflow.com/comment/34681504
has answer: http://stackoverflow.com/a/22754911
tagged with: action
has answer: http://stackoverflow.com/a/22754677
tagged with: actor
accepted answer: http://stackoverflow.com/a/22754911
type: AnsweredQuestion

http://stackoverflow.com/comment/34620308
type: Comment
comment on: http://stackoverflow.com/a/22699366
has text: That's a great answer. Thank you for taking the time to explain everything the way you did. It's the kind of answer I was hoping for when I posted, showing a perspective that I don't have yet.
type: AnswerComment
score: 0

http://stackoverflow.com/q/22730714
type: Question
tagged with: eclipse
score: 0
answer count: 1
has answer: http://stackoverflow.com/a/22730841
accepted answer: http://stackoverflow.com/a/22730841
type: AnsweredQuestion
has title: java eclipse fails to detect a "bin" located file
tagged with: java
has body: I use eclipse and put a File called "example.txt" into the bin-folder where the class files are generated (and into the sub-folder of the package). But still, the program allways prints out the error message i wrote for the case the file is not found. Main Class: import java.io.BufferedReader; public class Main { public static void main(String[] args){ BufferedReader file = Console.file("example.txt"); ... } Console Class: public final class Console { public static BufferedReader file(String args) { BufferedReader file = null; try { file = new BufferedReader(new FileReader(args)); } catch (FileNotFoundException e) { println("Error, file not found!"); System.exit(1); } return file; } } any ideas?

http://stackoverflow.com/a/22701879
upvote count: 2
score: 2
answers question: http://stackoverflow.com/q/22701070
downvote count: 0
has body: It's not entirely a question of personal style. But nevertheless, I assume that this topic might be slightly controversial (opinion-based) and thus not perfectly suited for a Q/A-site. However, the obvious question is: Does an object of the respective class really carry a state? That is, is there any benefit in having the state represented by an instance? If the sole purpose of the instance is to be an accumulator of variables that are modified with a sequence of set... calls and a final call to an execute() method, then there is usually no real justification for such an instance - except for avoiding to have a static method with "many" parameters. I think that the advantages of static methods outweigh most of the potential clumsiness of calling a method with "many" parameters. One of the most important ones is probably that the approach with static methods doesn't increase the state space. Every field is another dimension in the state space, and documenting state space properly can be hard. Static methods enforce a more "functional" programming style: They don't have any side-effects, and thus, are thread-safe (which is becoming increasingly important). (Note: All this refers to static methods that are not related to any static state - that should be avoided anyhow. And of course, this refers to methods that are not involved in or aiming at anything related to polymorphism). And after all, one can easily call any static method from anywhere - even from within an instance method, and pass in some fields as parameters. The opposite is not so easy: When you want to call a method that depends on many instance fields, it can be a hassle when you first have to create an object and set the fields appropriately (still not knowing whether it is in a valid state to call the method). I also see the default methods of Java 8 as a nice application case where static utility methods come in handy: The default method may easily delegate to the utility method, because no state is i…
type: Answer
has comment: http://stackoverflow.com/comment/34600606

http://stackoverflow.com/a/22725713
upvote count: 1
downvote count: 0
has body: In Java 1.7+, you get other compiler errors about break; being unreachable (they're unnecessary because of your return statements), as has been mentioned already. You can remove them and it'll compile fine. However, in Java 1.6 and before, you get the incompatible types error. This is because Strings in case statements were supported in Java only starting with 1.7. To solve this, upgrade your Java to at least 1.7, or try a numeric value or an enum for your codes.
score: 1
answers question: http://stackoverflow.com/q/22725684
type: Answer

deserialization
type: Tag
tags question: http://stackoverflow.com/q/22800519
tags question: http://stackoverflow.com/q/22746442
tags question: http://stackoverflow.com/q/22666935
tag name: deserialization
tags question: http://stackoverflow.com/q/22671060
tags question: http://stackoverflow.com/q/22807120
tags question: http://stackoverflow.com/q/22679913

http://stackoverflow.com/a/22812121
has comment: http://stackoverflow.com/comment/34909164
accepted answer of: http://stackoverflow.com/q/22806507
answers question: http://stackoverflow.com/q/22806507
type: AcceptedAnswer
downvote count: 0
type: Answer
upvote count: 1
has body: Split your method into smaller methods and then use the profiling tools on those methods...
score: 1

http://stackoverflow.com/comment/34647611
type: QuestionComment
has text: what you mean? I have an view (index.jsp) where it's placed the form, which is mapped in the controller. If I run the application, I get an error 404, unless I directly access to localhost:8080/spring/index (typinf the address in the address bar of browser). This happens with our without the Spring Security configuration, but with the Spring Security configured at least i get an default login page before the error page.
score: 0
comment on: http://stackoverflow.com/q/22729725
type: Comment

http://stackoverflow.com/comment/34794786
score: 0
type: AnswerComment
type: Comment
has text: I'm not sure whether this site allow to share those kind of details. We may get banned..
comment on: http://stackoverflow.com/a/22807590

http://stackoverflow.com/comment/61239227
score: 0
comment on: http://stackoverflow.com/a/22731729
has text: Indeed two casts (i.e. `Object[]` and `String`) cannot be done in one step. They need to be done step by step. Thanks for the great incite.
type: AnswerComment
type: Comment

search-engine
type: Tag
tags question: http://stackoverflow.com/q/22796350
tag name: search-engine

http://stackoverflow.com/a/22747988
score: 2
upvote count: 2
answers question: http://stackoverflow.com/q/22746985
type: AcceptedAnswer
downvote count: 0
accepted answer of: http://stackoverflow.com/q/22746985
has body: You could do int count = 0; for(int k = 0; k &lt; 9; k++) { for(int i = 0; i &lt; 3; i++) { for(int j = 0; j &lt; 3; j++) { extraboard[count++] = SquareBoard[i+3*k/3][j+k%3*3]; } } Arrays.sort(extraboard); for(int j = 0; j &lt; 9; j++) { if(extraboard[j] == truelist[j]) loop += 1; } extraboard = new int[9]; count = 0; } The actual formula to calculate the location in the box is quite simple. As the board is split into rows and column, getting the location of the row and column needs to get offset based on the location of the box in the full area. i here counts the index within the box of the row. As each row of boxes has a length of 3 in a 9x9 sudoku we need to increase the row number by 3 each time we get 3 boxes in. To figure out and only add 3 we can use some integer division. For example: i+i.length*k/i.length This is obviously an syntax error as i doesn't have length but can consider it as the limit of i in the loop (in this case 3). This would then get the current row in the box (the first i) and add that to the offset of boxes in the sudoki. That is for every 3 boxes k/i.length becomes 1 more, and we then multiply that with 3 to get the offset of 3. In the column part we have a bit of an bigger issue as we need to offset it for every 3 we move left in the array and reset it when we get back to boxes on the far left. So the forumla would become j + (k%i.length)*j.length This would give us the column in the box we are in, then we offset by the box location with k%i.length. The reason we use the i.length and not the j.length is that we need to calculate the offset by rows and then offset it by the length of the box column wise. With this you can then apply to this to any size board. 2x2, 2x3, 3x2, 3x3 or bigger even.
type: Answer

casting
tags question: http://stackoverflow.com/q/22652788
tags question: http://stackoverflow.com/q/22671404
tags question: http://stackoverflow.com/q/22728344
tags question: http://stackoverflow.com/q/22651909
tag name: casting
type: Tag
tags question: http://stackoverflow.com/q/22805257
tags question: http://stackoverflow.com/q/22756987
tags question: http://stackoverflow.com/q/22661449
tags question: http://stackoverflow.com/q/22657007
tags question: http://stackoverflow.com/q/22720012
tags question: http://stackoverflow.com/q/22785096
tags question: http://stackoverflow.com/q/22685422
tags question: http://stackoverflow.com/q/22783024

http://stackoverflow.com/q/22754299
tagged with: data-structures
has comment: http://stackoverflow.com/comment/34686083
favorite count: 0
has answer: http://stackoverflow.com/a/22754337
has comment: http://stackoverflow.com/comment/34685302
tagged with: dictionary
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/34687949
possible better answer: http://stackoverflow.com/a/22754336
upvote count: 1
downvote count: 1
type: Question
tagged with: hashmap
tagged with: java
has comment: http://stackoverflow.com/comment/34686180
accepted answer: http://stackoverflow.com/a/22754337
has body: Two different objects can have same hashCode and are equal. How to fetch the actual object by its reference ? For example :- class Dog { public String name; public Dog(String n){ this.name = n; } public boolean equals(Object o){ if((o instanceof Dog) &amp;&amp; ((Dog)o).name.length() == this.name.length()){ return true; }else{ return false; } } public int hashCode(){ return name.length(); } @Override public String toString(){ return name; } } public class MapTest { public static void main(String ar[]){ Map&lt;Object, Object&gt; m = new HashMap&lt;Object, Object&gt;(); Dog d1 = new Dog("clover"); Dog d2 = new Dog("abcdef"); m.put(d1, new Dog("aiko1")) m.put(d2, new Dog("aiko")); System.out.println(m.get(d1)); System.out.println(m.get(d2)); } } OutPut :- aiko aiko The value of d1 however is aiko1 but when we fetch, the value printed is aiko. How can we fetch actual d1 value ?
has comment: http://stackoverflow.com/comment/34686398
score: 0
answer count: 2
has answer: http://stackoverflow.com/a/22754336
has title: Retrieve actual value in hashmap collision
has comment: http://stackoverflow.com/comment/34685264
has comment: http://stackoverflow.com/comment/34685998

http://stackoverflow.com/comment/34629155
type: Comment
score: 0
has text: Yeah, I did run your code naturally, I see the hint and solution. I just fully intentionally assumed that the problem wasn't with the LayoutManager. Actually I thought I already tested it. But there is however a thing here I'm interested to learn! If I can declare additional stand-alone classes in a single file, can I also access them from outside the file, in the same package?
type: AnswerComment
comment on: http://stackoverflow.com/a/22720376

http://stackoverflow.com/comment/76490295
has text: in c# it works like this: https://learn.microsoft.com/en-us/dotnet/csharp/programming-guide/classes-and-structs/access-modifiers
score: 0
type: Comment
comment on: http://stackoverflow.com/a/22808964
type: AnswerComment

http://stackoverflow.com/comment/34597027
has text: @praveen_mohan - 1. Switch case for Strings(IDs) needs a higher Java version. 2. He will still have to write several switch cases.
comment on: http://stackoverflow.com/q/22705062
score: 0
type: QuestionComment
type: Comment

http://stackoverflow.com/comment/34637081
comment on: http://stackoverflow.com/q/22724191
score: 0
has text: Thanks to reply. I'm 100% sure there is nothing new. All is same. Same device, same apk file, same server file. Furthermore, The PC with Win 7 has more higher hardware spec. The only thing I think different is just a windows OS.
type: Comment
type: QuestionComment

http://stackoverflow.com/q/22792842
has comment: http://stackoverflow.com/comment/34754951
has comment: http://stackoverflow.com/comment/34755241
tagged with: large-data
has comment: http://stackoverflow.com/comment/34756379
answer count: 0
tagged with: processbuilder
type: UnansweredQuestion
score: 0
has title: How to use ProcessBuilder for running large-output programs in Java?
has body: I'm trying to run fff.exe inside a java program. - fff.exe algorithm: $ run fff.exe ggg.txt 12345 while ggg has lines line = ggg.getline if line contains 12345: print.to.stdout( line ) - fff.exe reads ggg.txt line by line, outputting a subset of lines from ggg.txt; - fff.exe's output is generated by a loop; --- ie. one line at a time --- ie. not generated all at once - fff.exe's output is too large to be held in memory When I run the following code inside main, the output is: made it here Done and the destination file is empty; what am I doing wrong? hhh.csv should be the output of fff.exe. As well, did I properly use ProcessBuilder? I mean to run fff.exe with arguments ggg.txt 12345 outputting to a file called hhh.csv. ProcessBuilder pb = new ProcessBuilder( "M:\\aaa\\bbb\\ccc\\ddd\\workspace\\fff.exe", "M:\\aaa\\bbb\\ccc\\ddd\\eee\\ggg.txt", "12345" ); try { System.out.println( "made it here!" ); File destination = new File( "M:\\aaa\\bbb\\ccc\\ddd\\eee\\hhh.csv" ); pb.redirectOutput( ProcessBuilder.Redirect.to( destination ) ); Process p = pb.start(); p.waitFor(); } catch ( Exception e ) { System.out.println( e ); } System.out.println( "Done" );
tagged with: java
type: Question
has comment: http://stackoverflow.com/comment/34755464

http://stackoverflow.com/a/22694137
score: 1
has comment: http://stackoverflow.com/comment/34578010
accepted answer of: http://stackoverflow.com/q/22693847
has body: Update: The solution below is a general network connectivity one and won't necessarily tell you if you can get location updates through wifi as pointed out in comments. You can register to receive network connectivity updates using a BroadcastReceiver. Register to listen for the android.net.conn.CONNECTIVITY_CHANGE action. Take a look at this for more info. Below, is a sample receiver. public class ConnectivityReceiver extends WakefulBroadcastReceiver { private static final String TAG = ConnectivityReceiver.class.getSimpleName(); @Override public void onReceive(Context context, Intent intent) { ConnectivityManager cm = (ConnectivityManager) context.getSystemService(Context.CONNECTIVITY_SERVICE); if (cm.getActiveNetworkInfo() != null &amp;&amp; cm.getActiveNetworkInfo().isConnected()) { Log.d(TAG, "network state change; new state: connected"); } else { Log.d(TAG, "network state change; new state: " + (cm.getActiveNetworkInfo() != null ? cm.getActiveNetworkInfo().getState() : " unknown")); } } }
answers question: http://stackoverflow.com/q/22693847
upvote count: 1
has comment: http://stackoverflow.com/comment/34577260
type: AcceptedAnswer
downvote count: 0
type: Answer

string
tags question: http://stackoverflow.com/q/22759077
tags question: http://stackoverflow.com/q/22670649
tags question: http://stackoverflow.com/q/22806748
tags question: http://stackoverflow.com/q/22731037
tags question: http://stackoverflow.com/q/22709174
tags question: http://stackoverflow.com/q/22739072
tags question: http://stackoverflow.com/q/22662619
tags question: http://stackoverflow.com/q/22675651
tags question: http://stackoverflow.com/q/22787000
tags question: http://stackoverflow.com/q/22700748
tags question: http://stackoverflow.com/q/22797382
tags question: http://stackoverflow.com/q/22757149
tags question: http://stackoverflow.com/q/22728344
tags question: http://stackoverflow.com/q/22678833
tags question: http://stackoverflow.com/q/22675330
tags question: http://stackoverflow.com/q/22797801
tags question: http://stackoverflow.com/q/22677613
tags question: http://stackoverflow.com/q/22723630
tags question: http://stackoverflow.com/q/22706042
tags question: http://stackoverflow.com/q/22751748
tags question: http://stackoverflow.com/q/22730316
tags question: http://stackoverflow.com/q/22765820
tags question: http://stackoverflow.com/q/22725401
tags question: http://stackoverflow.com/q/22796385
tags question: http://stackoverflow.com/q/22713856
tags question: http://stackoverflow.com/q/22796902
tags question: http://stackoverflow.com/q/22751101
tags question: http://stackoverflow.com/q/22777319
tags question: http://stackoverflow.com/q/22655153
tags question: http://stackoverflow.com/q/22671595
tags question: http://stackoverflow.com/q/22699122
tags question: http://stackoverflow.com/q/22776085
tags question: http://stackoverflow.com/q/22718671
tags question: http://stackoverflow.com/q/22710834
tags question: http://stackoverflow.com/q/22720643
tags question: http://stackoverflow.com/q/22741371
tags question: http://stackoverflow.com/q/22740252
tags question: http://stackoverflow.com/q/22797389
tags question: http://stackoverflow.com/q/22648695
tags question: http://stackoverflow.com/q/22753235
tags question: http://stackoverflow.com/q/22773478
tags question: http://stackoverflow.com/q/22757792
tags question: http://stackoverflow.com/q/22691718
tags question: http://stackoverflow.com/q/22800671
tags question: http://stackoverflow.com/q/22724871
tags question: http://stackoverflow.com/q/22667872
tags question: http://stackoverflow.com/q/22727303
tags question: http://stackoverflow.com/q/22769480
tags question: http://stackoverflow.com/q/22668741
tags question: http://stackoverflow.com/q/22745421
tags question: http://stackoverflow.com/q/22652881
tags question: http://stackoverflow.com/q/22692811
tag name: string
tags question: http://stackoverflow.com/q/22706453
tags question: http://stackoverflow.com/q/22685717
tags question: http://stackoverflow.com/q/22754187
tags question: http://stackoverflow.com/q/22697242
tags question: http://stackoverflow.com/q/22735379
tags question: http://stackoverflow.com/q/22764040
tags question: http://stackoverflow.com/q/22744012
tags question: http://stackoverflow.com/q/22798401
tags question: http://stackoverflow.com/q/22744143
tags question: http://stackoverflow.com/q/22776856
tags question: http://stackoverflow.com/q/22697330
tags question: http://stackoverflow.com/q/22666288
tags question: http://stackoverflow.com/q/22796304
tags question: http://stackoverflow.com/q/22699735
tags question: http://stackoverflow.com/q/22753781
tags question: http://stackoverflow.com/q/22696039
tags question: http://stackoverflow.com/q/22779687
tags question: http://stackoverflow.com/q/22753286
tags question: http://stackoverflow.com/q/22774308
tags question: http://stackoverflow.com/q/22749632
type: Tag
tags question: http://stackoverflow.com/q/22722255
tags question: http://stackoverflow.com/q/22762789
tags question: http://stackoverflow.com/q/22735515
tags question: http://stackoverflow.com/q/22793184
tags question: http://stackoverflow.com/q/22769202
tags question: http://stackoverflow.com/q/22785878

http://stackoverflow.com/a/22705889
type: Answer
has body: Using org.json library (http://www.json.org/java/) JSONObject jsonObj = new JSONObject(data); and then you can access the ID and other data out of the jsonObj
has comment: http://stackoverflow.com/comment/34598400
answers question: http://stackoverflow.com/q/22705846
score: 0

http://stackoverflow.com/q/22737685
linked to: http://stackoverflow.com/q/9536077
has body: I am really used at the following kind of code in Ruby: my_hash = {} my_hash['test'] = 1 What is the correspondent data structure in Java?
type: Question
accepted answer: http://stackoverflow.com/a/22737711
answer count: 2
score: 5
has comment: http://stackoverflow.com/comment/34655296
has title: Equivalent of Ruby Hash in Java
possible better answer: http://stackoverflow.com/a/22737870
upvote count: 6
favorite count: 0
has answer: http://stackoverflow.com/a/22737870
tagged with: ruby
linked to: http://stackoverflow.com/q/40471
tagged with: hash
has answer: http://stackoverflow.com/a/22737711
downvote count: 1
type: AnsweredQuestion
tagged with: java

http://stackoverflow.com/a/22741360
has comment: http://stackoverflow.com/comment/34661900
has body: Basically they are methods which return new instances of the RandomIntGenerator class. Once you have those you can use the next() method to get random numbers. RandomIntGenerator generator = RandomIntGenerator.between(5, 10); int a = generator.next(); //a is now a "random" number between 5 and 10. If the constructor was public, you could replace the first line with the line below, as they have the same effect. RandomIntGenerator generator = new RandomIntGenerator(5, 10);
answers question: http://stackoverflow.com/q/22741341
has comment: http://stackoverflow.com/comment/34661865
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/34661743
has comment: http://stackoverflow.com/comment/34661828
has comment: http://stackoverflow.com/comment/34661725
score: 0
type: Answer
accepted answer of: http://stackoverflow.com/q/22741341

http://stackoverflow.com/a/48983463
downvote count: 3
has comment: http://stackoverflow.com/comment/110478869
has comment: http://stackoverflow.com/comment/91728996
has comment: http://stackoverflow.com/comment/88094146
has comment: http://stackoverflow.com/comment/103194985
has comment: http://stackoverflow.com/comment/110453877
has comment: http://stackoverflow.com/comment/87632185
answers question: http://stackoverflow.com/q/22740789
has comment: http://stackoverflow.com/comment/88100206
has comment: http://stackoverflow.com/comment/88095955
has comment: http://stackoverflow.com/comment/96527110
has comment: http://stackoverflow.com/comment/88092213
score: 66
has comment: http://stackoverflow.com/comment/110484191
has comment: http://stackoverflow.com/comment/88100068
has comment: http://stackoverflow.com/comment/96501521
type: Answer
has comment: http://stackoverflow.com/comment/88089770
has comment: http://stackoverflow.com/comment/88100219
upvote count: 69
has comment: http://stackoverflow.com/comment/88084323
has body: Unfortunately, like others have said, the Google Dictionary API is deprecated. As I needed a Google Dictionary API for my project, I decided to create one. I scraped the web page for the URL https://www.google.com/#q=define+term where term is any word you want to get meaning of, and created the API. You can find it here. How to use The basic syntax of a URL request to the API is shown below: https://api.dictionaryapi.dev/api/v2/entries/&lt;--language_code-->/&lt;--word--> As an example, to get definition of English word hello, you can send request to: https://api.dictionaryapi.dev/api/v2/entries/en/hello The API also provides other meanings of the word, example sentences, and synonyms, if any. If you want me to include any other details, please comment and I will happily extend the API to cover your needs. The source code is on GitHub.

http://stackoverflow.com/q/22779014
score: 0
tagged with: java
has comment: http://stackoverflow.com/comment/34731067
tagged with: eclipse
has title: About eclipse metadata, How can I just upload project metadata without the eclipse ide metadata to svn?
linked to: http://stackoverflow.com/q/86049
type: Question
has body: I think the Eclipse metadata can divided to class: 1, about the project metadata. 2, about the eclipse IDE itself, such as prerefrences for syntax color, font etc. I want my team member share the 1) not the 2) How can I do this? p.s. it seems that the 1) is stored in the project folder's .settings folder, and the 2) is stored in the workspace .metadata folder, if this is the true, then It will be easy to achieve my goal, is it the true?
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/34729710
has comment: http://stackoverflow.com/comment/34729729
has comment: http://stackoverflow.com/comment/34730414
has comment: http://stackoverflow.com/comment/34729739
answer count: 0

http://stackoverflow.com/comment/34788887
type: AnswerComment
has text: That works, but often for this sort of thing you need more sophisticated average/worst case/etc timings. In other words count how many times you went through the loop, the total time all those took and the single longest time.
type: Comment
comment on: http://stackoverflow.com/a/22806673
score: 0

http://stackoverflow.com/comment/34509345
comment on: http://stackoverflow.com/a/22656460
score: 2
has text: Count is ios not Java
type: AnswerComment
type: Comment

google-app-engine
tags question: http://stackoverflow.com/q/22768416
tag name: google-app-engine
tags question: http://stackoverflow.com/q/22714817
tags question: http://stackoverflow.com/q/22677964
type: Tag
tags question: http://stackoverflow.com/q/22660545
tags question: http://stackoverflow.com/q/22740332
tags question: http://stackoverflow.com/q/22668731
tags question: http://stackoverflow.com/q/22750329
tags question: http://stackoverflow.com/q/22665392
tags question: http://stackoverflow.com/q/22657226
tags question: http://stackoverflow.com/q/22666935
tags question: http://stackoverflow.com/q/22783803
tags question: http://stackoverflow.com/q/22694036
tags question: http://stackoverflow.com/q/22752215
tags question: http://stackoverflow.com/q/22712870
tags question: http://stackoverflow.com/q/22681899
tags question: http://stackoverflow.com/q/22704810
tags question: http://stackoverflow.com/q/22743380
tags question: http://stackoverflow.com/q/22665304
tags question: http://stackoverflow.com/q/22762397
tags question: http://stackoverflow.com/q/22725906
tags question: http://stackoverflow.com/q/22693955
tags question: http://stackoverflow.com/q/22779768
tags question: http://stackoverflow.com/q/22800314
tags question: http://stackoverflow.com/q/22707020
tags question: http://stackoverflow.com/q/22727041
tags question: http://stackoverflow.com/q/22701969
tags question: http://stackoverflow.com/q/22732977
tags question: http://stackoverflow.com/q/22791863
tags question: http://stackoverflow.com/q/22653771
tags question: http://stackoverflow.com/q/22723808
tags question: http://stackoverflow.com/q/22786215
tags question: http://stackoverflow.com/q/22699781
tags question: http://stackoverflow.com/q/22705941
tags question: http://stackoverflow.com/q/22792102
tags question: http://stackoverflow.com/q/22671910
tags question: http://stackoverflow.com/q/22804058
tags question: http://stackoverflow.com/q/22732995
tags question: http://stackoverflow.com/q/22785147
tags question: http://stackoverflow.com/q/22702822
tags question: http://stackoverflow.com/q/22663603

http://stackoverflow.com/comment/34668940
comment on: http://stackoverflow.com/a/22744907
score: 0
type: AnswerComment
type: Comment
has text: Im presuming path is the file directory route such as C:\Users\dc539... If so does this need to be a string?

http://stackoverflow.com/a/22683657
score: 2
upvote count: 2
has comment: http://stackoverflow.com/comment/34557860
accepted answer of: http://stackoverflow.com/q/22683448
answers question: http://stackoverflow.com/q/22683448
has comment: http://stackoverflow.com/comment/34557603
type: AcceptedAnswer
downvote count: 0
has body: You can implement this class and retrieve all the countries in the world. I also recommend you to use a auto suggestor in the country textfield.
type: Answer

http://stackoverflow.com/comment/34661651
type: Comment
type: AnswerComment
has text: I wanted to know some more things do you mind chatting with more for some minutes?
score: 0
comment on: http://stackoverflow.com/a/22741338

http://stackoverflow.com/comment/34765291
comment on: http://stackoverflow.com/q/22797605
type: QuestionComment
has text: that's why you have to paint it separately! Nothing you do on onDraw is permanent. You have to paint the trails every frame, just like you do with normal characters. Maybe you need to draw them as Paths (lines that you can add sections to) if they are very long, kind of snakes game. But either way, you'd need to do it every frame!
score: 0
type: Comment

http://stackoverflow.com/a/39164868
answers question: http://stackoverflow.com/q/22656891
has body: Why can't we do: menu.getSelectionModel().getSelectedIndex() which returns an int?
type: Answer
score: 0

http://stackoverflow.com/comment/34595947
has text: how to expire a link in jsp,if changes has been done on that jsp page and if not then link will expire in two days bydefault.
comment on: http://stackoverflow.com/q/22704423
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/a/24237904
has comment: http://stackoverflow.com/comment/37476915
type: Answer
answers question: http://stackoverflow.com/q/22754774
has comment: http://stackoverflow.com/comment/37438300
has comment: http://stackoverflow.com/comment/37468492
has comment: http://stackoverflow.com/comment/37438734
has comment: http://stackoverflow.com/comment/37468775
has comment: http://stackoverflow.com/comment/37468679
accepted answer of: http://stackoverflow.com/q/22754774
has comment: http://stackoverflow.com/comment/37468413
has comment: http://stackoverflow.com/comment/37469396
has comment: http://stackoverflow.com/comment/37449227
has comment: http://stackoverflow.com/comment/37468348
has comment: http://stackoverflow.com/comment/37469027
has comment: http://stackoverflow.com/comment/37439552
has comment: http://stackoverflow.com/comment/37468384
score: 4
upvote count: 4
has comment: http://stackoverflow.com/comment/37449527
has comment: http://stackoverflow.com/comment/37468466
type: AcceptedAnswer
downvote count: 0
has body: Please take a look at my answer to the following question: Set inherit Zoom(action property) to bookmark in the pdf file In that answer, I read bookmarks using the SimpleBookmark object. That's probably the same way you are reading bookmarks. The result is a List of HashMap objects that represents an outline tree. I use a recursive method to find all the "Page" entries. These page entries contain a destination, for instance Fit, FitH, XYZ,... You need to change all these references into XYZ references of which you set the zoom factor to 0. A zoom factor 0 is the equivalent of 'Inherit Zoom'. In my answer to Set inherit Zoom(action property) to bookmark in the pdf file I had this code: public void changeList(List&lt;HashMap&lt;String, Object&gt;&gt; list) { for (HashMap&lt;String, Object&gt; entry : list) { for (String key : entry.keySet()) { if ("Kids".equals(key)) { Object o = entry.get(key); changeList((List&lt;HashMap&lt;String, Object&gt;&gt;)o); } else if ("Page".equals(key)) { String dest = (String)entry.get(key); entry.put("Page", dest.replaceAll("Fit", "FitV 60")); } } } } It's obvious that you can replace any existing "Page" action by a completely new action. For instance: entry.put("Page", "XYZ 30 100 0"); Now you'll jump to the coordinate 30 100 on the page with an inherited zoom factor. If you want to zoom in on another part, for instance a location that corresponds more or less with the original location, you need to examine the coordinates that followed the FitR in your original PDF. There are 4: the lower-left x, lower-left y, upper-right x and upper-right y coordinate. You could parse the string with the original destination for those values and reuse two of these coordinates as your X and Y values in the XYZ destination. The X Y coordinate passed with the XYZ destination is the coordinate of the top-left corner. For instance, if you have FitR -3 234 486 627, then you zoom in on a rectangle with coordinates llx = -3, lly = 234, urx = 486 and ury = 62…
has comment: http://stackoverflow.com/comment/37468603
has comment: http://stackoverflow.com/comment/37468308
has comment: http://stackoverflow.com/comment/37468757

http://stackoverflow.com/a/22764068
score: 9
has comment: http://stackoverflow.com/comment/47440623
downvote count: 0
has comment: http://stackoverflow.com/comment/52452104
type: Answer
has comment: http://stackoverflow.com/comment/45198334
upvote count: 9
answers question: http://stackoverflow.com/q/22764011
has body: From the Gson documentation Exclude fields and objects based on a particular class type: private static class SpecificClassExclusionStrategy implements ExclusionStrategy { private final Class&lt;?&gt; excludedThisClass; public SpecificClassExclusionStrategy(Class&lt;?&gt; excludedThisClass) { this.excludedThisClass = excludedThisClass; } public boolean shouldSkipClass(Class&lt;?&gt; clazz) { return excludedThisClass.equals(clazz); } public boolean shouldSkipField(FieldAttributes f) { return excludedThisClass.equals(f.getDeclaringClass()()); } }

http://stackoverflow.com/comment/34604432
has text: Okay I will try your suggestion. :) I am trying your backtracking version and I'm waiting for it to display an output but it still won't display.
score: 0
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/22708426

http://stackoverflow.com/comment/34663455
score: 0
comment on: http://stackoverflow.com/q/22742238
type: Comment
type: QuestionComment
has text: Well i am getting my own website xml data. So its localhost:8080

http://stackoverflow.com/a/22688374
accepted answer of: http://stackoverflow.com/q/22688296
score: 5
type: AcceptedAnswer
upvote count: 5
downvote count: 0
answers question: http://stackoverflow.com/q/22688296
type: Answer
has body: The simplest way is to use comparator: Collections.sort(list, new Comparator&lt;String&gt;() { public void compare(String one, String two) { return getNumber(one) - getNumber(two); } private int getNumber(String str) { return Integer.parseInt(one.split(" ")[0]); } } I really do not know what can be simpler.
has comment: http://stackoverflow.com/comment/34566361

jpanel
tags question: http://stackoverflow.com/q/22697284
tags question: http://stackoverflow.com/q/22736759
tags question: http://stackoverflow.com/q/22735049
tags question: http://stackoverflow.com/q/22725253
tags question: http://stackoverflow.com/q/22701312
tags question: http://stackoverflow.com/q/22701149
type: Tag
tags question: http://stackoverflow.com/q/22650872
tags question: http://stackoverflow.com/q/22719976
tags question: http://stackoverflow.com/q/22752177
tags question: http://stackoverflow.com/q/22766644
tags question: http://stackoverflow.com/q/22793454
tags question: http://stackoverflow.com/q/22712655
tags question: http://stackoverflow.com/q/22796121
tags question: http://stackoverflow.com/q/22703165
tags question: http://stackoverflow.com/q/22694410
tags question: http://stackoverflow.com/q/22731462
tags question: http://stackoverflow.com/q/22674859
tags question: http://stackoverflow.com/q/22702302
tags question: http://stackoverflow.com/q/22674163
tags question: http://stackoverflow.com/q/22676515
tags question: http://stackoverflow.com/q/22777952
tags question: http://stackoverflow.com/q/22695068
tags question: http://stackoverflow.com/q/22745286
tag name: jpanel
tags question: http://stackoverflow.com/q/22673666
tags question: http://stackoverflow.com/q/22798216
tags question: http://stackoverflow.com/q/22749647
tags question: http://stackoverflow.com/q/22798153
tags question: http://stackoverflow.com/q/22747023
tags question: http://stackoverflow.com/q/22651614
tags question: http://stackoverflow.com/q/22703209
tags question: http://stackoverflow.com/q/22697567
tags question: http://stackoverflow.com/q/22683140

http://stackoverflow.com/q/22739072
possible better answer: http://stackoverflow.com/a/22739108
has comment: http://stackoverflow.com/comment/34658264
has comment: http://stackoverflow.com/comment/34657810
tagged with: string
tagged with: integer
has comment: http://stackoverflow.com/comment/34657843
has answer: http://stackoverflow.com/a/22739107
accepted answer: http://stackoverflow.com/a/22739107
has body: I'm a struggling newbie trying to finish a program assignment and am stuck with my output repeating itself with the digits of an integer that should be together on one line, but spaced (Correct Ex:The digits of 1234 are: 1 2 3 4). Here is an example of the incorrect output and below that is my program. Any guidance would be greatly appreciated. Enter an integer: 1234 The digits of 1234 are: 1 The digits of 1234 are: 2 The digits of 1234 are: 3 The digits of 1234 are: 4 The sum of the digits = 10 My program: import java.util.*; public class IntegertoIndividualtoSum { public static void main(String[] args) { long integer, digit, sum = 0; char digitAt; String Stringnum; Scanner keyboard = new Scanner(System.in); System.out.print("Enter an integer: "); integer = keyboard.nextLong(); Stringnum = String.valueOf(Math.abs(integer)); for (int count = 0; count &lt; Stringnum.length(); count++) { digitAt = Stringnum.charAt(count); digit = Character.getNumericValue(digitAt); sum += digit; System.out.println("The digits of " + integer + " are: " + digit); } System.out.println("The sum of the digits = " + sum); } }
has comment: http://stackoverflow.com/comment/34658246
has title: Java enter integer and output spaced digits and sum
type: AnsweredQuestion
tagged with: java
has answer: http://stackoverflow.com/a/22739140
has answer: http://stackoverflow.com/a/22739108
tagged with: loops
has comment: http://stackoverflow.com/comment/34658204
type: Question
has comment: http://stackoverflow.com/comment/34658259
has comment: http://stackoverflow.com/comment/34658182
score: 0
has comment: http://stackoverflow.com/comment/34657851
answer count: 3
tagged with: converters

http://stackoverflow.com/a/22651817
has comment: http://stackoverflow.com/comment/34555581
score: 0
has body: You could use a ConcurrentHashMap - this type of Map is thread-safe. Or, synchronize on the class so that any instance of the class will share the same lock. Or, synchronize on the map.
answers question: http://stackoverflow.com/q/22651763
type: Answer
upvote count: 2
downvote count: 2
has comment: http://stackoverflow.com/comment/34543737
has comment: http://stackoverflow.com/comment/34502256
has comment: http://stackoverflow.com/comment/34545426

http://stackoverflow.com/comment/34742315
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/22785662
has text: I'm not well into RSA but shouldn't you pick randoms from `SecureRandom` ?
score: 0

http://stackoverflow.com/q/22793638
tagged with: android
accepted answer: http://stackoverflow.com/a/22793810
tagged with: php
linked to: http://stackoverflow.com/q/10267910
type: AnsweredQuestion
tagged with: java
tagged with: mysql
has title: Android accessing remote mysql database
type: Question
has body: I've been trying, using multiple examples, to access a remote server (digitalocean) through an android application. Currently i'm getting an error with parsing the data from the URL and i'm not 100% sure why. Could you help me out, the code is below. java code: public class MainActivity extends Activity { TextView txt1,txt2,txt3; public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); new task().execute(); } class task extends AsyncTask&lt;String, String, Void&gt; { private ProgressDialog progressDialog = new ProgressDialog(MainActivity.this); InputStream is = null ; String result = ""; protected void onPreExecute() { progressDialog.setMessage("Fetching data..."); progressDialog.show(); progressDialog.setOnCancelListener(new OnCancelListener() { @Override public void onCancel(DialogInterface arg0) { task.this.cancel(true); } }); } @Override protected Void doInBackground(String... params) { String url_select = "http://server1.chris.waszczuk/webservice/select.php"; HttpClient httpClient = new DefaultHttpClient(); HttpPost httpPost = new HttpPost(url_select); ArrayList&lt;NameValuePair&gt; param = new ArrayList&lt;NameValuePair&gt;(); try { httpPost.setEntity(new UrlEncodedFormEntity(param)); HttpResponse httpResponse = httpClient.execute(httpPost); HttpEntity httpEntity = httpResponse.getEntity(); //read content is = httpEntity.getContent(); } catch (Exception e) { Log.e("log_tag", "Error in http connection "+e.toString()); } try { BufferedReader br = new BufferedReader(new InputStreamReader(is)); StringBuilder sb = new StringBuilder(); String line = ""; while((line=br.readLine())!=null) { sb.append(line+"\n"); } is.close(); result=sb.toString(); } catch (Exception e) { // TODO: handle exception Log.e("log_tag", "Error converting result "+e.toString()); } return null; } protected void onPostExecute(Void v) { // ambil data dari Json database try { JSONArray Jarray = new JSONArray(result); for(int i=0…
has comment: http://stackoverflow.com/comment/34756493
has answer: http://stackoverflow.com/a/22793810
score: 0
answer count: 1
has comment: http://stackoverflow.com/comment/34756118

android-gridview
type: Tag
tags question: http://stackoverflow.com/q/22802079
tag name: android-gridview
tags question: http://stackoverflow.com/q/22674183

http://stackoverflow.com/q/22765095
type: UnansweredQuestion
tagged with: swing
has title: I can't obtain the screenshot of a JFrame that I want
score: 0
tagged with: java
has body: I have this code: ` import java.awt.BorderLayout; import java.awt.EventQueue; import java.awt.Graphics; import java.awt.image.BufferedImage; import java.io.File; import javax.imageio.ImageIO; import javax.swing.JFrame; import javax.swing.JPanel; import javax.swing.border.EmptyBorder; public class Provare extends JFrame { private JPanel contentPane; public static int x=100; public static int y=100; /** * Launch the application. */ public static void main(String[] args) { EventQueue.invokeLater(new Runnable() { public void run() { try { x=(int) (100+(x*(Math.random()*3))); y=(int) (100+(y*(Math.random()*3))); Provare frame = new Provare(); frame.setVisible(true); BufferedImage image = new BufferedImage(frame.contentPane.getWidth(),frame.contentPane.getHeight(),BufferedImage.TYPE_INT_RGB ); frame.contentPane.printAll(image.getGraphics()); ImageIO.write(image, "bmp", new File("C:/Users/Resco/Desktop/scarpe/screen.bmp") ); } catch (Exception e) { e.printStackTrace(); } } }); } /** * Create the frame. */ public Provare() { setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); setBounds(100, 100, x, y); contentPane = new JPanel(); contentPane.setBorder(new EmptyBorder(5, 5, 5, 5)); contentPane.setLayout(new BorderLayout(0, 0)); setContentPane(contentPane); } public void paint(Graphics g){ super.paint(g); g.drawString("CIAO",(x/2),(x/2)); g.drawLine(50, 50, 100, 100); } } ` What I'd like to get is a screenshot with the text CIAO and a line. What I actually get is a screenshot of an empty element. Any suggestion? Feel free to post a modify version of my code. Thanks in advance.
has answer: http://stackoverflow.com/a/22765222
type: Question
answer count: 2
has answer: http://stackoverflow.com/a/22765309

vertica
tag name: vertica
tags question: http://stackoverflow.com/q/22767888
type: Tag

google-fusion-tables
type: Tag
tags question: http://stackoverflow.com/q/22789625
tag name: google-fusion-tables

http://stackoverflow.com/a/22793192
downvote count: 0
type: Answer
score: 3
upvote count: 3
has body: It is incorrect because the tree must hold its search capability meaning that it must keep a constant form. By having node 14 the right child we lose this form. 14 should be the left child to node 15. If you look at node 8 we see that if the value is less than 8, it is to the left, else the value is the right child. 10 / \ 8 12 / \ \ 1 9 15 / 14
answers question: http://stackoverflow.com/q/22793036
has comment: http://stackoverflow.com/comment/34758101

http://stackoverflow.com/q/22745081
answer count: 4
favorite count: 0
has answer: http://stackoverflow.com/a/22745324
upvote count: 2
tagged with: regex
possible better answer: http://stackoverflow.com/a/22745124
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/22745124
has answer: http://stackoverflow.com/a/22745894
tagged with: java
has comment: http://stackoverflow.com/comment/34668344
has body: Example: String letter = "abc+ab.c+abc.ab"; How to check if String letter contains . after last +?
type: Question
score: -2
has title: How to check if String has a Letter after a specific letter?
has answer: http://stackoverflow.com/a/22745136
accepted answer: http://stackoverflow.com/a/22745894
downvote count: 4
tagged with: string

http://stackoverflow.com/comment/34560724
type: Comment
type: QuestionComment
score: 0
comment on: http://stackoverflow.com/q/22684800
has text: I made a nested loop to reach to every item in the inner ArrayList. it throws the error mentioned in front of the code. I used this code: >> for (ArrayList word: list) copyOfList.add(word.clone())... too. but it cannot accept .add .

http://stackoverflow.com/q/22732503
tagged with: iscsi
type: Question
has body: I am using linux's default iscsi server. It is configured to be a target. Now, I'd like to programmatically add a target, that is I give a disk image path ex. /home/me/disks/image.img and I set it as a target, with an iqn and such. This has to be done at runtime, that is if I add a new target other targets still have to be available. Would this be possibile? I'd like to accomplish this in java but it isn't a strict requirement...
has title: How can I programmatically create an iscsi target on linux?
has answer: http://stackoverflow.com/a/24153722
score: 0
answer count: 1
tagged with: linux
type: UnansweredQuestion
tagged with: java

http://stackoverflow.com/comment/34676560
type: AnswerComment
comment on: http://stackoverflow.com/a/22747395
type: Comment
has text: I edited the question, I hope to be more clear now (I'm not english so there might be some errors)
score: 0

http://stackoverflow.com/q/22694972
has body: Android - How to check the existence of a string value in another comma separated string . String all_vals = "617,618,456,1,234,5,5678,225"; String check_val= "456"; How to check like, if (all_vals contains check_val) { }
favorite count: 0
has answer: http://stackoverflow.com/a/56765375
has answer: http://stackoverflow.com/a/22748723
has answer: http://stackoverflow.com/a/22695077
upvote count: 3
tagged with: java
accepted answer: http://stackoverflow.com/a/22695077
has answer: http://stackoverflow.com/a/41251215
answer count: 4
downvote count: 0
has title: Android - How to check the existence of a string value in another comma separated string
tagged with: string
tagged with: arraylist
type: Question
type: AnsweredQuestion
score: 3
tagged with: android
possible better answer: http://stackoverflow.com/a/56765375

http://stackoverflow.com/q/22741576
answer count: 1
has title: Class Design (design patterns) ideas in java?
has body: I am trying to learn design principles in java... where they say, program an interface and implement an interface rather than classes.. Keeping that in mind, here is my use case.. Read two formats of data (csv and json)from files..So, I am thinking of creating a "class" or module called "DataModel".. ? And then an algorithm module where I have two algorithms at this point (Linear Regression and Logistic Regression)... But, I can't get to think in "Design pattern" fashion.. If someone can help me what interfaces/patterns I should follow, it would be very helpful for me. Just to give a context, I want to build a very simple machine learning library..
type: AnsweredQuestion
score: 0
has answer: http://stackoverflow.com/a/22741653
tagged with: design-patterns
type: Question
tagged with: java
accepted answer: http://stackoverflow.com/a/22741653

http://stackoverflow.com/comment/34682120
has text: See http://docs.oracle.com/javase/tutorial/essential/exceptions/index.html
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/22752525

http://stackoverflow.com/a/22690826
has body: You're trying to call methods on members from the class, which is not possible. Those need to go inside a method (like a constructor or initializer). Example code: public class EventBusTest { private final EventBus eventBus = new EventBus("test"); private final MultipleListener multiListener = new MultipleListener(); public void init() { eventBus.register(multiListener); } } Also, this question may be of use to help you understand Classes vs Objects
downvote count: 0
type: Answer
score: 1
upvote count: 1
answers question: http://stackoverflow.com/q/22690633

http://stackoverflow.com/comment/60353261
has text: How would we scroll horizontally in this example?
type: AnswerComment
comment on: http://stackoverflow.com/a/22729902
score: 0
type: Comment

http://stackoverflow.com/comment/34660058
comment on: http://stackoverflow.com/a/22740393
has text: @user3427042 Change `[0-9]+` (1 or more) to `[0-9]*` (0 or more) for the integer portion.
score: 0
type: AnswerComment
type: Comment

http://stackoverflow.com/comment/34664284
has text: A CRC isn't the remainder of division. Also you didn't print `a`, only the calculated CRC, so even if it did return `1110` it would only print `1110` and not `11010110111110`.
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/22742516
score: 0

http://stackoverflow.com/a/23030932
downvote count: 0
upvote count: 2
answers question: http://stackoverflow.com/q/22702967
type: Answer
score: 2
has body: The problem, as you've more or less discovered yourself, is in the way the &lt;fragment&gt; tag is used in details.xml. Per the Android documentation: An activity's layout XML can include &lt;fragment&gt; tags to embed fragment instances inside of the layout. Basically, you were trying to use the tag as an actual layout for your fragment, whereas all it's meant to do is embed an existing fragment (which already has its own layout) in some other view. Therefore, the proper solution is indeed to build a layout for the fragment (e.g. a RelativeLayout as mentioned in the comments), making no use of &lt;fragment&gt;. If you then want to add the fragment you've created to some other layout (such as main.xml), you can use &lt;fragment&gt; to reference it. For instance, main.xml could be rewritten as: &lt;FrameLayout xmlns:android="http://schemas.android.com/apk/res/android" android:id="@+id/fragment_container" android:layout_width="match_parent" android:layout_height="match_parent" &gt; &lt;fragment android:layout_width="match_parent" android:layout_height="200dp" android:id="@+id/details" android:name="com.qstudios.whatsopenlate.PlaceDetailsFragment" android:tag="detailsTag" /&gt; &lt;/FrameLayout&gt; In which case you could remove the following part from main.java: FragmentTransaction xTransaction = getSupportFragmentManager().beginTransaction(); PlaceDetailsFragment placeDetailsFragment = new PlaceDetailsFragment(); xTransaction.add(R.id.fragment_container, placeDetailsFragment); xTransaction.commit(); If, however, you choose to add the fragment programatically with the FragmentManager (as you have), there's no need to use the tag at all. This is all explained very well in the Fragments API Guide (specifically the part about adding a fragment to an activity), which I'd strongly suggest reading.

http://stackoverflow.com/comment/34539895
type: AnswerComment
comment on: http://stackoverflow.com/a/22673291
score: 0
has text: So that reassigning variables in a method doesn't change anything. Good point.
type: Comment

http://stackoverflow.com/a/22795424
downvote count: 0
type: Answer
has comment: http://stackoverflow.com/comment/34789419
has body: 12 jars is not a very large number. Why not just append all the jars on the classpath? Alternatively, you can create another jar and specify all the jars in Class-Path variable in that jar's MANIFEST.MF and then add this single jar to your classpath. EDIT: Here is how I would do it. Create a MANIFEST.MF file with content similar to this: Manifest-Version: 1.0 Archiver-Version: whatever Created-By: whatever Built-By: author-name Build-Jdk: 1.6.0_34 Class-Path: jar1.jar jar2.jar jar3.jar replace jar1.jar with the actual file names of the jar. Then you can create a jar with command : jar cvf test.jar -m ./MANIFEST.MF . Now when you are using it on classpath use it like java -jar xyz.jar class-name
answers question: http://stackoverflow.com/q/22795183
upvote count: 5
score: 5

http://stackoverflow.com/a/22706611
score: 0
has body: You can use a third-party unit to finish the goal: com.google.common.collect.Collections2.transform(collection, Function), although it is also loop the collection internal. PS: A demo of how to use the method is like: List&lt;Long&gt; personIds = Collection2.transform(persons, new Function&lt;Person,Long&gt;(){ @Override public Long apply(@Nullable Person person) { return person.getPersonId(); } });
type: Answer
answers question: http://stackoverflow.com/q/22706448

http://stackoverflow.com/a/22653969
has comment: http://stackoverflow.com/comment/34508359
has comment: http://stackoverflow.com/comment/34509276
has comment: http://stackoverflow.com/comment/34505714
has comment: http://stackoverflow.com/comment/34507359
has comment: http://stackoverflow.com/comment/34507311
has comment: http://stackoverflow.com/comment/34508404
has comment: http://stackoverflow.com/comment/34509999
has comment: http://stackoverflow.com/comment/34508828
type: AcceptedAnswer
downvote count: 0
score: 6
has comment: http://stackoverflow.com/comment/34509867
has comment: http://stackoverflow.com/comment/34508252
has comment: http://stackoverflow.com/comment/34507970
has comment: http://stackoverflow.com/comment/34508809
has comment: http://stackoverflow.com/comment/34506266
has comment: http://stackoverflow.com/comment/34505484
has comment: http://stackoverflow.com/comment/34509327
upvote count: 6
has comment: http://stackoverflow.com/comment/34505536
has body: "How to give spaces between jlabel?" setBounds and null layouts: no; Use EmptyBorders: YES!; Use LayoutManagers: YES! "how can i use this can u explain little bit " Use can use the default FlowLayout of the containing JPanel (or in this case set the gaps of the FlowLayout) FlowLayout constructor: public FlowLayout(int align, int hgap, int vgap) align - the alignment value hgap - the horizontal gap between components and between the components and the borders of the Container vgap - the vertical gap between components and between the components and the borders of the Container Example JPanel panel = new JPanel(new FlowLayout(FlowLayout.CENTER, 20, 5); for (int i = 0; i &lt; 10; i++) { panel.add(new JLabel("Label" + i)); } You could use EmptyBorder EmptyBorder constructor public EmptyBorder(int top, int left, int bottom, int right) top - the top inset of the border left - the left inset of the border bottom - the bottom inset of the border right - the right inset of the border Example JPanel panel = new JPanel(); for (int i = 0; i &lt; 10; i++) { JLabel label = new JLabel("Label" + i); EmptyBorder border = new EmptyBorder(5, 20, 5, 20); label.setBorder(border); panel.add(label); } If you want to use a LineBorder and an EmptyBorder for margins, you can use a CompoundBorder A composite Border class used to compose two Border objects into a single border by nesting an inside Border object within the insets of an outside Border object. For example, this class may be used to add blank margin space to a component with an existing decorative border: CompoundBorder Example JPanel panel = new JPanel(); EmptyBorder border = new EmptyBorder(5, 20, 5, 20); LineBorder line = new LineBorder(Color.blue, 2, true); CompoundBorder compound = new CompoundBorder(line, border); for (int i = 0; i &lt; 10; i++) { JLabel label = new JLabel("Label" + i); label.setBorder(compound); panel.add(label); } There is an abundant number possibilities. Choose your flavor. The whole point it no not try …
has comment: http://stackoverflow.com/comment/34509064
has comment: http://stackoverflow.com/comment/34508981
type: Answer
has comment: http://stackoverflow.com/comment/34509526
has comment: http://stackoverflow.com/comment/34508150
has comment: http://stackoverflow.com/comment/34509025
answers question: http://stackoverflow.com/q/22653592
has comment: http://stackoverflow.com/comment/34506401
has comment: http://stackoverflow.com/comment/34506065
has comment: http://stackoverflow.com/comment/34505573
has comment: http://stackoverflow.com/comment/34509107
has comment: http://stackoverflow.com/comment/34505415
accepted answer of: http://stackoverflow.com/q/22653592

http://stackoverflow.com/comment/34686314
type: Comment
has text: @assylias: logically, it wasn't wrong because there was the *or* part; anyway, added a note.
type: AnswerComment
comment on: http://stackoverflow.com/a/22753957
score: 0

http://stackoverflow.com/comment/34605543
type: Comment
comment on: http://stackoverflow.com/a/22708287
has text: OK i have an idea. In your Run/debug configuration that you use to run your application change the change the working direcotry to the one you want (c:\my\git\repo\projectFiles\target\test-classes)? This will solve your problem most likely. Play arround with that and you will probably get it
score: 1
type: AnswerComment

http://stackoverflow.com/a/22729989
downvote count: 0
score: 1
has body: Insert code units as integer literals: #include &lt;iostream&gt; int main() { char[] string = { 0x41, 0x42, 0x43, 0x0A, 0x00 }; std::cout &lt;&lt; string; } In Java this should do: byte[] bytes = {(byte)0x41, (byte)0x42, (byte)0x43, (byte)0x0A}; String string = new String(bytes, "UTF-8");
has comment: http://stackoverflow.com/comment/34641839
has comment: http://stackoverflow.com/comment/34641861
answers question: http://stackoverflow.com/q/22729927
accepted answer of: http://stackoverflow.com/q/22729927
upvote count: 1
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/34643001
has comment: http://stackoverflow.com/comment/34642748
type: Answer
has comment: http://stackoverflow.com/comment/34641808
has comment: http://stackoverflow.com/comment/34641797

http://stackoverflow.com/comment/34517721
comment on: http://stackoverflow.com/q/22660397
type: Comment
type: QuestionComment
score: 0
has text: @InnocentKiller i remvoed smack.jar from lib folder,so now its not showing that error

http://stackoverflow.com/comment/34712201
score: 0
type: AnswerComment
has text: Alright! I know the problem. Your networking code is in your listener, and listeners are run on the main thread, however you MUST not do networking on the main thread, what you need to do is this: In the listener start a new Thread or AsyncTask and move the networking code there...
type: Comment
comment on: http://stackoverflow.com/a/22768141

http://stackoverflow.com/a/22783121
has body: I found a free &amp; open source sitemap generator written in java that you could modify here... Java-Open Source- SiteMap Generator Code
has comment: http://stackoverflow.com/comment/34737487
answers question: http://stackoverflow.com/q/22782851
score: 0
type: Answer

http://stackoverflow.com/a/22773792
answers question: http://stackoverflow.com/q/22773582
score: 1
upvote count: 1
has body: As I commented, that is not an example of a double negative. It is an expression of hate for the feeling about the iPhone, but it sounds like you would only like to count said feeling: the words affecting the Subject of your sentence. You would need to have your algorithm account for context: Determine the subject of your sentence. (Apple,president,iPhone,etc.) Locate any operative keywords ((really) hate/like/love, etc.) Score the sentence based on the operative words which apply to the subject you are concerned with. This algorithm you can imagine is very difficult to implement as it tends towards a general comprehension of natural language. As for double negatives you would probably want to try something like noting which words cause boolean flips to the sentiment, i.e., not, don't, etc. (most of them are contractions of not) and then do a count to determine the flip that it causes on the adjectives: i.e. I do not like green eggs and ham Identify green eggs and ham, backtrack to find keywords: not, like, maybe look for a verb, get some sentence-like regex? Again, not the easiest task and will likely always only be accurate to a degree. Count the nots and since its odd multiply your sentiment score by -1. I do not not like green eggs and ham Now we have two nots, its even, so we don't change the sentiment score, or multiply by +1. My overall suggestion would be to either take the false-positives and carry on, or to take a look into Natural Language Processing
type: Answer
downvote count: 0

http://stackoverflow.com/comment/34668710
type: AnswerComment
score: 0
type: Comment
comment on: http://stackoverflow.com/a/22745085
has text: My regex, will also, return the same. Check out the demo. It is working correctly

generics
tags question: http://stackoverflow.com/q/22756619
tags question: http://stackoverflow.com/q/22782240
tags question: http://stackoverflow.com/q/22758144
tags question: http://stackoverflow.com/q/22756987
tags question: http://stackoverflow.com/q/22688729
tags question: http://stackoverflow.com/q/22749950
tags question: http://stackoverflow.com/q/22689622
tags question: http://stackoverflow.com/q/22660651
tags question: http://stackoverflow.com/q/22786950
tags question: http://stackoverflow.com/q/22713863
tags question: http://stackoverflow.com/q/22775576
tags question: http://stackoverflow.com/q/22741687
tags question: http://stackoverflow.com/q/22672619
tags question: http://stackoverflow.com/q/22726946
tags question: http://stackoverflow.com/q/22744197
tags question: http://stackoverflow.com/q/22678998
tags question: http://stackoverflow.com/q/22664865
tags question: http://stackoverflow.com/q/22806784
type: Tag
tags question: http://stackoverflow.com/q/22806723
tags question: http://stackoverflow.com/q/22758894
tags question: http://stackoverflow.com/q/22803175
tags question: http://stackoverflow.com/q/22771184
tags question: http://stackoverflow.com/q/22758851
tags question: http://stackoverflow.com/q/22799393
tags question: http://stackoverflow.com/q/22674805
tags question: http://stackoverflow.com/q/22717234
tags question: http://stackoverflow.com/q/22802268
tags question: http://stackoverflow.com/q/22767445
tags question: http://stackoverflow.com/q/22733401
tags question: http://stackoverflow.com/q/22709444
tags question: http://stackoverflow.com/q/22703487
tags question: http://stackoverflow.com/q/22781213
tags question: http://stackoverflow.com/q/22671215
tags question: http://stackoverflow.com/q/22760230
tags question: http://stackoverflow.com/q/22775384
tags question: http://stackoverflow.com/q/22760513
tags question: http://stackoverflow.com/q/22806648
tags question: http://stackoverflow.com/q/22754225
tags question: http://stackoverflow.com/q/22736773
tags question: http://stackoverflow.com/q/22760204
tags question: http://stackoverflow.com/q/22779424
tags question: http://stackoverflow.com/q/22652546
tags question: http://stackoverflow.com/q/22806202
tags question: http://stackoverflow.com/q/22803394
tags question: http://stackoverflow.com/q/22801958
tags question: http://stackoverflow.com/q/22660811
tags question: http://stackoverflow.com/q/22791365
tags question: http://stackoverflow.com/q/22712640
tags question: http://stackoverflow.com/q/22669278
tags question: http://stackoverflow.com/q/22770649
tags question: http://stackoverflow.com/q/22695313
tag name: generics
tags question: http://stackoverflow.com/q/22732810
tags question: http://stackoverflow.com/q/22736078
tags question: http://stackoverflow.com/q/22686011
tags question: http://stackoverflow.com/q/22671500
tags question: http://stackoverflow.com/q/22688286
tags question: http://stackoverflow.com/q/22785320

http://stackoverflow.com/q/22662928
has body: Completely at my wit's end with this, nothing I can find seems to help. I keep getting the exception org.hibernate.HibernateException: No Session found for current thread at org.springframework.orm.hibernate4.SpringSessionContext.currentSession(SpringSessionContext.java:97) at org.hibernate.internal.SessionFactoryImpl.getCurrentSession(SessionFactoryImpl.java:988) at com.thing.basicwebform.dao.AbstractHbnDao.getSession(AbstractHbnDao.java:31) at com.thing.basicwebform.dao.HbnAccountDao.findByUsername(HbnAccountDao.java:38) at com.thing.basicwebform.service.AccountServiceImpl.validateUsername(AccountServiceImpl.java:34) at com.thing.basicwebform.service.AccountServiceImpl.registerAccount(AccountServiceImpl.java:27) at com.thing.basicwebform.AccountController.postRegistrationForm(AccountController.java:50) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:601) at org.springframework.web.method.support.InvocableHandlerMethod.invoke(InvocableHandlerMethod.java:219) at org.springframework.web.method.support.InvocableHandlerMethod.invokeForRequest(InvocableHandlerMethod.java:132) I've got my application context set up thusly: <?xml version="1.0" encoding="UTF-8"?> <beans xmlns="http://www.springframework.org/schema/beans" xmlns:context="http://www.springframework.org/schema/context" xmlns:jee="http://www.springframework.org/schema/jee" xmlns:p="http://www.springframework.org/schema/p" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:util="http://www.springframework.org/schema/util" xmlns:tx="http://www.springframework.org/schema/tx" xsi:schemaLocation=" http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.1.xsd http://www.springframework.org/schema/context http://www.springframework.org…
linked to: http://stackoverflow.com/q/20716939
answer count: 1
has comment: http://stackoverflow.com/comment/34527860
linked to: http://stackoverflow.com/q/8846586
has comment: http://stackoverflow.com/comment/34542807
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/34541275
tagged with: spring
tagged with: spring-mvc
has comment: http://stackoverflow.com/comment/34521189
has title: Spring 3 + Hibernate 4, No session for the current thread, Tried Everything
has comment: http://stackoverflow.com/comment/34543284
score: 0
tagged with: java
tagged with: hibernate
has comment: http://stackoverflow.com/comment/34521959
type: Question
has comment: http://stackoverflow.com/comment/34540824
has answer: http://stackoverflow.com/a/22663350

http://stackoverflow.com/a/22721967
has comment: http://stackoverflow.com/comment/34665977
answers question: http://stackoverflow.com/q/22721814
score: 0
has body: &lt;h:commandButton type="submit" value="Ir a pagina 2" action="IndexToPagina2" &gt; It seems you are using JSF. You need to import required taglibs. Example: &lt;%@ taglib uri="http://java.sun.com/jsf/html" prefix="h" %&gt; &lt;%@ taglib uri="http://java.sun.com/jsf/core" prefix="f" %&gt; Read more here.
type: Answer
has comment: http://stackoverflow.com/comment/34628966
has comment: http://stackoverflow.com/comment/34672365
has comment: http://stackoverflow.com/comment/34669681

http://stackoverflow.com/q/22669270
upvote count: 0
tagged with: java
has title: Sorting an Arraylist that contains strings with numbers
linked to: http://stackoverflow.com/q/1262239
type: Question
has comment: http://stackoverflow.com/comment/34539463
score: -1
tagged with: sorting
has answer: http://stackoverflow.com/a/22669573
tagged with: arraylist
has answer: http://stackoverflow.com/a/22669308
accepted answer: http://stackoverflow.com/a/22669308
answer count: 3
downvote count: 1
favorite count: 0
has answer: http://stackoverflow.com/a/22669549
has body: I have an ArrayList made up of strings. This ArrayList contains... "60 Minutes" "120 Minutes" "30 Minutes" If I use Collections.sort(ArrayList); it results in "120 Minutes" first. This is because the "1" in "120 is obviously smaller than the "3" in "30" Is there a simple way I can sort this ArrayList so that it shows up as... "30 Minutes" "60 Minutes" "120 Minutes"
possible better answer: http://stackoverflow.com/a/22669549
type: AnsweredQuestion

http://stackoverflow.com/comment/34521816
has text: did you check if you've made any typos in the controller part? Like, the names of the input fields.
comment on: http://stackoverflow.com/q/22648261
score: 0
type: QuestionComment
type: Comment

http://stackoverflow.com/comment/34542830
comment on: http://stackoverflow.com/q/22674966
type: Comment
score: 1
has text: You could take a look at [JFreeCharts](http://www.jfree.org/jfreechart/)
type: QuestionComment

http://stackoverflow.com/a/22734856
accepted answer of: http://stackoverflow.com/q/22734660
type: Answer
answers question: http://stackoverflow.com/q/22734660
downvote count: 0
has comment: http://stackoverflow.com/comment/73086241
has body: According to this page of the Java SE 8 API docs, Optional&lt;T&gt; is a value based class. According to this page of the API docs, value-based classes have to be immutable. Declaring all the methods in Optional&lt;T&gt; as final will prevent the methods from being overridden, but that will not prevent an extending class from adding fields and methods. Extending the class and adding a field together with a method that changes the value of that field would make that subclass mutable and hence would allow the creation of a mutable Optional&lt;T&gt;. The following is an example of such a subclass that could be created if Optional&lt;T&gt; would not be declared final. //Example created by @assylias public class Sub&lt;T&gt; extends Optional&lt;T&gt; { private T t; public void set(T t) { this.t = t; } } Declaring Optional&lt;T&gt; final prevents the creation of subclasses like the one above and hence guarantees Optional&lt;T&gt; to be always immutable.
type: AcceptedAnswer
score: 18
has comment: http://stackoverflow.com/comment/48770571
has comment: http://stackoverflow.com/comment/73128679
upvote count: 18

http://stackoverflow.com/q/22771928
has title: No parameter form of a constructor
has comment: http://stackoverflow.com/comment/34717552
tagged with: java
has body: I am trying to create a no parameter form of a constructor for the constructor I have created below. I have provided my attempts at trying to write this constructor. Is this correct? /** * Default Constructor for Testing */ public void extractTokens(Scanner scanner ) throws IOException, FileNotFoundException { //extracts tokens from the text file File text = new File("E:/LEWIS BC 2/java project/project 1 part 3/items_all.txt"); String toolName = scanner.next(); String itemCode = scanner.next(); String power = scanner.next(); String timesBorrowed = scanner.next(); String onLoan = scanner.next(); String cost = scanner.next(); String weight = scanner.next(); extractTokens(scanner); // System.out.println(parts.get(1)); // "en" } /** * Creates a collection of tools to be stored in a tool list */ public Shop( String toolName, int power, int timesborrowed, boolean rechargeable, int itemCode, int cost, double weight, int toolcount, boolean onLoan ) { toolsList = new ArrayList&lt;Tool&gt;(); toolName = new String(); power = 0; timesborrowed = 0; rechargeable = true; itemCode = 001; cost = 100; weight = 0.0; toolCount = 0; onLoan = true; } /** * Default Constructor for Testing */ public Shop() { // initialise instance variables toolName = "Spanner"; itemCode = 001; timesBorrowed = 0; power = 0; onLoan = true; rechargeable = true; itemCode = 001; cost = 100; weight = 0.0; toolCount = 0; }
type: Question
has answer: http://stackoverflow.com/a/22772064
has comment: http://stackoverflow.com/comment/34717451
has answer: http://stackoverflow.com/a/22772147
has comment: http://stackoverflow.com/comment/34717545
score: 0
has comment: http://stackoverflow.com/comment/34717491
upvote count: 1
downvote count: 1
has answer: http://stackoverflow.com/a/22772052
has comment: http://stackoverflow.com/comment/34717732
favorite count: 0
has comment: http://stackoverflow.com/comment/34717458
has answer: http://stackoverflow.com/a/22772008
type: UnansweredQuestion
answer count: 4
has comment: http://stackoverflow.com/comment/34717436

http://stackoverflow.com/a/22736100
type: Answer
score: 2
has comment: http://stackoverflow.com/comment/34652837
has comment: http://stackoverflow.com/comment/34780906
upvote count: 3
has comment: http://stackoverflow.com/comment/34780544
downvote count: 1
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/34652750
has comment: http://stackoverflow.com/comment/34652792
accepted answer of: http://stackoverflow.com/q/22736078
has comment: http://stackoverflow.com/comment/34652797
answers question: http://stackoverflow.com/q/22736078
has body: Make your interface generic: public interface Syncable&lt;T extends Syncable&lt;T&gt;&gt; { public void sync(T other); } And implement a parameterized instance of that interface: public class TstA implements Syncable&lt;TstA&gt; { @Override public void sync(TstA other) { // TODO Auto-generated method stub } }
has comment: http://stackoverflow.com/comment/34781073

http://stackoverflow.com/comment/34751057
type: QuestionComment
comment on: http://stackoverflow.com/q/22790511
has text: Is it working `this.btnPostal.setEnabled(true);`?
score: 0
type: Comment

http://stackoverflow.com/comment/34778595
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/22806053
type: Comment
has text: No prob ;) I updated to parse the string for you

http://stackoverflow.com/comment/34552274
comment on: http://stackoverflow.com/a/22680507
type: Comment
has text: there is no need in additional counter
type: AnswerComment
score: 0

simple-framework
tags question: http://stackoverflow.com/q/22708894
type: Tag
tag name: simple-framework

http://stackoverflow.com/comment/34615513
has text: thank you for your reply. Do you think it's a good practice to follow this paradigm ? I mean since it's a webservice which i am offering to someone it means i may have to also provide to them the customer class ? since without it they can't create the object.
score: 0
comment on: http://stackoverflow.com/a/22714967
type: Comment
type: AnswerComment

http://stackoverflow.com/comment/34782193
has text: @kukis See the comments in leventov's answer.
comment on: http://stackoverflow.com/a/22807363
type: AnswerComment
score: 0
type: Comment

http://stackoverflow.com/q/22712863
tagged with: criteria-api
tagged with: calendar
has answer: http://stackoverflow.com/a/22713141
type: Question
tagged with: jpa
has comment: http://stackoverflow.com/comment/34745385
has body: I am trying to do the following (cb = CriteriaBuilder): cb.between( cb.currentTimestamp(), kampanjeArtikkelPriser.get(KampanjeArtikkelPris_.overstyrtSalgsprisPeriodeFra), kampanjeArtikkelPriser.get(KampanjeArtikkelPris_.overstyrtSalgsprisPeriodeTil)), But I get the following syntax error: Bound mismatch: The generic method between(Expression&lt;? extends Y&gt;, Y, Y) of type CriteriaBuilder is not applicable for the arguments (Calendar, Path&lt;Calendar&gt;, Path&lt;Calendar&gt;). The inferred type Path&lt;Calendar&gt; is not a valid substitute for the bounded parameter &lt;Y extends Comparable&lt;? super Y&gt;&gt; Bound mismatch: The generic method between(Expression&lt;? extends Y&gt;, Expression&lt;? extends Y&gt;, Expression&lt;? extends Y&gt;) of type CriteriaBuilder is not applicable for the arguments (Expression&lt;Timestamp&gt;, Path&lt;Calendar&gt;, Path&lt;Calendar&gt;). The inferred type Object&amp;Serializable&amp;Cloneable&amp;Comparable&lt;? extends Object&amp;Serializable&amp;Cloneable&amp;Comparable&lt;?&gt;&gt; is not a valid substitute for the bounded parameter &lt;Y extends Comparable&lt;? super Y&gt;&gt; Would it be possible to convert Expression&lt;Timestamp&gt; to Expression&lt;Calendar&gt;? I seem a bit stuck since I have not found a way to do this, and as far as I am able to see there are not many other options for me either. Changing the entities java types is not an options since this is a somewhat big system, and I do not know what kind of impact that would have.
score: 0
answer count: 1
has title: JPA convert Expression<Timestamp> to Expression<Calendar>
has comment: http://stackoverflow.com/comment/34730124
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/34645316
has comment: http://stackoverflow.com/comment/34745845
tagged with: java

http://stackoverflow.com/a/22771749
downvote count: 0
type: Answer
has body: Get rid of the System.exit(0) Wrap your method in a loop if you want it to loop. My example is an infinite loop, but if your application accepts user input you can just as easily have a boolean flag that serves as the loop condition. public static void main(String... args) throws InterruptedException { while(true){ //all of your code } } Also you should surround your sleep in a try-catch instead of declaring a throws on your main method... it is good practice to catch exceptions you can handle, and throw exceptions that you cannot handle to earlier stack frames that can. Typically you don't want your main() method to have a throws clause as it can cause the premature termination of your application. This doesn't really matter for InterruptedException in your specific case, but does for many other exceptions.
score: 1
answers question: http://stackoverflow.com/q/22771005
upvote count: 1

http://stackoverflow.com/q/22658165
possible better answer: http://stackoverflow.com/a/22660348
type: AnsweredQuestion
tagged with: java
tagged with: image-processing
type: Question
has title: How to draw a 16x16 rectangular table at imagej?
tagged with: imagej
has answer: http://stackoverflow.com/a/22660348
has body: What I am trying to do is creating a new image with 16 × 16 rectangular color filled with color like lookup table. I am new to Java and ImageJ and this is my progress right now. It only shows 1 color per pixel. I wanna modify it to show 5x5 pixels per color. How can I achieve that. import ij.*; import ij.process.*; import ij.gui.*; import java.util.*; import java.awt.*; import ij.plugin.filter.*; import ij.process.*; import java.lang.Math.*; import java.awt.image.IndexColorModel; public class colortable_plugin implements PlugInFilter { public int setup(String arg, ImagePlus im) { return DOES_8C; // this plugin works on indexed color images } public void run(ImageProcessor ip) { IndexColorModel icm = (IndexColorModel) ip.getColorModel(); int pixBits = icm.getPixelSize(); int mapSize = icm.getMapSize(); //retrieve the current lookup tables (maps) for R,G,B byte[] Rmap = new byte[mapSize]; icm.getReds(Rmap); byte[] Gmap = new byte[mapSize]; icm.getGreens(Gmap); byte[] Bmap = new byte[mapSize]; icm.getBlues(Bmap); int[] RGB = new int[3]; int[][] allRGB = new int[256][3]; //put color in rectangle for (int idx = 0; idx &lt; mapSize; idx++){ int r = 0xff &amp; Rmap[idx]; //mask to treat as unsigned byte int g = 0xff &amp; Gmap[idx]; int b = 0xff &amp; Bmap[idx]; RGB[0] = r; RGB[1] = g; RGB[2] = b; //save all RGB as array for(int k=0;k&lt;3;k++){ allRGB[idx][k]= RGB[k]; } } tbl(allRGB); } private void tbl(int[][] allRGB){ ImageProcessor newip =new ColorProcessor(256,256); int count = 0 ; for(int i=0;i&lt;16;i++){ for(int j=0;j&lt;16;j++){ newip.putPixel(i,j,allRGB[count]);count++; } } ImagePlus cwin = new ImagePlus("TBL", newip); cwin.show(); } }
score: 0
answer count: 2
has answer: http://stackoverflow.com/a/22661380
accepted answer: http://stackoverflow.com/a/22661380

http://stackoverflow.com/a/26332622
has body: I found the solution: class Foo { static List&lt;Character&gt; abc; static { abc = new LinkedList&lt;Character&gt;(); for (char c = 'A'; c &lt;= 'Z'; ++c) { abc.add( c ); } } } This way gives the same functionality.
type: AcceptedAnswer
answers question: http://stackoverflow.com/q/22779430
score: 0
type: Answer
accepted answer of: http://stackoverflow.com/q/22779430

http://stackoverflow.com/q/22750349
upvote count: 2
tagged with: android
has comment: http://stackoverflow.com/comment/34678237
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/34678313
score: 1
tagged with: java
downvote count: 1
has comment: http://stackoverflow.com/comment/34678259
type: Question
tagged with: crash
has answer: http://stackoverflow.com/a/22750426
tagged with: arrays
has body: I used an array the whole time for my app. But i only set the values after the app was created, with: public String[][] stunde = new String [6][13]; public String[][] lehrer = new String [6][13]; stunde[1][1]= "SZ"; stunde[2][1]= "Bi"; stunde[3][1]= ""; stunde[4][1]= "DG2"; stunde[5][1]= ""; lehrer[1][1]= "Gt"; lehrer[2][1]= "Pön"; lehrer[3][1]= ""; lehrer[4][1]= "Lc"; lehrer[5][1]= ""; but now i wanted to set these values before, so that i could use them in another method. Like this: public String[][] stunde = { {"SZ", "SZ", "Ku", "Ku", "M", "M", "GeL1", "EL2"}, {"Bi", "Bi", "EL2", "EL2", "Pl", "Pl","DG2","If"}, {"", "", "EL2","EL2", "","","M","Bi"}, {"DG2", "DG2", "","", "GeL1","GeL1","Pl","Ku"}, {"", "", "GeL1","GeL1", "If","If","","SZ","","","Sp","Sp"} }; But after i tried it like in the second code my app started to crash after i opened it. Any ideas why?
answer count: 1
has title: Why does my App crash after i set an array?
favorite count: 0
accepted answer: http://stackoverflow.com/a/22750426

http://stackoverflow.com/q/22655601
tagged with: android
tagged with: sms
has title: Error in sending SMS
has answer: http://stackoverflow.com/a/22655934
type: AnsweredQuestion
possible better answer: http://stackoverflow.com/a/22656371
has body: My Android application is sending SMS and it's working fine. However, when the user enters a wrong number, the SMS is sent without error message. Therefore, the user doesn't know that he entered a wrong number. How can I fix that? Activity.java StringTokenizer st=new StringTokenizer(phoneNo,","); while (st.hasMoreElements()) { String tempMobileNumber = (String)st.nextElement(); if(tempMobileNumber.length()&gt;0 &amp;&amp; sms.trim().length()&gt;0) { sendSMS(tempMobileNumber, sms); } else { Toast.makeText(getBaseContext(), "Please enter both phone number and message.", Toast.LENGTH_SHORT).show(); } } private void sendSMS(String phoneNumber, String message) { String SENT = "SMS_SENT"; String DELIVERED = "SMS_DELIVERED"; PendingIntent sentPI = PendingIntent.getBroadcast(this, 0, new Intent(SENT), 0); PendingIntent deliveredPI = PendingIntent.getBroadcast(this, 0, new Intent(DELIVERED), 0); //---when the SMS has been sent--- registerReceiver(new BroadcastReceiver(){ @Override public void onReceive(Context arg0, Intent arg1) { switch (getResultCode()) { case Activity.RESULT_OK: Toast.makeText(getBaseContext(), "SMS sent", Toast.LENGTH_SHORT).show(); break; case SmsManager.RESULT_ERROR_GENERIC_FAILURE: Toast.makeText(getBaseContext(), "Generic failure", Toast.LENGTH_SHORT).show(); break; case SmsManager.RESULT_ERROR_NO_SERVICE: Toast.makeText(getBaseContext(), "No service", Toast.LENGTH_SHORT).show(); break; case SmsManager.RESULT_ERROR_NULL_PDU: Toast.makeText(getBaseContext(), "Null PDU", Toast.LENGTH_SHORT).show(); break; case SmsManager.RESULT_ERROR_RADIO_OFF: Toast.makeText(getBaseContext(), "Radio off", Toast.LENGTH_SHORT).show(); break; } } },new IntentFilter(SENT)); //---when the SMS has been delivered--- registerReceiver(new BroadcastReceiver(){ @Override public void onReceive(Context arg0, Intent arg1) { switch (getResultCode()) { case Activity.RESULT_OK: Toast.makeText(getBaseContext(), "SMS delivered", Toast.LENGTH_SHORT).show(); break; case Activity.RESULT_CA…
tagged with: java
type: Question
answer count: 2
score: 0
has answer: http://stackoverflow.com/a/22656371
accepted answer: http://stackoverflow.com/a/22655934

http://stackoverflow.com/q/22697795
accepted answer: http://stackoverflow.com/a/22699797
has comment: http://stackoverflow.com/comment/34584099
favorite count: 0
score: 6
upvote count: 7
downvote count: 1
has title: Amazon S3 Java SDK multiple files upload
type: AnsweredQuestion
tagged with: amazon-s3
has body: What I need is to download many files from Internet and upload them to S3 as fast as it possible. For now I open every file as a stream and upload them one after another. The average speed of this approach is one picture per second. What's the fastest way to achieve this?
tagged with: java
type: Question
answer count: 1
tagged with: amazon-web-services
has answer: http://stackoverflow.com/a/22699797

http://stackoverflow.com/q/22706376
has body: I'm trying to pass some parameters from an interceptor to ejb context to be used later for logging. In the interceptor I'm doing this: @AroundInvoke public Object retrieveAdminData(InvocationContext context) throws Exception { User simulatingAdmin = ...; context.getContextData().put(Globals.ADMIN_USER_KEY, simulatingAdmin)); return context.proceed(); } Then later in lifecycle I'm looking up ejb context and getting this value: ((SessionContext) new InitialContext().lookup("java:comp/EJBContext")).getContextData().get(Globals.ADMIN_USER_KEY); Usually it works fine, but in some cases when I make a call from one bean to another, I get this exception when trying to get context data: java.lang.IllegalStateException: Illegal call to EJBContext method. The bean is in running business method state. It cannot perform 'getting the Message Context for Stateless EJB' action(s). Refer to the EJB specification for more details. at weblogic.ejb.container.internal.BaseEJBContext.checkAllowedMethod(BaseEJBContext.java:93) at weblogic.ejb.container.internal.BaseEJBContext.checkAllowedToGetMessageContext(BaseEJBContext.java:291) at weblogic.ejb.container.internal.SessionEJBContextImpl.checkAllowedToGetMessageContext(SessionEJBContextImpl.java:210) at weblogic.ejb.container.internal.SessionEJBContextImpl.getMessageContextJAXWS(SessionEJBContextImpl.java:65) at weblogic.ejb.container.internal.SessionEJBContextImpl.getContextData(SessionEJBContextImpl.java:302) All calls between beans are local calls. Could someone please point me into why it works for some beans, but not for others? EDIT I've noticed that I stop being able to get ejb context if the call is from beans that are in different jars. Is this not allowed in EJB? Can I use ThreadLocal as a workaround?
has title: Can not get EJB Context data: The bean is in running business method state
has comment: http://stackoverflow.com/comment/34880817
answer count: 0
type: UnansweredQuestion
tagged with: ejb-3.1
tagged with: jakarta-ee
tagged with: weblogic
tagged with: weblogic12c
tagged with: java
type: Question
has comment: http://stackoverflow.com/comment/34880919
has comment: http://stackoverflow.com/comment/34882735
score: 0
linked to: http://stackoverflow.com/q/8608349

http://stackoverflow.com/comment/34656149
comment on: http://stackoverflow.com/a/22737734
score: 1
has text: You might want to voluntarily delete this question unless you think it will be useful to other people in future.
type: AnswerComment
type: Comment

http://stackoverflow.com/comment/34580380
has text: @SotiriosDelimanolis That's not helpful. This is obviously a new Java programmer.
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/22696134
score: 0

http://stackoverflow.com/q/22670027
type: Question
has answer: http://stackoverflow.com/a/22670158
has title: Java Database connectivity on GNU/Linux
tagged with: unixodbc
downvote count: 0
tagged with: linux
answer count: 3
has body: I'm having a Java class and I'm really new to Database Connectivity.. My professor and everyone else on this class use Windows and an Access Database, and I'm the only one using GNU/Linux with a MYSQL Database. Now as you know Windows programmers use ODBC, but as I searched, I got that it's only for windows. I found a Unix/Linux ODBC from easysoft but it doesn't support MYSQL Is there any Open-Source ODBC you know of that supports MYSQL? Moreover how should I use this Driver in java? Couldn't find neither a documentation nor a tutorial for GNU/Linux..
accepted answer: http://stackoverflow.com/a/22670158
linked to: http://stackoverflow.com/q/1457716
favorite count: 0
has answer: http://stackoverflow.com/a/22670114
has answer: http://stackoverflow.com/a/22670149
upvote count: 1
possible better answer: http://stackoverflow.com/a/22670114
type: AnsweredQuestion
score: 1
tagged with: java
tagged with: mysql
tagged with: odbc

http://stackoverflow.com/comment/34731408
type: AnswerComment
score: 0
type: Comment
comment on: http://stackoverflow.com/a/22779393
has text: Thank you for the answer. It looks to me that your answer has some discrepancy. Why if two players that both need their inputs handled have non-identical processing flows. Why should WASD return true, while the Arrows return false? Furthermore, do you mean by event, the keyDown() in general, or the "W" keyDown() is one event, and the "A" keyDown() is another event?

http://stackoverflow.com/comment/34663710
type: AnswerComment
comment on: http://stackoverflow.com/a/22742349
score: 0
has text: @JBNizet it's the same as mine except you have a loop. My code is more idiomatic if you see what I mean. Also parallelisable - somewhat pointless in this case but worth bearing in mind that looping externally breaks parallel streams.
type: Comment

http://stackoverflow.com/a/27498364
has body: One Suggestion, If you are going to have a large amount image data, better to load directly into an Amazon S3 bucket. S3, is a “highly durable and available store” and can be used to reliably store application content such as media files, static assets and user uploads. It allows you to offload your entire storage infrastructure and offers better scalability, reliability, and speed than just storing files on the filesystem.
answers question: http://stackoverflow.com/q/22728412
score: 0
type: Answer

http://stackoverflow.com/a/22739061
score: 1
upvote count: 1
has body: If location service is disabled . getLastKnownLocation() will return null. Add a null check Location myLocation = locationmanager.getLastKnownLocation(provider); If(myLocation == null ){ // show the alert dialog } else { // do your stuff with latitude and longitude }
downvote count: 0
answers question: http://stackoverflow.com/q/22734508
type: Answer

http://stackoverflow.com/comment/34666502
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/22744083
has text: `changeSP("stats");` You can't have a method call like that in your class body.
score: 3

http://stackoverflow.com/comment/34499947
type: AnswerComment
has text: There's nothing functionally wrong with that approach, but you're doing more work than you need to. I would strongly advise using `String.equals` or `String.equalsIgnoreCase`, docs [here](http://docs.oracle.com/javase/1.5.0/docs/api/java/lang/String.html#equals(java.lang.Object)); it saves you a lot of effort that doesn't really gain you anything, and it makes your code more readable and maintainable.
comment on: http://stackoverflow.com/a/22650797
score: 0
type: Comment

http://stackoverflow.com/comment/34791508
comment on: http://stackoverflow.com/a/22757232
type: Comment
score: 1
type: AnswerComment
has text: @JackMoore The list of selected items or parameters array is sent with the request and you can get it by implementing `ParameterAware` interface see [How could I get a parameter in JSP？](http://stackoverflow.com/a/17876304/573032).

http://stackoverflow.com/q/22772781
has comment: http://stackoverflow.com/comment/34719088
type: Question
type: AnsweredQuestion
tagged with: java
has comment: http://stackoverflow.com/comment/34718954
has comment: http://stackoverflow.com/comment/34719011
upvote count: 1
has title: How to create a splash screen in Java?
answer count: 1
has body: I'm new to Java. I need to add a splash screen and It should be checking the database existence when it's running. How could I do this with Java? Thanks in Advance!
tagged with: awt
accepted answer: http://stackoverflow.com/a/22772881
tagged with: splash-screen
has answer: http://stackoverflow.com/a/22772881
downvote count: 4
favorite count: 0
has comment: http://stackoverflow.com/comment/34718960
score: -3

http://stackoverflow.com/comment/69882285
type: Comment
comment on: http://stackoverflow.com/q/22702220
has text: If you don't want to use applet you should create a http service which takes in the required input and produces the required output and the end point of that service will be called by your javascript code.
score: 0
type: QuestionComment

http://stackoverflow.com/comment/34758476
type: AnswerComment
score: 0
type: Comment
comment on: http://stackoverflow.com/a/22794461
has text: No that is literally the whole class copy n pasted and I've been checking for misselling and all that stuff for a good while now and cant find anything. I have other classes in my project but the only ones linked to StartScreen are the launcher and GameImage and KeyboardListener. I'm just as confused as you :(

http://stackoverflow.com/q/22713166
has title: Removing log calls with proguard leaves behind StringBuilders
favorite count: 0
tagged with: proguard
has body: I have a class with static methods for logging, eg: I'm attempting to remove all these using ProGuard. I don't want to just disable them (That done using logic anyway), I want them to disappear when decompiled. It is successfully removing the calls to my logging methods, but leaves behind the strings that were concatenated. It completely removes the strings that were fixed. This is my ProGuard setting: -assumenosideeffects class com.mypackage.Log { *; } This is my source: void doSomething(String name) { Log.verbose("Hello!"); Log.verbose("My name is " + name); ... } This is what it decompiles to: void a(String a) { new StringBuilder("My name is ").append(a); ... } This is what I want it to decompile to: void a(String a) { ... } For this example, assume that the name parameter is used later on in the method (ie, it shouldn't be optimized out completely). Should I also be using assumenosideeffects for StringBuilder? I do use StringBuilders elsewhere, that I do want to keep. Would that remove them there, too?
has comment: http://stackoverflow.com/comment/87070365
type: UnansweredQuestion
type: Question
has comment: http://stackoverflow.com/comment/39017397
tagged with: java
linked to: http://stackoverflow.com/q/6009078
score: 5
has comment: http://stackoverflow.com/comment/34613321
answer count: 1
downvote count: 0
has answer: http://stackoverflow.com/a/22773727
upvote count: 5

intellij-idea
tags question: http://stackoverflow.com/q/22732981
tags question: http://stackoverflow.com/q/22768037
tags question: http://stackoverflow.com/q/22665328
tags question: http://stackoverflow.com/q/22734360
tags question: http://stackoverflow.com/q/22800666
tags question: http://stackoverflow.com/q/22729774
tags question: http://stackoverflow.com/q/22767873
tags question: http://stackoverflow.com/q/22790781
tags question: http://stackoverflow.com/q/22790693
type: Tag
tags question: http://stackoverflow.com/q/22671848
tags question: http://stackoverflow.com/q/22648384
tag name: intellij-idea
tags question: http://stackoverflow.com/q/22744204
tags question: http://stackoverflow.com/q/22802605
tags question: http://stackoverflow.com/q/22674032
tags question: http://stackoverflow.com/q/22664088
tags question: http://stackoverflow.com/q/22716136
tags question: http://stackoverflow.com/q/22742157
tags question: http://stackoverflow.com/q/22670534
tags question: http://stackoverflow.com/q/22701148
tags question: http://stackoverflow.com/q/22691166
tags question: http://stackoverflow.com/q/22656446
tags question: http://stackoverflow.com/q/22657093
tags question: http://stackoverflow.com/q/22694920
tags question: http://stackoverflow.com/q/22703412
tags question: http://stackoverflow.com/q/22769916
tags question: http://stackoverflow.com/q/22782202
tags question: http://stackoverflow.com/q/22747658
tags question: http://stackoverflow.com/q/22722379
tags question: http://stackoverflow.com/q/22662095
tags question: http://stackoverflow.com/q/22706117
tags question: http://stackoverflow.com/q/22657921
tags question: http://stackoverflow.com/q/22657184
tags question: http://stackoverflow.com/q/22741299
tags question: http://stackoverflow.com/q/22732722

fileoutputstream
tags question: http://stackoverflow.com/q/22730398
tags question: http://stackoverflow.com/q/22748484
type: Tag
tag name: fileoutputstream
tags question: http://stackoverflow.com/q/22723318
tags question: http://stackoverflow.com/q/22769304

http://stackoverflow.com/q/22732307
tagged with: java
possible better answer: http://stackoverflow.com/a/22732380
score: 0
has answer: http://stackoverflow.com/a/22732380
accepted answer: http://stackoverflow.com/a/22732499
answer count: 2
has title: Back scanner reading after user error - java
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/22732499
type: Question
has comment: http://stackoverflow.com/comment/34645940
has body: I have read user input that must be only of type int, the problem comes when the user enters letter instead of a int. I know how to handle the exception, but I would like to return the scanner read where the user has made a mistake. How can I do? I already tried with an infinite loop, but it does not work. try{ System.out.print("enter number: "); value = scanner.nextInt(); }catch(InputMismatchException e){ System.err.println("enter a number!"); }

http://stackoverflow.com/q/22739851
tagged with: android
tagged with: datetime
has title: Format datetime with Time, SimpleDatetimeFormat, Calendar, GregorianCalendar
has body: I would like to learn ways to format a given datetime I know only this now=new Time(Time.getCurrentTimezone()); now.setToNow(); String t=now.format("%H:%M"); I would like to know how to output e.g 03:30 PM, 2014-3-20 15:30, Sun,3/15/2014 15:30 Sunday, March 15 2014 03:30 AM etc I'd like to use Time class of android.text.format.Time to format my hours into i.e 3:30 AM. document of this class on developer site doesn't provide any details on the format string method Document of this format string is found here https://php.net/strftime
has answer: http://stackoverflow.com/a/22739889
tagged with: java
type: Question
answer count: 2
score: 0
has answer: http://stackoverflow.com/a/22741158
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/34659134

http://stackoverflow.com/q/22772020
type: UnansweredQuestion
tagged with: java
has title: Mule jython running with main
type: Question
tagged with: jython
tagged with: mule
score: 0
answer count: 1
has answer: http://stackoverflow.com/a/22780470
has body: Problem: How to run a jython having main function in Mule application? Issue: I have a simple Jython code invoked by mule flow. Flow: &lt;mule xmlns:... &lt;flow name="wfileFlow1" doc:name="wfileFlow1"&gt; &lt;http:inbound-endpoint exchange-pattern="request-response" host="localhost" port="8081" doc:name="HTTP"/&gt; &lt;logger message="===\n START ===" level="INFO" doc:name="Logger"/&gt; &lt;scripting:component doc:name="Python"&gt; &lt;scripting:script engine="jython" file="src/main/java/com/test/Test1.py"/&gt; &lt;/scripting:component&gt; &lt;logger message="===\n END ===" level="INFO" doc:name="Logger"/&gt; &lt;/flow&gt; &lt;/mule&gt; Test1.py def add(a,b): return a+b def addFixedValue(a): y = 5 return y +a print add(1,2) print addFixedValue(1) output: ===\n START === 3 6 ===\n END === if I run with main, then no output i.e it doesn't print anything. Test1.py def add(a,b): return a+b def addFixedValue(a): y = 5 return y +a if __name__ == '__main__': print add(3,4) print addFixedValue(1) It prints no jython values: ===\n START === ===\n END === Note here no jython values are printed. Issue is, since second one run as main program in Java, but how do I run a main program from mule application if my above flow is wrong?
linked to: http://stackoverflow.com/q/419163
tagged with: http://stackoverflow.com/tag/xml

http://stackoverflow.com/a/22686371
has comment: http://stackoverflow.com/comment/34562469
has comment: http://stackoverflow.com/comment/34562341
score: 0
type: Answer
has body: Along with ajax json can be used as a request.setAttribute and also you can retrieve the json between servlet and JSP. Check this link out for your understanding.. http://spritiuallyjava.blogspot.in/2012/07/json-with-jsp-and-servlets.html
has comment: http://stackoverflow.com/comment/34562120
has comment: http://stackoverflow.com/comment/34563574
has comment: http://stackoverflow.com/comment/34562373
has comment: http://stackoverflow.com/comment/34562181
answers question: http://stackoverflow.com/q/22686210

http://stackoverflow.com/q/22789667
accepted answer: http://stackoverflow.com/a/22889015
has comment: http://stackoverflow.com/comment/34749441
tagged with: oracle-database
has comment: http://stackoverflow.com/comment/34749042
has comment: http://stackoverflow.com/comment/34769284
has comment: http://stackoverflow.com/comment/34762217
type: AnsweredQuestion
tagged with: stored-procedures
has comment: http://stackoverflow.com/comment/34750045
has title: Current Sql Date in Spring StoredProcedure Causes ORA-01847: day of month must be between 1 and last day of month
tagged with: java
has body: I'm compiling a current system date in my Java/Spring as following: Calendar calobj = Calendar.getInstance(); java.sql.Date currentSysDate = new java.sql.Date(calobj.getTime().getTime()); When this date is inspected, it has the following format: 2014-04-01 I'm passing this value to my extended StoredProcedure class's execute() method in a Map (updating via an Oracle PL/SQL): public Object execute(java.sql.Date currentSysDate) { Map&lt;String, Object&gt; params = new HashMap&lt;String, Object&gt;(); params.put("current_date", currentSysDate); return execute(params); } The PL/SQL: {call update_curr_date ( current_date =&gt; :current_date )} PROCEDURE update_curr_date(current_date IN DATE) AS BEGIN INSERT INTO plogger (plogger_id, use_case_name, wrapper_name, logged_updates) VALUES (plogger_id_seq.nextval, 'Date use case', 'UPDATE_CURR_DATE', 'current_date = "' || current_date || '"'); END update_curr_date; Which results in the following exception being thrown during my unit testing: ORA-01847: day of month must be between 1 and last day of month ORA-06512: at line 4 ; nested exception is java.sql.SQLDataException: ORA-01847: day of month must be between 1 and last day of month ORA-06512: at line 4
possible better answer: http://stackoverflow.com/a/22790571
has answer: http://stackoverflow.com/a/22790571
has comment: http://stackoverflow.com/comment/34749194
type: Question
has comment: http://stackoverflow.com/comment/34768373
has answer: http://stackoverflow.com/a/22889015
has comment: http://stackoverflow.com/comment/34749787
score: 0
answer count: 2
tagged with: sql

http://stackoverflow.com/comment/34729221
score: 0
type: AnswerComment
has text: As soon as you create the FileWriter it will replace the existing file. So you should only do this when you have read all the content of the file. Maybe you should start with writing to a different file.
type: Comment
comment on: http://stackoverflow.com/a/22765030

http://stackoverflow.com/comment/34506476
comment on: http://stackoverflow.com/q/22654521
type: Comment
type: QuestionComment
score: 0
has text: @StackOverflowUser so did our suggestions help u?

http://stackoverflow.com/comment/34640078
type: Comment
comment on: http://stackoverflow.com/a/22726738
has text: Thanks for the reply! Normally I would try to avoid displaying ads in the preferences, but the app is an **android live wallpaper**, so there is no "main body" or User Interface to work with...and displaying an ad in the wallpaper itself would be even worse for the user :-(. If your comment was more meant like "put the ads outside of the preferences list in the preferences screen", could you please advise how to do so? I would gladly adopt this method, but I don't know how this would work in the context of the Android PreferenceFragment as it seems to bring its own layout when displayed.
score: 1
type: AnswerComment

http://stackoverflow.com/comment/44193881
has text: Added a answer based on the idea that IntStream::flatMapToObj(IntFunction<Stream<OBJ>>) is equivalent to IntStream::mapToObj(IntFunction<Stream<OBJ>>) then Stream::flatMap(Function<Stream<OBJ>, Stream<OBJ>>).
score: 0
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/22653004

http://stackoverflow.com/q/22758715
has comment: http://stackoverflow.com/comment/34693819
type: Question
has comment: http://stackoverflow.com/comment/34693687
answer count: 2
has answer: http://stackoverflow.com/a/22759078
has comment: http://stackoverflow.com/comment/34693134
downvote count: 0
has comment: http://stackoverflow.com/comment/34693259
has title: How to Prevent instantiation of concrete classes?
favorite count: 0
accepted answer: http://stackoverflow.com/a/22759078
has comment: http://stackoverflow.com/comment/34693208
possible better answer: http://stackoverflow.com/a/22761599
has body: Lets say I have a Record Interface and I can have N number of its concrete implementation classes eg. PropertyRecords,LoanRecords etc.How do I ensure there is no object of these N classes is created by client using new keyword? Its quite easy if I have a single subclass;I can Make all the constructors package private;so that I can write a Factory class in the same package which will have a method which will be responsible for creating instances.But how to create a virtual Factory able to create several implementations of a single interface or abstract class. Hope i am able to put myself correctly.Please ask if any clarification needed. Thank you.
has answer: http://stackoverflow.com/a/22761599
upvote count: 1
tagged with: design-patterns
has comment: http://stackoverflow.com/comment/34693118
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/34694166
score: 1
tagged with: java
has comment: http://stackoverflow.com/comment/34693625

http://stackoverflow.com/q/22790048
upvote count: 1
tagged with: swing
downvote count: 1
has answer: http://stackoverflow.com/a/22790137
type: Question
accepted answer: http://stackoverflow.com/a/22790137
has body: I have the fallowing code: // set up the GUI for display the PgmImage object JFrame f = new JFrame("PGM Image:"); f.addWindowListener(new WindowAdapter() { public void windowClosing(WindowEvent e) { System.exit(0); } }); f.add(this.drawImage); f.pack(); f.setVisible(true); That produces this image: I wonder if it's possible to draw a line above the image on the same JFrame. I have the discover a path with A* algorithm and trace it in this image. Cumps
has title: Trace a line above an image on JFrame Java
answer count: 1
favorite count: 0
tagged with: jframe
linked to: http://stackoverflow.com/q/14550925
type: AnsweredQuestion
score: 0
tagged with: java

http://stackoverflow.com/a/22742517
has body: RelativeLayout.LayoutParams params = new RelativeLayout.LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT); TextView tv = new TextView(r.getContext()); v1.setText("Test n_"+i); v1.setId(i+1); params.addRule(RelativeLayout.BELOW, tv.getId()-1); r.addView(tv); also this is an answer for your question .... Programatically add view one below other in relative layout
score: 0
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/22741752
type: Answer
answers question: http://stackoverflow.com/q/22741752

http://stackoverflow.com/comment/34702735
type: Comment
score: 0
comment on: http://stackoverflow.com/a/22763775
has text: onCreateDialog method is in another class that i call in onCreate method.. if connection is disabled, the dialog send the user to wifi settings and turn ON the wifi connection. How i re-check the connection when user return to application ?
type: AnswerComment

http://stackoverflow.com/comment/34686668
score: 0
comment on: http://stackoverflow.com/a/22707351
type: Comment
has text: @Silmarilos ,you want to create an event that's just start in X days, and will last one hour?
type: AnswerComment

http://stackoverflow.com/comment/34637344
has text: Any Ideas on how to stop sound. Because I've already tried `clip.stop();` but it doesn't seem to work. Any ideas? @JasonC
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/22726792

http://stackoverflow.com/q/22730437
has comment: http://stackoverflow.com/comment/35073262
type: Question
tagged with: aptana3
has comment: http://stackoverflow.com/comment/35190797
has comment: http://stackoverflow.com/comment/35190261
tagged with: osx-mavericks
tagged with: java
tagged with: eclipse
upvote count: 2
has comment: http://stackoverflow.com/comment/35190645
downvote count: 0
answer count: 1
has title: Several applications on Mavericks OS X requesting install Java 6 SE runtime, but already have Java 7
tagged with: jvm
favorite count: 0
type: UnansweredQuestion
score: 2
has comment: http://stackoverflow.com/comment/35190278
has body: I've already seen this thread about it, but after I followed the instructions I got this error when trying to open eclipse The JVM shared library "/Library/Java/JavaVirtualMachines/jdk1.7.0_40.jdk" does not contain the JNI_CreateJavaVM symbol And this one for AptanaStudio3 Failed to create the Java Virtual Machine. Any ideas how to fix this? I really don't want to have to install Java 6.
has answer: http://stackoverflow.com/a/22737533

http://stackoverflow.com/comment/34539737
comment on: http://stackoverflow.com/q/22673211
score: 0
has text: @2rs2ts It uses `equals()`. See the docs for [`contains()`](http://docs.oracle.com/javase/7/docs/api/java/util/List.html#contains%28java.lang.Object%29).
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/34620684
has text: Thanks! Working now, damn these noobie mistakes.
comment on: http://stackoverflow.com/q/22717744
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/a/22781396
answers question: http://stackoverflow.com/q/22779522
score: 0
type: AcceptedAnswer
type: Answer
has body: In any situation where you want to disable SafeMode, editing the SafeMode.xul file is the most popular way to permanently disable Safe Mode. NOTE! The method to disable safe mode is a fairly complicated technique for beginners. In my case I needed to parallelly run tests on several Firefox windows. (Not using Selenium though). This worked for me.
accepted answer of: http://stackoverflow.com/q/22779522

http://stackoverflow.com/comment/34715721
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/22771000
has text: Perhaps your code uses "default platform encoding" to read strings, which may be different between the two servers. Where are those characters coming from? Is it the body of an HTTP request?
score: 0

http://stackoverflow.com/comment/34640976
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/22729510
has text: Why do you use option pane so freaquently? Create dialogs yourself.

http://stackoverflow.com/comment/34688094
comment on: http://stackoverflow.com/a/22755769
has text: @KepaniHaole Correct, slight slip on my part!
type: AnswerComment
score: 0
type: Comment

http://stackoverflow.com/comment/34556373
type: Comment
comment on: http://stackoverflow.com/a/22682897
type: AnswerComment
score: 0
has text: then please share some good links which will focus on only this area.....as i can't go in details right now

http://stackoverflow.com/a/22769601
accepted answer of: http://stackoverflow.com/q/22769480
answers question: http://stackoverflow.com/q/22769480
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/34753657
has comment: http://stackoverflow.com/comment/34713143
type: Answer
score: 1
has body: Take a look at the method public static String bubbleSortDesc(String[] names) The return of that method is supposed to be a String (only one), but you are returning the parameter "names", which is an array of strings. The "[]" after the String identifies it as an array. I am not going to do your homework for you, so a hint: check if the return type of the method bubbleSortDesc should be one String or an array of Strings. Good luck.
upvote count: 1

http://stackoverflow.com/comment/34668153
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/22733264
has text: Thank you so much . It was so interesting.But just one more question.How can I get the text of textArea as a Node ? ".text" is a CSS ID ? So how can you assign css ID to text ?
type: Comment

http://stackoverflow.com/comment/114773614
has text: When building a REST API server using Java, wouldn't it be logical to have separate exceptions for different types of errors? So that we can catch the type of error and send its message along with an appropriate status code(I don't want to mix http status code with my domain exceptions)?
score: 0
type: Comment
comment on: http://stackoverflow.com/a/22698673
type: AnswerComment

http://stackoverflow.com/comment/34506766
has text: i am off for lunch..if it helps,plz tick my answer..or else if u have more problem v can solve wen i return..
comment on: http://stackoverflow.com/a/22654742
score: 0
type: AnswerComment
type: Comment

http://stackoverflow.com/q/22713856
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/22713966
has answer: http://stackoverflow.com/a/22714033
tagged with: object
downvote count: 0
tagged with: java
has body: I have a lot of classes and I want the user to type a name and he will get instance of the same name of a specific object (class). I simplify it by this code: public class Animal {...} public class lion extends Animal{...} public class zebra extends Animal{...} // and so on for a lot of animals String name = input from user Animal something = new Animal(instance of the input name) At the last line I actually wanted to convert the string name to be instance of a class name. Is there any way to do it? there is going to be a lot of animals so i don't want to write a lot of switch cases as: "if input equals to lion" or zebra or snake or...
has answer: http://stackoverflow.com/a/22713978
has comment: http://stackoverflow.com/comment/34612570
score: 9
type: Question
has title: convert string input to instance of object name(=input)
has answer: http://stackoverflow.com/a/22713959
answer count: 6
has answer: http://stackoverflow.com/a/22714077
has answer: http://stackoverflow.com/a/22714345
tagged with: string
has comment: http://stackoverflow.com/comment/34612541
favorite count: 0
tagged with: instanceof
upvote count: 9

http://stackoverflow.com/a/22759875
answers question: http://stackoverflow.com/q/22759820
type: Answer
upvote count: 2
has comment: http://stackoverflow.com/comment/34695406
score: 2
has comment: http://stackoverflow.com/comment/34695510
has body: What happens when the method is not declared with void return type? In Java, You should declare what a method returns in it's signature. It can be void or some other object type or primitive type. It doesn't matter whether it's a abstract method or normal method. Must all abstract methods in java be declared with void return type? No, They can declared to return any object type, primitive type and, also declared to return void to indicate it return nothing. I suppose that a method declaration as below is also wrong due to the existence of the 'scope' symbols. public abstract void myMethod() {} Yes, it's wrong. An abstract method can't have method body. It's a compilation error.
downvote count: 0

http://stackoverflow.com/a/22959132
has body: //*[@id='isc_EAtable']/tbody[2]/tr[2]/td[4]/nobr CSS or XPATH Use Relative CSS/XPATH. Absolute XPATH will not Work always. Optimized Way -- Use Relative CSS/XPATH.
score: 0
answers question: http://stackoverflow.com/q/22691196
type: Answer

plugins
tags question: http://stackoverflow.com/q/22654602
tags question: http://stackoverflow.com/q/22721666
tags question: http://stackoverflow.com/q/22807059
tags question: http://stackoverflow.com/q/22667481
tags question: http://stackoverflow.com/q/22699883
tag name: plugins
tags question: http://stackoverflow.com/q/22752192
type: Tag

http://stackoverflow.com/comment/34562682
comment on: http://stackoverflow.com/a/22686691
type: Comment
score: 0
type: AnswerComment
has text: Thanks JonK... I was trying to extract the relevant code but by pressing Enter prematurely, the question got posted. Thanks for your reply

http://stackoverflow.com/q/22679717
linked to: http://stackoverflow.com/q/14548808
has comment: http://stackoverflow.com/comment/34552108
downvote count: 0
answer count: 1
has comment: http://stackoverflow.com/comment/34551347
has comment: http://stackoverflow.com/comment/34551995
favorite count: 0
has comment: http://stackoverflow.com/comment/34551577
has answer: http://stackoverflow.com/a/22680573
has title: Resizing image to fit in JLabel
tagged with: imageicon
has body: I am trying to load an image from directory and place it as an icon in JLabel. But when the image size is big it doesn't fit completely in the label. I tried resizing the image to fit in the label but its not working. May I know where I am going wrong? JFileChooser choose=new JFileChooser(); choose.showOpenDialog(null); File f=choose.getSelectedFile(); String filename=f.getAbsolutePath(); path.setText(filename); ImageIcon icon=new ImageIcon(filename); Image img=icon.getImage(); BufferedImage bi = new BufferedImage(img.getWidth(null), img.getHeight(null), BufferedImage.TYPE_INT_ARGB); Graphics g = bi.createGraphics(); g.drawImage(img,500, 500, null); ImageIcon newIcon = new ImageIcon(bi); image_label.setIcon(newIcon);
tagged with: jlabel
linked to: http://stackoverflow.com/q/11959758
has comment: http://stackoverflow.com/comment/34551429
upvote count: 2
has comment: http://stackoverflow.com/comment/34551841
has comment: http://stackoverflow.com/comment/34551385
tagged with: swing
accepted answer: http://stackoverflow.com/a/22680573
score: 2
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/34551724
linked to: http://stackoverflow.com/q/14115950
tagged with: java
has comment: http://stackoverflow.com/comment/34552090
has comment: http://stackoverflow.com/comment/34551177
tagged with: image
has comment: http://stackoverflow.com/comment/34551124
type: Question

http://stackoverflow.com/q/22659193
tagged with: java
tagged with: concurrency
accepted answer: http://stackoverflow.com/a/22659368
answer count: 3
downvote count: 0
has comment: http://stackoverflow.com/comment/34514321
favorite count: 0
has answer: http://stackoverflow.com/a/22659368
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/22659405
score: 1
has answer: http://stackoverflow.com/a/22660680
tagged with: multithreading
upvote count: 1
type: Question
has body: OK. I am facing some difficulties in understanding the basics of concurrency. This question is about Deadlock. Please tell me why are both of these threads end in a deadlock. I took this example from this tutorial. And it says, "When Deadlock runs, it's extremely likely that both threads will block when they attempt to invoke bowBack. Neither block will ever end, because each thread is waiting for the other to exit bow." What I understand from this is that: First, they would wait because when a thread invokes a synchronized method, it automatically acquires the intrinsic lock of the object to which the synchronized method belongs, and continues to own it until the method returns; and meanwhile no other thread can own it. 1. Now my first question is that the first thread calls zarah.bow(), so the intrinsic lock is associated with zarah. The second thread would call khan.bow() and so that would be a different intrinsic lock (because it is associated with a different object named khan), isn't it? And aren't zarah.bow() and khan.bow() different? Because they belong to two different instances? 2. The second question is from the notion of "both" the threads waiting forever. Both the threads will be blocked forever waiting for each other to exit bow. I don't get this. package Threads; public class DeadlockModified { static class Friend { private final String name; Friend(String name){ this.name=name; } private String getName(){ return this.name; } private synchronized void bow(Friend bower){ System.out.format("%s: %s"+" bowed to me.%n",bower.getName(),name); bower.bowBack(this); } private synchronized void bowBack(Friend bower){ System.out.format("%s: %s" + " was nice enough to bow back to me.%n",bower.getName() ,name ); } } public static void main(String [] args){ final Friend zarah= new Friend("Zarah"); final Friend khan= new Friend("Khan"); new Thread(new Runnable(){ public void run(){zarah.bow(khan);} }).start(); new Thread(new Runnable() { public void run(){khan.bow(z…
possible better answer: http://stackoverflow.com/a/22659405
has title: Concurrency - Why this deadlock

http://stackoverflow.com/comment/34693689
comment on: http://stackoverflow.com/a/22751938
has text: Good answer, @JonK. The only thing I would modify is that the constructor doesn't `return newList` and the `addAll` methods are void, so there's nowhere to return them.
score: 0
type: AnswerComment
type: Comment

http://stackoverflow.com/comment/34609908
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/22712263
type: Comment
has text: @jaypal meh, if the treatment takes hours, you can spare a few minutes writing some custom code ;)

http://stackoverflow.com/q/22694113
answer count: 0
linked to: http://stackoverflow.com/q/62289
tagged with: java
has body: This syntax system("reg add HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\USBSTOR /v Start /t REG_DWORD /d 4 /f"); i use in c++ but how to use disable usb in java i try but it gives a error on it that exception error.
has title: how to disable USB port using java
type: Question
has comment: http://stackoverflow.com/comment/34593059
score: 0
has comment: http://stackoverflow.com/comment/45544859
has comment: http://stackoverflow.com/comment/34576762
linked to: http://stackoverflow.com/q/365223
type: UnansweredQuestion
tagged with: windows

http://stackoverflow.com/a/29916757
answers question: http://stackoverflow.com/q/22769433
score: 0
has body: It is always recommended that there is one session factory per database, per JVM. Having multiple instances of session factory can lead to performance problems as well as abnormal behavior of transactions.
type: Answer

http://stackoverflow.com/q/22751077
has comment: http://stackoverflow.com/comment/34679589
type: Question
has answer: http://stackoverflow.com/a/22751116
score: 0
answer count: 2
has title: how can i run my java program without eclipse?
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/22751231
has body: I have a console based java minesweeper. How can i launch this on my desktop without opening it in my eclipse program and hit run? The program consists of a couple classes and there is an user input in the console. are there any standard methhods? Tried this: export > executable jar file. that didn't work.. thank you!
tagged with: java

http://stackoverflow.com/comment/34723990
has text: Just a _handler method_ is fine. Keep in mind, that it's always easier to understand what you mean if you give an example.
score: 1
comment on: http://stackoverflow.com/q/22775584
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/34643579
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/22724181
type: Comment
has text: Stackoverflow questions and discussion are at [here](http://stackoverflow.com/questions/tagged/xstream)

http://stackoverflow.com/q/22759134
tagged with: java
tagged with: javafx
tagged with: swing
accepted answer: http://stackoverflow.com/a/22767829
has comment: http://stackoverflow.com/comment/34701623
type: Question
score: 4
upvote count: 4
answer count: 1
downvote count: 0
favorite count: 0
has answer: http://stackoverflow.com/a/22767829
has title: JavaFX within JApplet and Java7 - possible?
has body: is it possible to enrich a Swing-based JApplet (running in a web browser) with JavaFX content that works for Java7 clients? I tried the following things, but without success: a) Swing JApplet: If I try to add a JFXPanel to a JApplet I get java.lang.ClassNotFoundException: javafx.embed.swing.JFXPanel at runtime. b) Swing JApplet including javafx_version parameter (version 2.2+, see generated APPLET tag when using dtjava.embed() of the deployment toolkit): Adding a JFXPanel to a JApplet results in java.lang.ClassCastException: SwingInterop cannot be cast to javafx.application.Application at runtime. c) JavaFX Applet (javafx.application.Application): It seems that swing content can only be shown in a new JFrame (as shown in the official Oracle example at http://www.oracle.com/technetwork/java/javase/overview/javafx-samples-2158687.html) but not in a JavaFX Applet (javafx.application.Application) itself. SwingNode introduced with Java8 would obviously be the way to go but I didn't found a reliable alternative for Java7. Is there any way to get option a) running by adding the jfxrt.jar to the classpath (as option b) is obviously doing somehow)?
type: AnsweredQuestion

http://stackoverflow.com/comment/34689653
type: AnswerComment
has text: You don't give any hints of what you would expect of this hyphotetical plugin besides " internal mail system for user to be able to send mail to each others". So you should better describe what you're thinking of.
type: Comment
comment on: http://stackoverflow.com/a/22756617
score: 0

http://stackoverflow.com/comment/34610919
comment on: http://stackoverflow.com/a/22701001
type: Comment
has text: Thank you, I did try as you said but still crashes. The subActivity should remain the same? I have uploaded now the logcat (which I don't really know how to read).
score: 0
type: AnswerComment

sitemap
type: Tag
tags question: http://stackoverflow.com/q/22782851
tag name: sitemap

http://stackoverflow.com/comment/137777721
type: AnswerComment
score: 0
type: Comment
comment on: http://stackoverflow.com/a/74726084
has text: You confused me, I thought there was a `@ResponseEntity` annotation.

http://stackoverflow.com/comment/34604220
type: AnswerComment
score: 0
type: Comment
has text: Checkgoogleapp com.app.checkgoogleapp.CheckgoogleappServlet Checkgoogleapp /checkgoogleapp com.sun.faces.enableThreading false index.html </web-app>
comment on: http://stackoverflow.com/a/22708599

http://stackoverflow.com/comment/34718996
comment on: http://stackoverflow.com/q/22772788
score: 2
has text: How is it supposed to interpret `Entry > Entry`?
type: Comment
type: QuestionComment

http://stackoverflow.com/a/22750445
downvote count: 0
type: Answer
answers question: http://stackoverflow.com/q/22750372
has body: Start by taking a look at How to Use Buttons, Check Boxes, and Radio Buttons. You can use a ButtonGroup to ensure that only one button within the group is selected You can use an ActionListener to detect changes to the JRadioButton state
score: 4
has comment: http://stackoverflow.com/comment/34678402
upvote count: 4
has comment: http://stackoverflow.com/comment/34678433

http://stackoverflow.com/q/22695210
has comment: http://stackoverflow.com/comment/34580511
downvote count: 1
type: Question
has title: Java JVM versus Glassfish
score: 1
tagged with: java
has comment: http://stackoverflow.com/comment/34579567
tagged with: glassfish
has comment: http://stackoverflow.com/comment/34578624
has body: I'm really new to Java and I have a basic question. I'm getting ready to deploy a Java web service that I have created in Netbeans/Glassfish. I used Netbeans because of the development GUI and tools. Of course I also deployed to Netbean's built in GF server because of easy and simplicity. I have a Windows 8 server with IIS that I now need to deploy this to. I was thinking that since Java 1.7 EE was already on my IIS server, than I wouldn't need a "container server" like GF but that doesn't appear to be the case. So, I'm confused. What's the difference between the server that Glassfish creates and the JVM that Java EE creates when it is installed? If I have to install Glassfish on my IIS server, am I going to have competing web services and port conflicts to resolve? Thank you.
answer count: 1
has comment: http://stackoverflow.com/comment/34579828
favorite count: 0
linked to: http://stackoverflow.com/q/9391826
has answer: http://stackoverflow.com/a/22697447
accepted answer: http://stackoverflow.com/a/22697447
type: AnsweredQuestion
tagged with: netbeans
upvote count: 2

http://stackoverflow.com/a/22798540
has comment: http://stackoverflow.com/comment/34765230
has comment: http://stackoverflow.com/comment/34765277
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/34765168
has comment: http://stackoverflow.com/comment/34765178
has comment: http://stackoverflow.com/comment/34765209
answers question: http://stackoverflow.com/q/22798529
type: Answer
score: 11
has comment: http://stackoverflow.com/comment/34765207
has body: Because a simple semicolon next to another semicolon is an empty statement. So, lot of semi colons next to each other are lot of empty statements. It compiles and runs with no problems.
accepted answer of: http://stackoverflow.com/q/22798529
downvote count: 0
has comment: http://stackoverflow.com/comment/34765154
upvote count: 11
has comment: http://stackoverflow.com/comment/34765165

http://stackoverflow.com/a/22757374
has body: You can use this &lt;RelativeLayout android:layout_width="match_parent" android:layout_height="wrap_content"&gt; &lt;ImageView android:id="@+id/imageView" ...... android:layout_alignParentLeft="true" /&gt; &lt;TextView android:id="@+id/textView1" android:layout_width="wrap_content" android:layout_height="wrap_content" ...... android:layout_toRightOf="@+id/imageView" android:layout_alignTop="@+id/imageView" /&gt; &lt;TextView android:id="@+id/textView2" android:layout_width="wrap_content" android:layout_height="wrap_content" ...... android:layout_below="@+id/textView1" android:layout_alignLeft="@+id/textView1" /&gt; &lt;/RelativeLayout&gt; And then write a class to handle it
score: 0
type: Answer
answers question: http://stackoverflow.com/q/22755950

http://stackoverflow.com/q/22749530
has title: Cannot delete from JTable
has answer: http://stackoverflow.com/a/22749615
type: UnansweredQuestion
has body: my table is connected to a tree map which is being populated from my sql database, right now there are two classes in question, LibraryData.java and Delete.java. the aim is that in my GUI for delete.java i should be able to delete from the database of which the data is populated through libraryData when i now run my program and i click the delete button i get an error which is the problem clearly. i will post all the details below. LibraryData.java import java.util.*; import javax.swing.JOptionPane; import javax.swing.JTable; import javax.swing.table.DefaultTableModel; import java.sql.*; public class LibraryData { private Connection con; private Statement stmt; private ResultSet res; public LibraryData() { try { // con = DriverManager.getConnection("jdbc:mysql://;localhost:3306") String connectionUrl = "jdbc:sqlserver://SQL-SERVER;" + "databaseName=oe323;integratedSecurity=true;"; Class.forName("com.microsoft.sqlserver.jdbc.SQLServerDriver"); con = DriverManager.getConnection(connectionUrl); } catch (Exception ex) { System.out.println("Error: " + ex); } } public String listAll1() { String output = ""; try { stmt = con.createStatement(); res = stmt.executeQuery("SELECT * FROM LibraryTable"); while (res.next()) { // there is a result // the name field is the thrid one in the ResultSet // Note that with ResultSet we count the fields starting from 1 output += res.getString(1) + " " + res.getString(2) + " - " + res.getString(3) + " " + res.getString(4) + " " + res.getString(5) + "\n"; System.out.println(output); library.put(res.getInt(1), new Item(res.getString(2), res.getString(3), Integer.parseInt(res.getString(4)))); } } catch (Exception e) { System.out.println(e); return null; } return output; } public static class Item { Item(String n, String a, int r) { name = n; artist = a; rating = r; } // instance variables private String name; private String artist; private int rating; private int playCount; public String toString() { return name + " - " + artist; } } private s…
tagged with: java
type: Question
score: 0
tagged with: sql
answer count: 1

http://stackoverflow.com/q/22716119
has comment: http://stackoverflow.com/comment/34616994
tagged with: cron
type: AnsweredQuestion
downvote count: 0
score: 1
has body: I am working with cron in a STS web app I am developing and I am having a string format issue when trying to run the SpringMailSender on a cron timer. I am pulling the value for the cron from an external properties file and for some reason it does not seem to be liking it. Any ideas? Here is my code... public class Timer { @Autowired private ApplicationContext ctx; @Autowired private SpringMailSender springMailSender; @Scheduled(cron="${ctx.getMessage('timer.time', null, null)}") public void timer() { System.out.println("timer() in Timer Class has been stepped into"); try { springMailSender.sendMail(); } catch (Exception e) { e.printStackTrace(); } System.out.println("Method executed on every 2nd Monday of each month. Current time is :: "+ new Date()); } } The info in the external properties file looks like this... timer.time=0 0 8 ? 1/1 MON#2 * the error I am getting is this... "java.lang.IllegalStateException: Encountered invalid @Scheduled method 'timer': Could not resolve placeholder 'ctx.getMessage('timer.time', null, null)' in string value "${ctx.getMessage('timer.time', null, null)}"
favorite count: 0
has comment: http://stackoverflow.com/comment/34617354
type: Question
upvote count: 1
tagged with: spring
has title: cron issue with "Could not resolve placeholder"
has comment: http://stackoverflow.com/comment/34617429
has comment: http://stackoverflow.com/comment/34617621
linked to: http://stackoverflow.com/q/4779572
tagged with: java
has comment: http://stackoverflow.com/comment/34616855
answer count: 1
has answer: http://stackoverflow.com/a/22716723
accepted answer: http://stackoverflow.com/a/22716723

http://stackoverflow.com/a/22714972
answers question: http://stackoverflow.com/q/22714891
upvote count: 2
has body: Linear layout weight distributes space only in the dimension of the layout's orientation. You have a vertical linear layout and an element that is 0px wide - the weight mechanism won't add anything to that. Change the linear layout orientation to horizontal.
type: Answer
score: 2
downvote count: 0

http://stackoverflow.com/comment/34704846
comment on: http://stackoverflow.com/a/22764305
type: Comment
has text: How do I set the permission after the initial login dialog?
type: AnswerComment
score: 0

http://stackoverflow.com/a/22791605
type: Answer
answers question: http://stackoverflow.com/q/22791474
score: 0
has body: Likely you need Maven NAR Plugin or may be use profiles depending on the actual content of system-specific parts

http://stackoverflow.com/comment/34777124
comment on: http://stackoverflow.com/a/22805367
type: Comment
score: 2
has text: What about static nested classes?
type: AnswerComment

http://stackoverflow.com/a/22695141
upvote count: 29
score: 27
has comment: http://stackoverflow.com/comment/34580631
downvote count: 2
has comment: http://stackoverflow.com/comment/68087476
answers question: http://stackoverflow.com/q/22694884
has comment: http://stackoverflow.com/comment/34580585
type: Answer
has body: Update Nice suggestion in comment from @Holger: Optional&lt;User&gt; match = users.stream() .filter((user) -&gt; user.getId() &gt; 1) .reduce((u, v) -&gt; { throw new IllegalStateException("More than one ID found") }); Original answer The exception is thrown by Optional#get, but if you have more than one element that won't help. You could collect the users in a collection that only accepts one item, for example: User match = users.stream().filter((user) -&gt; user.getId() &gt; 1) .collect(toCollection(() -&gt; new ArrayBlockingQueue&lt;User&gt;(1))) .poll(); which throws a java.lang.IllegalStateException: Queue full, but that feels too hacky. Or you could use a reduction combined with an optional: User match = Optional.ofNullable(users.stream().filter((user) -&gt; user.getId() &gt; 1) .reduce(null, (u, v) -&gt; { if (u != null &amp;&amp; v != null) throw new IllegalStateException("More than one ID found"); else return u == null ? v : u; })).get(); The reduction essentially returns: null if no user is found the user if only one is found throws an exception if more than one is found The result is then wrapped in an optional. But the simplest solution would probably be to just collect to a collection, check that its size is 1 and get the only element.

http://stackoverflow.com/comment/123299404
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/22803234
has text: For anyone who encounters filename/path encoding issues in docker environment, this nice post helped me quickly: https://mikemybytes.com/2016/05/16/solving-locale-issues-with-docker-containers/
score: 0

http://stackoverflow.com/q/22659873
upvote count: 3
type: UnansweredQuestion
tagged with: swing
has body: Say I have an EditorKit for CSS styled Html (SwingBox), and I have an EditorKit for source code (SyntaxKit). Can I create a synthetic editor kit for a JEditorPane that combines these two, so that I can have interleaved HTML (which would come from a markdown parser) and source code (handled by the SyntaxKit)? E.g., like shown below. Note that I do not want to render the source code via a markdown-to-HTML parser, but use the specific syntax kit with its own lexer. And here we have some literal programming stuff. With images etc. object Foo { def bar = 1234 }
type: Question
tagged with: java
has title: Creating hybrid EditorKit which can alternate between for example markdown and source-code
score: 3
downvote count: 0
favorite count: 0
tagged with: htmleditorkit
tagged with: jeditorpane
answer count: 0

http://stackoverflow.com/comment/34566760
score: 0
comment on: http://stackoverflow.com/q/22686732
has text: From your code I see you only display the clonedTree. Why do you use 2 trees?
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/34624362
type: AnswerComment
score: 0
type: Comment
comment on: http://stackoverflow.com/a/22716120
has text: should Box.add as well as validate (or revalidate as suggested) be in an events dispatcher thread? or only box.add?

http://stackoverflow.com/a/22808089
upvote count: 1
downvote count: 0
score: 1
has body: You have Settings_Activity check=new Settings_Activity(); // wrong Looks like Settings_Activity is a Activity class and you are instantiating the same which is wrong Can i Create the object of a activity in other class? Quoting Raghav By treating an Activity as a normal Java class, you end up with a null context. As most methods in an Activity are called on its Context, you will get a null pointer exception, which is why your app crashes. And you do have this (check.preferences.getFloat(check.MealMoney,0) So the crash is probably bcoz of this Settings_Activity check=new Settings_Activity();
answers question: http://stackoverflow.com/q/22808032
type: Answer

http://stackoverflow.com/comment/59469739
type: AnswerComment
has text: This is excellent for when it applies. I deal with plenty of sites that don't use something as simple as putting the file in `href`, but if they do, this is great.
type: Comment
comment on: http://stackoverflow.com/a/35420419
score: 4

http://stackoverflow.com/a/41620996
upvote count: 1
has body: Here, i summarized some general solutions for lambdas expressions modifying method local variables. Lambdas Expressions are actually anonymous inner classes in a concise form. When we use them in local methods we should take several constraints into consideration: lambdas expressions(anonymous inner class) cant modify local variables of surrounding method <a href="https://www.google.com/url?sa=t&amp;rct=j&amp;q=&amp;esrc=s&amp;source=web&amp;cd=3&amp;cad=rja&amp;uact=8&amp;ved=0ahUKEwiK49LK_LzRAhUjQJoKHZ4ZB9kQFggiMAI&amp;url=http%3A%2F%2Fstackoverflow.com%2Fquestions%2F4732544%2Fwhy-are-only-final-variables-accessible-in-anonymous-class&amp;usg=AFQjCNEfjS6-A0XSwf_JCFUKwssoXGDldg&amp;sig2=t9WXo58OT4voMopC0t3wxQ&amp;bvm=bv.144210762,d.bGs" rel="nofollow noreferrer">link here they must be final or in java 8 effectively final Unlike instance variables, local variables do not get default values and if you want to use or return them you must initialize them first When these two constraints collide (in case of defining a lambdas in a method where lambdas modifies local variable in surrounding method), we get into trouble solutions: solution 1: do not modify method local variable in lambdas or use instance variables instead solution 2: do some tricks, for example copy local variable into another one and pass that to lambdas: public static List&lt;String&gt; catch22(List&lt;String&gt; input) { List&lt;String&gt; result = null; if (input != null) { result = new ArrayList&lt;&gt;(input.size()); List&lt;String&gt; effectivelyFinalResult = result; input.forEach(e -&gt; effectivelyFinalResult.add(e)); } return result; } or limit local variables scope so you dont get into trouble for not initializing them: public static List&lt;String&gt; catch22(List&lt;String&gt; input) { if (input != null) { List&lt;String&gt; result; // result gets its value in the lambdas so it is effectively final result = new ArrayList&lt;&gt;(input.size()); input.forEach(e -&gt; result.add(e)); return resu…
answers question: http://stackoverflow.com/q/22777915
downvote count: 0
type: Answer
score: 1

user-interface
tags question: http://stackoverflow.com/q/22778776
tags question: http://stackoverflow.com/q/22735671
tags question: http://stackoverflow.com/q/22673092
tags question: http://stackoverflow.com/q/22685908
tags question: http://stackoverflow.com/q/22663681
tags question: http://stackoverflow.com/q/22768191
tags question: http://stackoverflow.com/q/22734112
tags question: http://stackoverflow.com/q/22670540
tags question: http://stackoverflow.com/q/22801601
tags question: http://stackoverflow.com/q/22741362
tags question: http://stackoverflow.com/q/22766001
tags question: http://stackoverflow.com/q/22785573
tags question: http://stackoverflow.com/q/22701871
tags question: http://stackoverflow.com/q/22728794
tags question: http://stackoverflow.com/q/22772379
tags question: http://stackoverflow.com/q/22738919
type: Tag
tags question: http://stackoverflow.com/q/22721968
tags question: http://stackoverflow.com/q/22656656
tags question: http://stackoverflow.com/q/22753454
tags question: http://stackoverflow.com/q/22659055
tags question: http://stackoverflow.com/q/22768544
tags question: http://stackoverflow.com/q/22721666
tags question: http://stackoverflow.com/q/22746108
tags question: http://stackoverflow.com/q/22766209
tags question: http://stackoverflow.com/q/22691353
tags question: http://stackoverflow.com/q/22650561
tags question: http://stackoverflow.com/q/22716160
tags question: http://stackoverflow.com/q/22676020
tags question: http://stackoverflow.com/q/22664607
tags question: http://stackoverflow.com/q/22796223
tags question: http://stackoverflow.com/q/22715607
tags question: http://stackoverflow.com/q/22744326
tags question: http://stackoverflow.com/q/22726565
tags question: http://stackoverflow.com/q/22651331
tags question: http://stackoverflow.com/q/22670035
tags question: http://stackoverflow.com/q/22683448
tags question: http://stackoverflow.com/q/22700271
tags question: http://stackoverflow.com/q/22777798
tags question: http://stackoverflow.com/q/22702238
tags question: http://stackoverflow.com/q/22793619
tags question: http://stackoverflow.com/q/22731675
tags question: http://stackoverflow.com/q/22765816
tags question: http://stackoverflow.com/q/22715833
tags question: http://stackoverflow.com/q/22784523
tags question: http://stackoverflow.com/q/22729956
tags question: http://stackoverflow.com/q/22736590
tags question: http://stackoverflow.com/q/22775754
tags question: http://stackoverflow.com/q/22747299
tags question: http://stackoverflow.com/q/22680658
tags question: http://stackoverflow.com/q/22795036
tags question: http://stackoverflow.com/q/22798153
tags question: http://stackoverflow.com/q/22801764
tag name: user-interface
tags question: http://stackoverflow.com/q/22674859
tags question: http://stackoverflow.com/q/22702865
tags question: http://stackoverflow.com/q/22674163
tags question: http://stackoverflow.com/q/22751940
tags question: http://stackoverflow.com/q/22738570
tags question: http://stackoverflow.com/q/22661406

http://stackoverflow.com/comment/34501327
comment on: http://stackoverflow.com/q/22650404
score: 0
type: Comment
type: QuestionComment
has text: @jahroy I updated the answer, please have a look

http://stackoverflow.com/comment/34731498
score: 0
type: Comment
has text: As a test, can you write to target instead of temp? What does `getCurrentConfigFile` do? Maybe it opens the file without closing it?
type: QuestionComment
comment on: http://stackoverflow.com/q/22779916

http://stackoverflow.com/comment/34527923
comment on: http://stackoverflow.com/q/22662769
score: 0
type: QuestionComment
type: Comment
has text: How do you inject your `EntityManager`? Anyway, do you strictly need to exclude unlisted entity classes? And why do you exclude `commonj.sdo` in `pom.xml`? Definetly strange. Anyway you dont need to define jpa provider, if you dont need to use a specific version, eclipselink is already shipped with glassfish. Have a look at this post http://stackoverflow.com/questions/19778953/could-not-resolve-a-persistence-unit-error-netbeans-7-3-7-4-and-glassfish-4 , might be helpful.

http://stackoverflow.com/a/22765025
downvote count: 1
has comment: http://stackoverflow.com/comment/34705071
type: Answer
has comment: http://stackoverflow.com/comment/34705268
answers question: http://stackoverflow.com/q/22764871
score: 0
has comment: http://stackoverflow.com/comment/34704924
upvote count: 1
has body: If you're willing to make a copy of it ( a hasmap with default values ) You can first clear your hashmap and then move over the default values hm.keySet().removeAll(); hm.putAll(defaultMap);

http://stackoverflow.com/q/22736699
downvote count: 0
has comment: http://stackoverflow.com/comment/34683943
favorite count: 0
has answer: http://stackoverflow.com/a/22819722
has body: We are developing a large test suite which is intended to run on multiple environments, such as smoke, performance, full suite, etc. (We are currently using JUnit as the test framework.) What we are trying to achieve is annotate tests (classes or methods or both) with one or more annotations like @SmokeTest, @PerformanceTest, @AcceptanceTest and then add some test tasks in the build.gradle to run a specific selection of tests based on those annotations. The idea is very much like this one from the Gradle forum. I know Gradle can detect JUnit tests based on JUnit annotations (see 23.12.4. Test detection in the gradle user guide). However, I cannot find out how I can leverage that capability and add some custom logics of my own. What I am looking for is something like below: Detect the tests based on one or more given annotations (include or exclude) Add the detected tests into a container of some sort. Have a test task to run tests in the container. So, I would like to ask any guidance that you can provide to achieve that functionality. Thank you very much.
possible better answer: http://stackoverflow.com/a/27186285
linked to: http://stackoverflow.com/q/24704813
has title: Gradle: guidance needed to filter tests using annotation
tagged with: gradle
has answer: http://stackoverflow.com/a/27186285
type: AnsweredQuestion
tagged with: java
score: 4
accepted answer: http://stackoverflow.com/a/22819722
type: Question
upvote count: 4
answer count: 2

http://stackoverflow.com/q/22732031
type: Question
downvote count: 0
answer count: 1
favorite count: 0
tagged with: synchronization
has title: synchronized java thread wrong output sequence
tagged with: multithreading
has answer: http://stackoverflow.com/a/22732079
type: AnsweredQuestion
score: 3
accepted answer: http://stackoverflow.com/a/22732079
upvote count: 3
tagged with: java
has body: Hy, i try to follow this http://www.studytonight.com/java/synchronization.php here's my code class First { public void display(String msg) { System.out.print("["+msg); try { Thread.sleep(1000); } catch (InterruptedException ex) {} System.out.println("]"); } } class Second extends Thread{ String msg; First fobj; Second(First fp,String str){ msg=str; fobj=fp; start(); } public void run(){ synchronized(fobj){ fobj.display(msg); } } } public class Main { public static void main(String[] args) { // TODO code application logic here First f=new First(); Second s1=new Second(f,"welcome"); Second s2=new Second(f,"new"); Second s3=new Second(f,"programmer"); } } and here's my result run: [welcome] [programmer] [new] BUILD SUCCESSFUL (total time: 3 seconds) what's wrong with my code? why the result isn't welcome new programmer ?

http://stackoverflow.com/comment/68753486
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/22778509
has text: @DEVELOPER May be binary data
score: 0

http://stackoverflow.com/comment/34669651
comment on: http://stackoverflow.com/q/22745706
has text: just realised that artist and track name were the wrong way round, specifically what part of the code would you like to see
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/34688142
type: Comment
has text: @user2822178 good , it's always good to debug yourself first and try to understand the reason:)
comment on: http://stackoverflow.com/a/22755522
type: AnswerComment
score: 0

http://stackoverflow.com/comment/34592502
type: Comment
has text: I'm sorry, you *do* need \\ before `-` so that it doesn't treat it as a range. I am not having a good day. Sorry for the misinformation.
comment on: http://stackoverflow.com/a/22702196
type: AnswerComment
score: 0

http://stackoverflow.com/comment/34673587
score: 0
type: Comment
type: QuestionComment
has text: Yes, the last corner has to be empty. I'm not sure which layout to use. I think I should be using grid layout but I don't understand how I could get the buttons to be aligned at the bottom.
comment on: http://stackoverflow.com/q/22747023

http://stackoverflow.com/comment/57523738
comment on: http://stackoverflow.com/q/22661849
has text: Here you can find the complete working example. http://www.startingandroid.com/registration-and-login-with-back-end-php-and-mysql/
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/34658548
score: 0
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/22739281
has text: Yes and sometimes, the hardest thing is to know if you're going to actually need those attributes (for example, use them for something accesing from another class).

http://stackoverflow.com/q/22675723
upvote count: 1
type: Question
has comment: http://stackoverflow.com/comment/34544529
tagged with: eclipse
has title: JPA/Hibernate finds no mapped classes after deployment
has answer: http://stackoverflow.com/a/22676023
tagged with: jpa
has comment: http://stackoverflow.com/comment/34544274
downvote count: 0
answer count: 1
score: 1
accepted answer: http://stackoverflow.com/a/22676023
favorite count: 0
type: AnsweredQuestion
has body: Short Version I've got a Java-project which uses JPA 2.0 with Hibernate 4.3.4. All is fine when I run it inside Eclipse. But when I let Eclipse export a runnable JAR, the trouble begins and the program crashes due to a seemingly missing persistence unit... javax.persistence.PersistenceException: No Persistence provider for EntityManager named MyDBManager at javax.persistence.Persistence.createEntityManagerFactory(Persistence.java:61) ... or seemingly unmapped classes... 3024 Thread-4| FATAL DbManager : DBManager could not load countries from database. java.lang.IllegalArgumentException: org.hibernate.hql.internal.ast.QuerySyntaxException: Country is not mapped [SELECT x FROM Country x] at org.hibernate.jpa.spi.AbstractEntityManagerImpl.convert(AbstractEntityManagerImpl.java:1750) 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.createQuery(AbstractEntityManagerImpl.java:331) Background Depending on the kind of export (extracting vs. packaging vs. copying libraries), I run into different errors which resist solving. The furthest I get is with the last approach, which is also the one I have to choose for license reasons, so let's focus on that one. In this case the exported JAR fails to look into its persistence.xml. I will specify that later but first some background information... Folder Structure some_folder myproject_lib myproject.jar root of my project's package structure meta-inf persistence.xml File persistence.xml <!-- <exclude-unlisted-classes>false</exclude-unlisted-classes> --> <property name="javax.persistence.jdbc.driver" value="com.mysql.jdbc.Driver" /> <property name="hibernate.dialect" value="org.hibernate.dialect.MySQLDialect" /> <property name="hibernate.id.new_generator_mappings" value="true" /> <!-- <property name="hibernate.archive.autodetection" value="cla…
has comment: http://stackoverflow.com/comment/34544540
tagged with: java
tagged with: hibernate

google-oauth
type: Tag
tags question: http://stackoverflow.com/q/22789724
tag name: google-oauth
tags question: http://stackoverflow.com/q/22807066

http://stackoverflow.com/q/22784231
has comment: http://stackoverflow.com/comment/34738983
has title: Walking a hashmap of hashmaps to retrieve a string value in Java
type: AnsweredQuestion
score: 0
tagged with: java
has answer: http://stackoverflow.com/a/22784397
accepted answer: http://stackoverflow.com/a/22784528
has comment: http://stackoverflow.com/comment/34738972
has body: I'm new to Java (and not too comfortable with strong typing) and I have a method that takes in a HashMap. A key in this hashmap contains a key, which has a hashmap for value, which also points to a hashmap, etc, until we reach a string:y HashMap1-&gt;HashMap2-&gt;HashMap3-&gt;HashMap4-&gt;String I am trying to access it as follows: HashMap1 .get("aKey") .get("anotherKey") .get("yetAnotherKey") .get("MyString"); But then I get an error, Object does not have a method "get(String) Here is the method, simplified: public HashMap&lt;String, HashMap&gt; getMyString(Map&lt;String, HashMap&gt; hashMap1) { String myString = hashMap1 .get("aKey") .get("anotherKey") .get("yetAnotherKey") .get("MyString"); // do something with myString. return hashMap1; } How would someone properly define the method and the parameters to access nested elements easily? Thank you,
type: Question
has answer: http://stackoverflow.com/a/22784742
tagged with: linkedhashmap
tagged with: hashmap
possible better answer: http://stackoverflow.com/a/22784397
has comment: http://stackoverflow.com/comment/34738987
has comment: http://stackoverflow.com/comment/34739218
answer count: 3
has answer: http://stackoverflow.com/a/22784528

http://stackoverflow.com/comment/34633841
has text: Looks like the link in @chillworld's answer says basically the same thing.
comment on: http://stackoverflow.com/a/22723703
type: AnswerComment
score: 0
type: Comment

http://stackoverflow.com/q/22766084
answer count: 0
has comment: http://stackoverflow.com/comment/34706689
tagged with: java
tagged with: file
has comment: http://stackoverflow.com/comment/34706824
has comment: http://stackoverflow.com/comment/34706761
has comment: http://stackoverflow.com/comment/34707304
type: Question
has body: I'm trying to send a file between server and client but when I'm trying to write into socket I'm getting java.net.SocketException: Connection reset by peer: socket write error. //server side package tcp; import java.net.*; import java.io.*; import java.sql.Connection; import java.util.*; public class ServerSock { static ServerSocket Socket1; static int port=2500; public static void main(String[] args) { Socket server; File filename=new File("C:/Users/Sudhir/Desktop/mot.wmv"); byte[] serverBuffer=new byte[(int)filename.length()]; StringBuffer msgFromClient= new StringBuffer(); String timeStamp; try { Socket1=new ServerSocket(port); System.out.println("Server Socket is initialised"); int c; server=Socket1.accept(); BufferedInputStream serverInputBuffer = new BufferedInputStream(server.getInputStream()); InputStreamReader serverInputStream = new InputStreamReader(serverInputBuffer); while((c=serverInputStream.read())!=13) { msgFromClient.append((char)c); } System.out.println(msgFromClient); try { Thread.sleep(3000); } catch (InterruptedException e) { e.printStackTrace(); } timeStamp=new Date().toString(); //String filename = "test.pdf"; //byte[] serverBuffer=new byte[1024*33]; String respond = "Server responded at "+ timeStamp + (char) 13; //System.out.println(respond); //BufferedOutputStream bos = new BufferedOutputStream(server.getOutputStream()); //OutputStreamWriter osw = new OutputStreamWriter(bos); FileInputStream fis=new FileInputStream(filename); BufferedInputStream bis = new BufferedInputStream(fis); bis.read(serverBuffer,0,serverBuffer.length); OutputStream os=server.getOutputStream(); try{ os.write(serverBuffer,0,serverBuffer.length); }catch(IOException e2){ System.out.println(e2); } //String serverMessage=new String(serverBuffer); //serverMessage+=(char)13; //osw.write(respond); os.flush(); server.close(); } catch (IOException e){ e.printStackTrace(); } } } //clientside package tcp; import java.io.*; import java.net.*; import java.util.*; public class Clien…
has title: Socket programming.sending files
score: 0
has comment: http://stackoverflow.com/comment/34706981
type: UnansweredQuestion
tagged with: sockets
has comment: http://stackoverflow.com/comment/34706788

http://stackoverflow.com/q/22784513
type: Question
tagged with: arrays
has answer: http://stackoverflow.com/a/22784583
has comment: http://stackoverflow.com/comment/34739391
possible better answer: http://stackoverflow.com/a/22784591
score: 0
has title: Access certain location in array of strings
has answer: http://stackoverflow.com/a/22784685
answer count: 5
has answer: http://stackoverflow.com/a/22784591
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/22784811
has answer: http://stackoverflow.com/a/22784725
accepted answer: http://stackoverflow.com/a/22784725
tagged with: java
linked to: http://stackoverflow.com/q/11229986
has body: I want to enter in 3 names into the array. Then I want to access the position of the second character in the second name. First of all I get an out of bounds exception in line 13. Also, the second for loop I know is completely off so excuse that. Why am I getting the exception and how would I access certain character positions in certain strings? class Names { public static void main(String[]args) { int index; String names[]; names = new String [3]; for(index = 1; index &lt;= names.length; index++) { System.out.println("Enter name " + index); names[index] = EasyIn.getString(); } for(index = 0; index &lt; names.length; index++) { System.out.println(names[1][2]); } } }

http://stackoverflow.com/q/22733570
tagged with: android
has body: I've been googling quite a fair bit to make this work and somehow it doens't for me. What I'm doing is running fragment and when i open it, i wish for it to be populated by data called from the mySQL database into the listview. import java.util.ArrayList; import java.util.HashMap; import java.util.List; import org.json.JSONArray; import org.json.JSONException; import org.json.JSONObject; import com.narutohd.ServiceHandler.ServiceHandler; import android.app.ListFragment; import android.app.ProgressDialog; import android.os.AsyncTask; import android.os.Bundle; import android.util.Log; import android.view.LayoutInflater; import android.view.ViewGroup; import android.widget.ListView; import android.widget.SimpleAdapter; public class FindPeopleFragment extends ListFragment { private ProgressDialog pDialog; // URL to get contacts JSON private static String url = "REMOVED"; // JSON Node names private static final String TAG_CONTACTS = "products"; private static final String TAG_ID = "pid"; private static final String TAG_NAME = "link"; // contacts JSONArray JSONArray contacts = null; private List&lt;HashMap&lt;String, String&gt;&gt; contactList; private SimpleAdapter adapter; public FindPeopleFragment(){} public void onActivityCreated(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { contactList = new ArrayList&lt;HashMap&lt;String, String&gt;&gt;(); adapter = new SimpleAdapter(getActivity(), contactList, R.layout.list_item, new String[] { TAG_ID, TAG_NAME }, new int[] { R.id.pid, R.id.episode }); ListView lv = getListView(); lv.setAdapter(adapter); new GetContacts().execute(); super.onActivityCreated(savedInstanceState); } private class GetContacts extends AsyncTask&lt;Void, Void, Void&gt; { @Override protected void onPreExecute() { } @Override protected Void doInBackground(Void... arg0) { //Code } } catch (JSONException e) { e.printStackTrace(); } } else { Log.e("ServiceHandler", "Couldn't get any data from the url"); } return null; } @Override p…
tagged with: asynchronous
has answer: http://stackoverflow.com/a/22742563
score: 0
has answer: http://stackoverflow.com/a/22734193
answer count: 3
tagged with: java
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/22743567
has title: Async task not executed in Fragment
type: Question

http://stackoverflow.com/q/22748053
favorite count: 0
upvote count: 2
has body: I have a long if statements in my program and I was wondering if there was a way to simply continue the conditional onto the next line so that it doesn't stretch off forever. Here's my statement: if (Character.isDigit(enrollDate.charAt(0)) &amp;&amp; Character.isDigit(enrollDate.charAt(1)) &amp;&amp; Character.isDigit(enrollDate.charAt(3)) &amp;&amp; Character.isDigit(enrollDate.charAt(4)) &amp;&amp; Character.isDigit(enrollDate.charAt(6)) &amp;&amp; Character.isDigit(enrollDate.charAt(7)) &amp;&amp; Character.isDigit(enrollDate.charAt(8)) &amp;&amp; Character.isDigit(enrollDate.charAt(9))) I'm just trying to ensure that a string containing a date is of the format I specified.
score: 2
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/34673953
has comment: http://stackoverflow.com/comment/34673938
has comment: http://stackoverflow.com/comment/34673934
has answer: http://stackoverflow.com/a/22748560
tagged with: java
has comment: http://stackoverflow.com/comment/34673947
has comment: http://stackoverflow.com/comment/34674230
type: Question
has answer: http://stackoverflow.com/a/22748081
accepted answer: http://stackoverflow.com/a/22748081
has comment: http://stackoverflow.com/comment/34674174
downvote count: 0
has title: Can an if statement conditional in Java be on multiple lines
has comment: http://stackoverflow.com/comment/34673940
has answer: http://stackoverflow.com/a/22748379
has comment: http://stackoverflow.com/comment/34673980
answer count: 3
has comment: http://stackoverflow.com/comment/34674190
possible better answer: http://stackoverflow.com/a/22748560
has comment: http://stackoverflow.com/comment/34673951

http://stackoverflow.com/comment/34742767
score: 0
type: Comment
has text: Do you just want to be able to drag the dialog from any initial point, except when the mouse drag starts from a component inside the dialog? I may not be understanding your question correctly
type: QuestionComment
comment on: http://stackoverflow.com/q/22783818

http://stackoverflow.com/a/22779519
type: AcceptedAnswer
downvote count: 0
answers question: http://stackoverflow.com/q/22779016
has comment: http://stackoverflow.com/comment/35353509
has comment: http://stackoverflow.com/comment/35220701
type: Answer
accepted answer of: http://stackoverflow.com/q/22779016
score: 1
upvote count: 1
has body: You have to load your library in your Activity static { System.loadLibrary("example"); } Make sure your .so file in your lib folder or /system/lib/ in the device where your try to run the application. Add this to your Example.c jint Java_com_example_pjtest_get_time(JNIEnv *env) { time_t ltime; time(&amp;ltime); return ctime(&amp;ltime); }

http://stackoverflow.com/comment/34793187
type: Comment
score: 9
type: AnswerComment
comment on: http://stackoverflow.com/a/22755225
has text: +1 It’s funny how so many people claim that there is no possibility when there is one. Btw. I included `forEach(existing::add)` as a possibility in an [answer two month ago](http://stackoverflow.com/questions/21522341/collection-to-stream-to-a-new-collection/21526973#21526973). I should have added `forEachOrdered` as well…

http://stackoverflow.com/q/22762492
has answer: http://stackoverflow.com/a/22762795
tagged with: java
type: Question
tagged with: mongodb
has answer: http://stackoverflow.com/a/22767085
tagged with: jsp
possible better answer: http://stackoverflow.com/a/22767085
upvote count: 2
answer count: 2
tagged with: mongodb-java
has body: Here's what I have tried yet: BasicDBObject searchQuery = new BasicDBObject(); searchQuery.put("email", email_id); DBCursor cursor=collection.find(searchQuery); String usr=null; String pass=null; while(cursor.hasNext()) { usr=(String)cursor.next().get("username"); pass=(String)cursor.next().get("password"); } I'm getting the username value as it is present in the record. But password is returning null.
favorite count: 0
has title: How to retrieve a single field(In my case password) using a search criteria(In my case email) in MongoDB(Java)?
accepted answer: http://stackoverflow.com/a/22762795
type: AnsweredQuestion
score: 2
downvote count: 0

http://stackoverflow.com/a/22773075
downvote count: 2
upvote count: 10
has body: look at the code User user = users.stream().filter((user) -&gt; user.getId() == 1).findAny().get(); The variable name is user and the variable inside the lambda is also user try changing it to be something like this User user = users.stream().filter((otherUser) -&gt; otherUser.getId() == 1).findAny().get();
score: 8
has comment: http://stackoverflow.com/comment/34721045
answers question: http://stackoverflow.com/q/22773003
has comment: http://stackoverflow.com/comment/34719580
type: Answer

http://stackoverflow.com/comment/34636076
type: QuestionComment
has text: I would say that, if the behavior is not stated in the spec, you cannot depend on it, one way or the other.
comment on: http://stackoverflow.com/q/22726220
score: 0
type: Comment

http://stackoverflow.com/comment/34688014
type: Comment
type: QuestionComment
has text: Thanks, but the problem is that the read() always return -1 in linux
score: 0
comment on: http://stackoverflow.com/q/22755100

http://stackoverflow.com/comment/34702860
type: QuestionComment
has text: Seems like you have a conflict of jars going on - and what version of Chrome are you using?
score: 0
type: Comment
comment on: http://stackoverflow.com/q/22763752

jboss7.x
tags question: http://stackoverflow.com/q/22756831
type: Tag
tags question: http://stackoverflow.com/q/22780638
tags question: http://stackoverflow.com/q/22743406
tags question: http://stackoverflow.com/q/22657097
tag name: jboss7.x
tags question: http://stackoverflow.com/q/22784782
tags question: http://stackoverflow.com/q/22698837
tags question: http://stackoverflow.com/q/22662972
tags question: http://stackoverflow.com/q/22686385

http://stackoverflow.com/q/22681226
tagged with: touchpad
upvote count: 1
type: Question
tagged with: libgdx
score: 1
tagged with: java
has comment: http://stackoverflow.com/comment/34559400
has comment: http://stackoverflow.com/comment/34554203
has answer: http://stackoverflow.com/a/22685306
answer count: 1
downvote count: 0
favorite count: 0
has comment: http://stackoverflow.com/comment/34558693
has body: I'm very new to Libgdx. I have looked through many helpful tutorials, but nothing has implemented the following structure. I've implemented a movable object that is an extension of InputAdapter, and overrides keyDown/Up to update its(object) location. Now, I've implemented a touchPadController class that has a touchpad and knob that are visible on the screen. Then, I added a variable that is an object of the touchPadController class. My ultimate goal in the future is to completely separate the controls class from any movable objects/characters. The problem: I want to call the setInputProcessor only to the movable objects/characters, and not directly to the touchPadController class. I want the parent movable object to call its own controls. But, I do not know where the of call for the touchPadController functions would happen?? I tried this but it didn't work: //movable object @Override public boolean touchDown(int screenX, int screenY, int pointer, int button) { Gdx.input.setInputProcessor(touchPadController); } //touchPadController @Override public boolean touchDown(int screenX, int screenY, int pointer, int button) { parent.newSpeedX = touchpad.getKnobPercentX() * Speed; parent.newSpeedY = touchpad.getKnobPercentY() * Speed; return true; } *Where should I call to the touchPadController within the parent(movable object)?
has title: Libgdx: How do you separate the controls from the movable object?
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/22685306

http://stackoverflow.com/a/22694219
answers question: http://stackoverflow.com/q/22693856
has comment: http://stackoverflow.com/comment/34577000
score: 0
has comment: http://stackoverflow.com/comment/34577019
type: Answer
has comment: http://stackoverflow.com/comment/34577154
has body: Try this... List&lt;Class1&gt; list= new ArrayList&lt;Class1&gt;(); Class1 c = new Class1(); c.setA(2); c.setB(4); list.add(c); System.out.println(list.get(0).getA()); This will print 2 and List&lt;Serializable&gt; list2= new ArrayList&lt;Serializable&gt;(); list2.add(c); System.out.println(((Class1)list2.get(0)).getA()); This will also print 2

http://stackoverflow.com/comment/34668518
comment on: http://stackoverflow.com/a/22744986
type: AnswerComment
has text: No, it is meant to include additional jars installed with/added to your Java installation. Anyway it is more a 'system setup' thing than an 'application setup' thing - best to leave it alone.
score: 0
type: Comment

http://stackoverflow.com/q/22717782
tagged with: spring
tagged with: spring-mvc
answer count: 0
tagged with: java
has body: We are using Spring 3.1.2 and have a String bean defined for our client-side stuff: &lt;bean name="clientVersion" class="java.lang.String"&gt; &lt;constructor-arg value="CLIENT_VERSION" /&gt; &lt;/bean&gt; This gets used for various things within our beans. I want to be able to use it in the &lt;resources&gt; tag to map some of our static resources. I tried this: &lt;resources mapping="/#{clientVersion}/**" location="/path/to/versioned/resources/#{clientVersion}/" /&gt; It seems to work for the mapping attribute. I see this on server startup: INFO o.s.w.s.h.SimpleUrlHandlerMapping - Mapped URL path [/CLIENT_VERSION/**] onto handler 'org.springframework.web.servlet.resource.ResourceHttpRequestHandler#2' However, when I actually hit a URL under CLIENT_VERSION(e.g. "CLIENT_VERSION/all.js"), I see this in the logs: DEBUG o.s.w.s.h.SimpleUrlHandlerMapping - URI Template variables for request [/CLIENT_VERSION/all.js] are {} DEBUG o.s.w.s.h.SimpleUrlHandlerMapping - Mapping [/CLIENT_VERSION/all.js] to HandlerExecutionChain with handler [org.springframework.web.servlet.resource.ResourceHttpRequestHandler@7dad45af] and 1 interceptor DEBUG o.s.w.s.DispatcherServlet - Last-Modified value for [/CLIENT_VERSION/all.js] is: -1 DEBUG o.s.w.s.r.ResourceHttpRequestHandler - Trying relative path [all.js] against base location: ServletContext resource [/path/to/versioned/resources/#{clientVersion}/] DEBUG o.s.w.s.r.ResourceHttpRequestHandler - No matching resource found - returning 404 My guess is that it's trying to find the file at /path/to/versioned/resources/#{clientVersion}/all.js, and since the file is at the path /path/to/versioned/resources/CLIENT_VERSION/all.js, it doesn't find it. Is there a way for the location attribute to resolve #{clientVersion} like the mapping attribute does? Is there another way to accomplish this?
upvote count: 1
type: Question
has comment: http://stackoverflow.com/comment/34622438
has title: Using Spring bean value in <resources> tag
has comment: http://stackoverflow.com/comment/34622002
has comment: http://stackoverflow.com/comment/34620940
downvote count: 0
score: 1
favorite count: 0
type: UnansweredQuestion

http://stackoverflow.com/q/22705332
answer count: 3
has comment: http://stackoverflow.com/comment/34597451
has answer: http://stackoverflow.com/a/22754135
tagged with: android-sdcard
has answer: http://stackoverflow.com/a/22708459
tagged with: android
has comment: http://stackoverflow.com/comment/34597990
has comment: http://stackoverflow.com/comment/34639007
type: AnsweredQuestion
possible better answer: http://stackoverflow.com/a/22708459
accepted answer: http://stackoverflow.com/a/22754135
has comment: http://stackoverflow.com/comment/34597480
tagged with: java
has body: I am capturing images, then storing into SD Card and showing in a List, but here i need a small change, still i am getting old on top and latest at bottom, so now i want to show latest picture on the top on the basis of datetimestamp using as a part of file name. UploadActivity.java code:- String fileName; static List &lt;String&gt; ImageList; /*** Get Images from SDCard ***/ ImageList = getSD(); // ListView and imageAdapter lstView = (ListView) findViewById(R.id.listView1); lstView.setAdapter(new ImageAdapter(this)); } public static List &lt;String&gt; getSD() { List &lt;String&gt; it = new ArrayList &lt;String&gt;(); String string = "/mnt/sdcard/Pictures/SamCam/"; f = new File (string+ CameraLauncherActivity.folder+ "/"); files = f.listFiles (); for (int i = 0; i &lt; files.length; i++) { file = files[i]; Log.d("Count",file.getPath()); it.add (file.getPath()); } return it; } public class ImageAdapter extends BaseAdapter { private Context context; public ImageAdapter(Context c) { // TODO Auto-generated method stub context = c; } Note: I am using date/timestamp while storing my images into SD Card. so finally it looks like this: AU_20140328163947_1_4_X-1-4-006.jpg and still files listing in below format, like below: AU_20140328163947_1_4_X-1-4-006.jpg AU_20140328163948_1_4_X-1-4-007.jpg AU_20140328163949_1_4_X-1-4-008.jpg but i want to list files in below format:- AU_20140328163949_1_4_X-1-4-008.jpg AU_20140328163948_1_4_X-1-4-007.jpg AU_20140328163947_1_4_X-1-4-006.jpg Code to Delete Image in a List:-- // btnDelete final ImageButton btnDelete = (ImageButton) convertView.findViewById(R.id.btnDelete); btnDelete.setOnClickListener(new OnClickListener() { @Override public void onClick(View arg0) { AlertDialog.Builder alertDialogBuilder = new AlertDialog.Builder(context); // set title alertDialogBuilder.setTitle("Delete Image"); // Setting Icon to Dialog alertDialogBuilder.setIcon(R.drawable.ic_launcher); // set dialog message alertDialogBuilder .setMessage("Are you sur…
linked to: http://stackoverflow.com/q/12480724
linked to: http://stackoverflow.com/q/22553802
type: Question
tagged with: sorting
has title: How to sort files using datetimestamp
has comment: http://stackoverflow.com/comment/34637986
score: 0
has answer: http://stackoverflow.com/a/22728423

http://stackoverflow.com/a/22736811
has body: Your question is a little confusing, but let me see if I can help based on what I think you are saying. i prefer to create a hard coded list in the java class object I think you are saying that you would like to maintain a variable that represents a list to hold Student information, perhaps something like this: private ArrayList&lt;Student&gt; myList = new ArrayList&lt;Student&gt;; In this case you would add Student objects to the list after they are instantiated.
score: 0
type: Answer
answers question: http://stackoverflow.com/q/22736539

http://stackoverflow.com/comment/34711916
type: Comment
type: QuestionComment
has text: See my answer, tried to explain it better there with more space and code examples.
score: 0
comment on: http://stackoverflow.com/q/22768191

http://stackoverflow.com/q/22775471
accepted answer: http://stackoverflow.com/a/22779950
tagged with: opengl
tagged with: java
type: Question
has answer: http://stackoverflow.com/a/22779950
score: 0
answer count: 1
tagged with: jogl
tagged with: out-of-memory
has title: JOGL Large Texture Out Loading Out Of Memory
tagged with: textures
has body: I'm am loading a seven megabyte texture in JOGL using TextureIO, but after about three seconds, the program crashes without displaying anything with an OutOfMemoryError. Yes, I understand that a seven megabyte image is a ridiculous size, but I still want to load it. By the way, is a 8192 x 4096 texture supposed to be seven megabytes? I have already considered the idea of splitting the image into several smaller textures and loading them one at a time, but this won't cooperate well with the sphere class I already have written. I suppose I COULD do it if I absolutely HAD to, but I would love to avoid that particular course of action. I am not running on any sort of embedded device (Android, iPhone, etc.), I have a good 2 gigabytes of RAM, not sure about the GPU's RAM, but I would be willing to be it's enough to hold a seven megabyte texture. I have a 32-bit installation of Java and a 32-bit Windows computer, if any of that information helps. Any ideas on why I'm running out of memory and how to fix it? EDIT: I might be on to something, and everybody experienced might be slapping their foreheads, but the error says: java.lang.OutOfMemoryError: Java heap space I'm guessing the 'Java heap space' part will help solve the problem.
type: AnsweredQuestion

http://stackoverflow.com/q/22650365
has comment: http://stackoverflow.com/comment/34503851
linked to: http://stackoverflow.com/q/14520218
has body: My project works well when in Tomcat 7, but fails when using Tomcat 8 using Intellij 13 with Maven. 2014-03-25 19:10:01.204 [RMI TCP Connection(3)-127.0.0.1] ERROR o.s.web.context.ContextLoader - Context initialization failed java.lang.IllegalArgumentException: URL must not be null at org.springframework.util.Assert.notNull(Assert.java:112) ~[Assert.class:4.0.2.RELEASE] at org.springframework.core.io.UrlResource.&lt;init&gt;(UrlResource.java:77) ~[UrlResource.class:4.0.2.RELEASE] at org.springframework.core.io.support.PathMatchingResourcePatternResolver.convertClassLoaderURL(PathMatchingResourcePatternResolver.java:322) ~[PathMatchingResourcePatternResolver.class:4.0.2.RELEASE] at org.springframework.core.io.support.PathMatchingResourcePatternResolver.findAllClassPathResources(PathMatchingResourcePatternResolver.java:308) ~[PathMatchingResourcePatternResolver.class:4.0.2.RELEASE] at org.springframework.core.io.support.PathMatchingResourcePatternResolver.getResources(PathMatchingResourcePatternResolver.java:273) ~[PathMatchingResourcePatternResolver.class:4.0.2.RELEASE] at org.springframework.core.io.support.PathMatchingResourcePatternResolver.findPathMatchingResources(PathMatchingResourcePatternResolver.java:339) ~[PathMatchingResourcePatternResolver.class:4.0.2.RELEASE] at org.springframework.core.io.support.PathMatchingResourcePatternResolver.getResources(PathMatchingResourcePatternResolver.java:269) ~[PathMatchingResourcePatternResolver.class:4.0.2.RELEASE] at org.springframework.context.support.AbstractApplicationContext.getResources(AbstractApplicationContext.java:1170) ~[AbstractApplicationContext.class:4.0.2.RELEASE] at org.springframework.beans.factory.support.AbstractBeanDefinitionReader.loadBeanDefinitions(AbstractBeanDefinitionReader.java:215) ~[AbstractBeanDefinitionReader.class:4.0.2.RELEASE] at org.springframework.beans.factory.support.AbstractBeanDefinitionReader.loadBeanDefinitions(AbstractBeanDefinitionReader.java:187) ~[AbstractBeanDefinitionReader…
type: Question
has answer: http://stackoverflow.com/a/22740212
accepted answer: http://stackoverflow.com/a/22740212
upvote count: 2
answer count: 1
downvote count: 0
has title: Updating from Tomcat 7 to Tomcat 8 gives me java.lang.IllegalArgumentException: URL must not be null from UrlResource
has comment: http://stackoverflow.com/comment/34659664
tagged with: tomcat
favorite count: 0
has comment: http://stackoverflow.com/comment/34503822
score: 2
type: AnsweredQuestion
tagged with: java

http://stackoverflow.com/a/22702673
type: Answer
has body: FacesContext.getCurrentInstance() returns instance of FacesContext subclass (which is not abstract class), for example it is FacesContextImpl in MyFaces. We have similar situation with abstract class java.util.Calendar: getInstance method returns instance of GregorianCalendar.
answers question: http://stackoverflow.com/q/22652817
score: 0

http://stackoverflow.com/a/22759293
answers question: http://stackoverflow.com/q/22759094
type: Answer
has comment: http://stackoverflow.com/comment/34695320
has body: You can set the session expiry time: // set 5 seconds // default is 1800 seconds (30 minutes) sess.setMaxInactiveInterval(5); And after this elapsed time the session will expire automatically.
upvote count: 1
score: 1
type: AcceptedAnswer
downvote count: 0
accepted answer of: http://stackoverflow.com/q/22759094

http://stackoverflow.com/q/22792509
has comment: http://stackoverflow.com/comment/34754302
tagged with: java-8
has comment: http://stackoverflow.com/comment/34754175
has comment: http://stackoverflow.com/comment/34754233
has comment: http://stackoverflow.com/comment/34754206
has comment: http://stackoverflow.com/comment/34754515
tagged with: java
tagged with: java-time
tagged with: jodatime
has body: Consider the following code: public static void main(String[] args) { String pattern = "MMM dd, yyyy HH:mm:ss a z"; // joda-time DateTime dt = DateTime.now(); System.out.println(dt.toString(pattern)); // java.time ZonedDateTime ldt = ZonedDateTime.now(); System.out.println(ldt.toString(pattern)); // doesn't exist System.out.println(ldt.format(DateTimeFormatter.ofPattern(pattern))); } joda-time classes (DateTime, LocalDate, etc) included a toString method that accepts a String of the format you wanted. This was a very handy method. Yet, the java-8 implementation omits this method. Instead, you need to call format(DateTimeFormatter formatter). A small gripe, sure. But my question is: is there any reason this was omitted from java.time? Converting my applications from joda-time to java.time will be that much more difficult because of this small omission. But, I'm ok with it if there's a logical reason. Not that you are here to assuage my concerns, but I thought I'd ask just in case. Edit: to the close-voters, this is not an opinion-based question. Anyone who is familiar with the inner-workings of joda-time/java.time and their motivations to develop in certain ways is qualified to answer the question, even if they never do.
possible better answer: http://stackoverflow.com/a/22792620
score: 2
has comment: http://stackoverflow.com/comment/34754281
downvote count: 0
has answer: http://stackoverflow.com/a/22792620
has title: java.time ::toString(String pattern) method missing
has comment: http://stackoverflow.com/comment/34754425
has comment: http://stackoverflow.com/comment/34754234
has comment: http://stackoverflow.com/comment/34754023
type: Question
has comment: http://stackoverflow.com/comment/34765579
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/22809004
has comment: http://stackoverflow.com/comment/34754461
favorite count: 0
has answer: http://stackoverflow.com/a/22792780
has comment: http://stackoverflow.com/comment/34759525
upvote count: 2
has comment: http://stackoverflow.com/comment/34754369
accepted answer: http://stackoverflow.com/a/22809004
has comment: http://stackoverflow.com/comment/34754239
answer count: 3

http://stackoverflow.com/a/29942660
has comment: http://stackoverflow.com/comment/48007283
downvote count: 0
has body: You can use -Djavafx.embed.singleThread=true, so you dont have to make the event dispatching on your own. JavaFx APIDesign
score: 1
type: Answer
answers question: http://stackoverflow.com/q/22808223
upvote count: 1
has comment: http://stackoverflow.com/comment/48010926

http://stackoverflow.com/comment/34533787
type: AnswerComment
type: Comment
has text: Nope, I must have misread. This answer has been quite helpful, by the way. I'm working on an implementation, which I'll append to my question before marking the question answered.
comment on: http://stackoverflow.com/a/22656492
score: 0

http://stackoverflow.com/comment/34502383
type: AnswerComment
comment on: http://stackoverflow.com/a/22652131
type: Comment
has text: mappedImage is a 2D array, you cannot print an entire array at once, you need to go through it using a for loop and print each element separately. so you need a for loop to iterate the first dimension, and the second one to iterate throughout the second dimensions. (look at the edit of my answer for an example) Also just a note on stackExchange, you up vote people with the answers that you find useful, and you down vote answers that are misleading. :)
score: 0

ondraw
type: Tag
tags question: http://stackoverflow.com/q/22690113
tag name: ondraw
tags question: http://stackoverflow.com/q/22791677
tags question: http://stackoverflow.com/q/22662666

http://stackoverflow.com/comment/76912318
type: Comment
comment on: http://stackoverflow.com/a/22737093
has text: Well, instead of hard coded values you can use properties, that depend on border pane boundaries.
score: 0
type: AnswerComment

http://stackoverflow.com/q/22795669
has comment: http://stackoverflow.com/comment/34761344
answer count: 2
has answer: http://stackoverflow.com/a/22803296
has comment: http://stackoverflow.com/comment/34760660
tagged with: applet
has comment: http://stackoverflow.com/comment/34761183
has comment: http://stackoverflow.com/comment/34768105
has comment: http://stackoverflow.com/comment/34768451
score: 0
tagged with: exception
has comment: http://stackoverflow.com/comment/34759726
has answer: http://stackoverflow.com/a/22797169
has title: ExceptionInInitializerError, how to pinpoint error location
has body: Ive been given the ExceptionInInitializerError. Ive been told the "getException() method is now known as the cause, and may be accessed via the Throwable.getCause() method, as well as the aforementioned "legacy method."" Call getCause()" How do I apply these methods to my code to find the error? For instance, do I just put it at the beginning of my classes? Surround with a try catch? Is there an example I could see? Thanks, EDIT: okay here is the entire error log: CacheEntry[file:/C:/Users/Camtronius/Documents/NetBeansProjects/SonomaRoller/build/classes/sonomaroller/SonomaRoller.jar]: updateAvailable=false,lastModified=Sat Mar 22 11:39:02 PDT 2014,length=225068 0 CacheEntry[file:/C:/Users/Camtronius/Documents/NetBeansProjects/SonomaRoller/build/classes/sonomaroller/SonomaRoller.jar]: updateAvailable=false,lastModified=Sat Mar 22 11:39:02 PDT 2014,length=225068 Trace level set to 5: all ... completed.ui: Pushing modality for applet ID 14 with dialog sun.plugin.util.PluginSysUtil$DummyDialog[dialog0,-100,-100,132x38,layout=java.awt.BorderLayout,APPLICATION_MODAL,title=,defaultCloseOperation=HIDE_ON_CLOSE,rootPane=javax.swing.JRootPane[,3,25,126x10,layout=javax.swing.JRootPane$RootLayout,alignmentX=0.0,alignmentY=0.0,border=,flags=16777673,maximumSize=,minimumSize=,preferredSize=],rootPaneCheckingEnabled=true] basic: Dialog type is not candidate for embedding ui: Pushing modality for applet ID 14 with dialog javax.swing.JDialog[dialog1,425,258,516x190,layout=java.awt.BorderLayout,TOOLKIT_MODAL,title=Application Error,defaultCloseOperation=HIDE_ON_CLOSE,rootPane=javax.swing.JRootPane[,3,25,510x162,layout=javax.swing.JRootPane$RootLayout,alignmentX=0.0,alignmentY=0.0,border=,flags=16777673,maximumSize=,minimumSize=,preferredSize=],rootPaneCheckingEnabled=true] basic: PluginMain.unregisterApplet: 14 from mananger sun.plugin2.applet.Applet2Manager@1d9024f preloader: Construct preloader delegate preloader: Setting default preloader and progress monitor for non JNLP applets …
tagged with: netbeans
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/34760792
tagged with: swing
has comment: http://stackoverflow.com/comment/34760691
has comment: http://stackoverflow.com/comment/34768501
has comment: http://stackoverflow.com/comment/34761153
tagged with: java
has comment: http://stackoverflow.com/comment/34761203
has comment: http://stackoverflow.com/comment/34759733
type: Question

http://stackoverflow.com/comment/34699500
comment on: http://stackoverflow.com/a/22762048
score: 0
type: Comment
has text: But I don't know the size of the String result[], I mean, if I use this I have to give to it a size and I don't know what size is it, isn't it?
type: AnswerComment

http://stackoverflow.com/comment/34569489
type: Comment
comment on: http://stackoverflow.com/q/22680433
has text: Have you tried running it? The program looks correct to me.
type: QuestionComment
score: 0

http://stackoverflow.com/q/22666848
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/22667521
tagged with: java
has answer: http://stackoverflow.com/a/22667531
has answer: http://stackoverflow.com/a/22667463
has title: Java hardcode string object from database
type: Question
possible better answer: http://stackoverflow.com/a/22667521
score: 0
answer count: 3
accepted answer: http://stackoverflow.com/a/22667463
has body: basically I have a object from the databsae that I'm setting to a string and passing to a webservice. This works fine. However I want to hardcode that string in a class from the database to do some unit testing. Problem is...the string has ""'s in certain places that is necessary in the WS. I know I can manually change all these to ''s then enclose the whole string in "", but is there a utility that will do that for me? string test = { "testMap": { "test1": "", "test2": "blah", } }

http://stackoverflow.com/q/22790368
has comment: http://stackoverflow.com/comment/34753545
has comment: http://stackoverflow.com/comment/34750151
has body: I am getting an error when trying to run my code in Java. I am trying to run an output to a file where the user uses dialog boxes to input name, pay rate, and hours worked. This is the code I have: package output.to.a.file.broc.east; import javax.swing.JOptionPane; public class OutputToAFileBrocEast { public static void main(String[] args) { OutputFile payFile; payFile = new OutputFile ("payroll.txt"); String name; String rate; String hours; String answer; do { int number1; int number2; name = JOptionPane.showInputDialog("Enter first and last name: "); rate = JOptionPane.showInputDialog("Enter hourly rate: "); hours = JOptionPane.showInputDialog("Enter hours for previous week: "); number1 = Integer.parseInt (rate); number2 = Integer.parseInt (hours); payFile.writeWord(name); payFile.writeWord(rate); payFile.writeWord(hours); payFile.writeEOL(); answer = JOptionPane.showInputDialog("Do you have another employee? [y/n"); } while (answer.equalsIgnoreCase ("yes")); } } But I get this error when trying to run the code: Error: Could not find or load main class output.to.a.file.broc.east.OutputToAFileBrocEast Java Result: 1 I am using Netbeans 7.4. and I have already attempted to delete the netbeans cache.
tagged with: java
linked to: http://stackoverflow.com/q/18814602
type: Question
has comment: http://stackoverflow.com/comment/34752778
answer count: 1
has comment: http://stackoverflow.com/comment/34750120
score: 0
has title: Netbeans error when trying to run java project
has comment: http://stackoverflow.com/comment/62266153
has answer: http://stackoverflow.com/a/22790752
tagged with: netbeans
type: UnansweredQuestion

http://stackoverflow.com/a/22742912
answers question: http://stackoverflow.com/q/22742617
type: Answer
score: 2
upvote count: 2
has body: You are attempting to write to the same file object from multiple threads. When you seek() or write() it has only one view of where this is being performed. If you want to write in different places to the same at once, each thread must have it's own RandomAccessFile object even if they all point to the same underlying file. BTW: Changing the thread priority of an IO bound process is likely to do very little (and nothing unless you are an administrator)
has comment: http://stackoverflow.com/comment/34664861
has comment: http://stackoverflow.com/comment/34669778
accepted answer of: http://stackoverflow.com/q/22742617
type: AcceptedAnswer
downvote count: 0

http://stackoverflow.com/q/22797271
has comment: http://stackoverflow.com/comment/34762890
has answer: http://stackoverflow.com/a/22797321
tagged with: tcp
tagged with: java
type: Question
tagged with: network-programming
score: 0
answer count: 2
tagged with: udp
has answer: http://stackoverflow.com/a/25089551
has body: I want to create a communications server that all the clients can connect to. The only problem I'm having is deciding whether to use TCP or UDP. I want to be able to handle hundreds of clients at once (500 - 1000) and each one would have their own thread to handle them. Would either TCP or UDP be able to do this and if so which one would be suit my needs? If anyone has any ideas on a better way to handle lots of clients please let me know. Thanks. EDIT: The server would basically be a message communication server. So all the game servers (clients) could send a message to it and it would broadcast it to all the other game servers (clients). I would want all message deliveries to be as reliable as possible.
has comment: http://stackoverflow.com/comment/39040523
has title: Handling Lots of Clients: UDP or TCP?
type: UnansweredQuestion

http://stackoverflow.com/comment/35068640
type: Comment
has text: Yes Cruncher, you are right. But this was kind of exercise.
comment on: http://stackoverflow.com/a/22788416
type: AnswerComment
score: 0

http://stackoverflow.com/q/22753962
type: Question
score: -2
tagged with: eclipse
has answer: http://stackoverflow.com/a/22753975
has comment: http://stackoverflow.com/comment/34684713
has title: Eclipse - Syntax error, insert "EnumBody" to complete CompilationUnit
upvote count: 0
linked to: http://stackoverflow.com/q/4646577
answer count: 1
has body: I have only one line that's declaring a variable. Yet it's giving me problems, so far, I have tried: remaking the project, making sure it is an Android Application Project deleting everything but that line, that's why there's only one line referring to the package (really out of ideas) Yet, I'm getting: Syntax error, insert "EnumBody" to complete CompilationUnit With two variables declared I get on the previously declared variables: Syntax error on tokens, delete these tokens
favorite count: 0
has comment: http://stackoverflow.com/comment/34684683
downvote count: 2
accepted answer: http://stackoverflow.com/a/22753975
has comment: http://stackoverflow.com/comment/34684902
type: AnsweredQuestion
tagged with: java

http://stackoverflow.com/comment/34576374
comment on: http://stackoverflow.com/q/22692763
score: 0
type: Comment
type: QuestionComment
has text: Did you try to send cookies via http headers by Java-WebSocket's `WebSocketClient` class using `WebSocketClient( URI serverUri , Draft protocolDraft , Map<String,String> httpHeaders , int connectTimeout)` constructor?

http://stackoverflow.com/q/22687758
has comment: http://stackoverflow.com/comment/34565929
accepted answer: http://stackoverflow.com/a/22709432
linked to: http://stackoverflow.com/q/21478791
downvote count: 0
tagged with: url
favorite count: 0
possible better answer: http://stackoverflow.com/a/22688036
has comment: http://stackoverflow.com/comment/34604537
type: AnsweredQuestion
score: 2
has body: Here is my code: &lt;s:iterator value="ChapterTreeList" id="chapterTree"&gt; ... &lt;s:url id="deployChaptersUrl" action="ajaxDeployChapter" includeContext="false"&gt; &lt;s:param name="nodeId" value="%{#chapterTree.nodeId}"/&gt; &lt;/s:url&gt; &lt;s:form id="deployChapters%{#chapterTree.nodeId}" action="%{deployChapterUrl}" theme="simple" method="POST"&gt; &lt;/s:form&gt; ... &lt;/s:iterator&gt; I expect multiple forms like this one below: &lt;form id="deployChapters27623" name="deployChapters27623" action="/path/to/ajaxDeployChapter.action?nodeId=27623" &lt;-- nodeId here method="POST"&gt; &lt;/form&gt; But instead I get forms like this: &lt;form id="deployChapters27623" name="deployChapters27623" action="/path/to/ajaxDeployChapter.action" &lt;-- nodeId is missing here method="POST"&gt; &lt;/form&gt; Struts 2.3.15.1
upvote count: 2
tagged with: java
has comment: http://stackoverflow.com/comment/34565521
has answer: http://stackoverflow.com/a/22709432
has answer: http://stackoverflow.com/a/22687997
type: Question
tagged with: param
has comment: http://stackoverflow.com/comment/34565345
tagged with: struts2
has comment: http://stackoverflow.com/comment/34604266
answer count: 3
has title: Why is my param value missing in generated URL?
has answer: http://stackoverflow.com/a/22688036

http://stackoverflow.com/comment/34671987
type: QuestionComment
comment on: http://stackoverflow.com/q/22747035
score: 2
type: Comment
has text: Please post the whole method

http://stackoverflow.com/a/22711019
has body: I think the problem with this working for 2 characters is because getText() method returns not updated value, i.e. it returns the value BEFORE the change. What you need to do is somehow update that value before you compare it to empty string. You may need to investigate KeyEvent to see if user adds another character or is it e.g. backspace...
answers question: http://stackoverflow.com/q/22710607
score: 0
type: Answer

http://stackoverflow.com/comment/34779572
comment on: http://stackoverflow.com/q/22806661
has text: The Arraylist can take various `Object[]` of varying lengths. Isn't this the advantage here? Why do you want to restrict that by fixing the size of each `Object[]` as the same.
type: Comment
type: QuestionComment
score: 1

http://stackoverflow.com/comment/34717972
type: AnswerComment
has text: @user3482500 That code doesn't match your original pasted code. You are calling `feed()` there with no parameters, but as far as I can tell, this is the first mention of such a method. The only `feed(...)` I see you have so far is one that takes an `int`. Please check to make sure your posted code is an accurate representation of what you are actually doing.
type: Comment
comment on: http://stackoverflow.com/a/22770975
score: 0

http://stackoverflow.com/q/22726696
has title: How To Capture Http Packets in LAN
score: 0
tagged with: winpcap
has body: Well I m working on Java project.in order to make an application that will capture all packets in my lan , and be able to see HTTP traffics . I m currently using Jnetpcap API , i succeed listing interface and do a live capture and extract HTTP PACKETS . the problem I m having is I only Capture traffic of my own machine . I have already look up about this in google . the only solution I have found so far is to enable promiscuous mode , i did that using ifconfig cmd , unfortunately the problem remains . I don't how to solve that . any solutions ..??
accepted answer: http://stackoverflow.com/a/22775731
tagged with: jnetpcap
tagged with: http
type: Question
has answer: http://stackoverflow.com/a/22775731
type: AnsweredQuestion
tagged with: java
possible better answer: http://stackoverflow.com/a/22775665
has answer: http://stackoverflow.com/a/22775665
answer count: 2
tagged with: libpcap

http://stackoverflow.com/comment/34546573
type: QuestionComment
type: Comment
score: 0
comment on: http://stackoverflow.com/q/22677123
has text: I believe I can modify the list during printing.

http://stackoverflow.com/comment/34664611
comment on: http://stackoverflow.com/a/22742858
type: AnswerComment
score: 0
type: Comment
has text: @Balamory You are replacing your main thread with one you just started. You could just have your main method call a method in FileWatcher.

http://stackoverflow.com/comment/73451025
type: AnswerComment
score: 0
has text: @chris You're confusing types and variables. The `Integer` type was meant to model an integer value, which cannot change. The fact that a variable can be reassigned to a new value is what's _irrelevant_.
type: Comment
comment on: http://stackoverflow.com/a/22793630

http://stackoverflow.com/comment/34781599
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/22807407
score: 0
has text: @MadProgrammer That looks like what I'm looking for. I'll give it a try and report back. Thanks!

http://stackoverflow.com/a/22673647
has body: ORMs sometimes have a rather unique view on how to translate their query language to SQL, which may lead to various issues ranging from slow queries to odd or absent results. Therefore I'd advise you to activate the query log (see here or here), that will be the SQL that actually gets sent to the server.
has comment: http://stackoverflow.com/comment/34540402
type: Answer
score: 0
upvote count: 1
downvote count: 1
answers question: http://stackoverflow.com/q/22673588
has comment: http://stackoverflow.com/comment/34540507

http://stackoverflow.com/comment/34727122
has text: @user3473227 check my answer now, will fix your issue
comment on: http://stackoverflow.com/q/22776968
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/q/22772224
has answer: http://stackoverflow.com/a/22772289
has body: decHungry() decreases hungry by 10 and incEnergy() increases energy by 10. I would like to make sure it does not go past 0 in hungry levels to negative numbers and does not go above 100 in energy levels. How do I do that? protected void feed() { System.out.println("\nEating..."); if (hungry &lt;= 90 &amp;&amp; hungry &gt;= 0) { decHungry(); incEnergy(); System.out.println("I've just ate dumplings, my current energy state is " + energy + " and hungry state is " + hungry); } else { System.out.println ("I have ate enough!"); } }
tagged with: java
tagged with: methods
has answer: http://stackoverflow.com/a/22772373
type: Question
tagged with: if-statement
has answer: http://stackoverflow.com/a/22772266
score: 0
answer count: 3
upvote count: 1
downvote count: 1
favorite count: 0
has title: feed method java if-statement
type: UnansweredQuestion

http://stackoverflow.com/a/22658210
score: 0
type: Answer
has body: You can assign it directly in the attribute definition: public class Example{ private String env = "IN"; public String getEnv() { return env; } public void setEnv(String env) { this.env = env; } }
answers question: http://stackoverflow.com/q/22658131

http://stackoverflow.com/comment/34781805
comment on: http://stackoverflow.com/q/22802353
type: QuestionComment
score: 0
has text: did u get the answer? as Himani Agarwal mentioned you can use json parser for this.
type: Comment

http://stackoverflow.com/q/22751423
has answer: http://stackoverflow.com/a/35788753
possible better answer: http://stackoverflow.com/a/22789676
score: 0
has answer: http://stackoverflow.com/a/22789676
tagged with: geolocation
answer count: 3
has title: Twitter - Query for tweets within a radius of a particular GeoLocation
linked to: http://stackoverflow.com/q/70921122
tagged with: twitter4j
tagged with: java
tagged with: twitter
has body: I am trying to form a query to the Twitter REST API. Is there a way to pass gps coordinates into the query and return tweets that are in a particular radius of that location.
has answer: http://stackoverflow.com/a/22842111
tagged with: jersey
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/22842111
type: Question

http://stackoverflow.com/comment/34692710
comment on: http://stackoverflow.com/a/22758183
score: 0
type: Comment
has text: Well, you could add `@SuppressWarnings("unchecked")` which will hide the warning.
type: AnswerComment

http://stackoverflow.com/a/22774847
score: 0
answers question: http://stackoverflow.com/q/22774806
downvote count: 1
type: Answer
has comment: http://stackoverflow.com/comment/34722586
has comment: http://stackoverflow.com/comment/34722636
has comment: http://stackoverflow.com/comment/34722813
has body: Yes. NOTE: The rest is background knowledge about ArrayLists. Let's say you want an ArrayList of Strings. Keep in mind Strings are Objects. // Creates ArrayList ArrayList&lt;String&gt; list = ArrayList&lt;String&gt;(); // Adds elements to ArrayList list.add("Hello"); list.add("world!"); // Iterate through ArrayList for (String str : list) { // Print the String in the list. System.out.print(str + " "); } // Print newline character. System.out.print("\n"); The for (String str : list) is a for each loop which allows you to iterate through each element in the list.
has comment: http://stackoverflow.com/comment/34722860
has comment: http://stackoverflow.com/comment/34722652
has comment: http://stackoverflow.com/comment/34722611
has comment: http://stackoverflow.com/comment/34722605
upvote count: 1

http://stackoverflow.com/comment/34745809
has text: What's being returned if there is no bike in `bikes`?
comment on: http://stackoverflow.com/q/22788007
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/q/22747601
type: Question
has answer: http://stackoverflow.com/a/22747674
tagged with: java
has title: Do I need to synchronize in this situation
tagged with: listview
accepted answer: http://stackoverflow.com/a/22747707
downvote count: 0
score: 1
favorite count: 0
has answer: http://stackoverflow.com/a/22748082
answer count: 3
tagged with: android
has body: i'm making Android application. I have a class in which I get some orders every 30 seconds from database like this: public class OrderScheduler { private List&lt;OrderMain&gt; orders = Collections.synchronizedList( new ArrayList&lt;OrderMain&gt;()); ... private void main() { service.scheduleAtFixedRate(new Runnable() { public void run() { orders = getStuff(); } }, 0, 30, TimeUnit.SECONDS); } } Then there is an Activity class in which i create ListView with objects from above list like this: newOrdersListView = (ListView) findViewById(R.id.newOrdersListView); OrderScheduler os = OrderScheduler.getInstance(); List&lt;OrderMain&gt; newOrders = (os.getOrders() == null) ? new ArrayList&lt;OrderMain&gt;() : os.getOrders(); ArrayAdapter&lt;OrderMain&gt; listAdapter = new ArrayAdapter&lt;OrderMain&gt;( this, R.layout.listview_row, newOrders); newOrdersListView.setAdapter(listAdapter); I read in javadoc when iterating over synchronized list i need to synchronize on it. My question is when i click on some item of this listview, does the onItemClick method need to be in synchronized block ? I thought that when i choose some item from listview it basicly needs to iterate over the newOrders list. By the way right now i don't synchronize this listener method and it seems to work. I dont create any more threads than the one in OrderScheduler in this application. Thanks for some help.
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/22747707
tagged with: multithreading
upvote count: 1
possible better answer: http://stackoverflow.com/a/22747674

http://stackoverflow.com/comment/34766785
has text: Are you running the same class or you have another class with same name without main method
comment on: http://stackoverflow.com/q/22799317
type: Comment
type: QuestionComment
score: 0

http://stackoverflow.com/comment/34848496
has text: Or did you mean: `@Email private String email`?
comment on: http://stackoverflow.com/q/22795531
type: Comment
type: QuestionComment
score: 0

http://stackoverflow.com/comment/34629823
score: 0
type: Comment
has text: @HovercraftFullOfEels How??? Can you show me a piece of code??
type: QuestionComment
comment on: http://stackoverflow.com/q/22723136

http://stackoverflow.com/q/22747033
has body: From here: http://functionaljava.googlecode.com/svn/artifacts/3.0/demo/bgga/Option_filter.java Q: Ho would I compile this example? If no way: What the purpose to put now working examples? import fj.data.Option; import static fj.data.Option.none; import static fj.data.Option.some; import static fj.Show.intShow; import static fj.Show.optionShow; public final class Option_filter { public static void main(final String[] args) { final Option&lt;Integer&gt; o1 = some(7); final Option&lt;Integer&gt; o2 = none(); final Option&lt;Integer&gt; o3 = some(8); final Option&lt;Integer&gt; p1 = o1.filter({int i =&gt; i % 2 == 0}); final Option&lt;Integer&gt; p2 = o2.filter({int i =&gt; i % 2 == 0}); final Option&lt;Integer&gt; p3 = o3.filter({int i =&gt; i % 2 == 0}); optionShow(intShow).println(p1); // None optionShow(intShow).println(p2); // None optionShow(intShow).println(p3); // Some(8) } } I don't see any chance for Java (5-7) compile this, for example: filter({int i =&gt; i % 2 == 0});
type: UnansweredQuestion
has title: Functionaljava compilation errors
tagged with: java
tagged with: functional-java
type: Question
has answer: http://stackoverflow.com/a/25418007
score: 0
has comment: http://stackoverflow.com/comment/34672041
answer count: 1

runnable
tags question: http://stackoverflow.com/q/22666491
type: Tag
tags question: http://stackoverflow.com/q/22723506
tags question: http://stackoverflow.com/q/22685103
tags question: http://stackoverflow.com/q/22728932
tags question: http://stackoverflow.com/q/22690009
tags question: http://stackoverflow.com/q/22650465
tags question: http://stackoverflow.com/q/22750300
tags question: http://stackoverflow.com/q/22780739
tags question: http://stackoverflow.com/q/22723599
tag name: runnable
tags question: http://stackoverflow.com/q/22754143
tags question: http://stackoverflow.com/q/22800319

http://stackoverflow.com/a/22800926
has comment: http://stackoverflow.com/comment/34769436
downvote count: 0
has body: How do I go about using UIManager to change the background color of a JFormattedTextField? You have to set this property FormattedTextField.background as found here Nimbus Defaults Something like this UIManager.put("FormattedTextField.background", Color.RED);
accepted answer of: http://stackoverflow.com/q/22800817
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/34769346
type: Answer
answers question: http://stackoverflow.com/q/22800817
score: 3
upvote count: 3

http://stackoverflow.com/comment/34727825
type: Comment
comment on: http://stackoverflow.com/q/22777880
type: QuestionComment
score: 0
has text: Oh, i think I get it. Each call to the recursive method checks to se if the next number in the array is larger than the previous one. And at the end it will return the largest. Is that right?

http://stackoverflow.com/q/22650528
has answer: http://stackoverflow.com/a/22656270
has title: Create your own gazetteer list
possible better answer: http://stackoverflow.com/a/25180493
has answer: http://stackoverflow.com/a/25180493
tagged with: nlp
type: AnsweredQuestion
upvote count: 3
tagged with: gate
accepted answer: http://stackoverflow.com/a/22656270
type: Question
score: 3
tagged with: java
answer count: 2
downvote count: 0
has body: I am new to Natural Language Processing and GATE.Currently I'm learning to use GATE / ANNIE . ANNIE's default gazetteer lists are great, but obviously they don't provide lists for everything. I need to create a list of characters in a story book. Creating lists and adding entries to each and every list from GATE Gazetteer Editor (as mentioned in Gate manual 13.2.2) or using a text editor does not seem to be practicable .So anyone knows a method to create our own gazetteer lists other than,creating/editing directly through GATE or using a text editor?
favorite count: 0

http://stackoverflow.com/comment/34684456
type: Comment
type: QuestionComment
has text: split method returns String array. `String splited[] = phrase.split(" ");`
comment on: http://stackoverflow.com/q/22753660
score: 0

http://stackoverflow.com/q/22753866
has body: Error occurred when run an java-thymeleaf-maven-spring application Here am using tomcat7. Here show steps Download project from git-hub mvn clean install shows Build Success mvn tomcat:deploy Build Failure and shows error [ERROR] Failed to execute goal org.codehaus.mojo:tomcat-maven-plugin:1.1:deploy (default-cli) on project spring-mvc-thymeleaf: Cannot invoke Tomcat manager: Server returned HTTP response code: 403 for URL: http://localhost:8080/manager/deploy?path=%2Fspring-mvc-thymeleaf&war= -> [Help 1] Here download many programs all of them shows this problem the one of the programs pom.xml file show here 4.0.0 net.exacode.bootstrap spring-mvc-thymeleaf war spring-mvc-thymeleaf 0.0.1-SNAPSHOT <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> <maven.compiler.source>1.7</maven.compiler.source> <maven.compiler.target>1.7</maven.compiler.target> <spring.version>3.1.0.RELEASE</spring.version> <slf4j.version>1.6.4</slf4j.version> <spring.profiles.active>development</spring.profiles.active> ch.qos.logback logback-classic 1.0.1 org.slf4j slf4j-api org.slf4j slf4j-api ${slf4j.version} org.slf4j jcl-over-slf4j ${slf4j.version} org.thymeleaf thymeleaf-spring3 2.0.13 org.springframework spring-core ${spring.version} org.springframework spring-web ${spring.version} org.springframework spring-webmvc ${spring.version} org.hibernate hibernate-validator 4.3.1.Final nz.net.ultraq.web.thymeleaf thymeleaf-layout-dialect 1.0.5 javax.servlet javax.servlet-api 3.0.1 provided cglib cglib 2.2.2 src/main/resources true and the link of the program https://github.com/mendlik/spring-mvc-thymeleaf I search with this error on google but I can't find any problem with programs side. tomcat users file shows, <role rolename="tomcat"/> <role rolename="role1"/> <user username="tomcat" password="tomcat" roles="tomcat"/> <user username="both" password="tomcat" roles="tomcat,role1"/> <user username="role1" password="tomcat" roles="role1"/>
type: AnsweredQuestion
tagged with: java
type: Question
has title: How to Change Error Cannot invoke Tomcat manager: Server returned HTTP response code: 403
score: 0
answer count: 1
tagged with: tomcat
has answer: http://stackoverflow.com/a/22756006
accepted answer: http://stackoverflow.com/a/22756006
tagged with: maven
tagged with: spring
tagged with: spring-mvc

http://stackoverflow.com/comment/34690994
type: Comment
has text: I have now something like this public void actionPerformed(ActionEvent e) { if (depth == 0) { } else { int xNew = x + (int) (Math.cos(Math.toRadians(angle)) * depth * 10.0); int yNew = y + (int) (Math.sin(Math.toRadians(angle)) * depth * 10.0); repaint(); } } Sorry but how can I use the Timer to make it work? Im a newbie with this, ive edited my post
score: 0
comment on: http://stackoverflow.com/a/22756729
type: AnswerComment

http://stackoverflow.com/q/22738021
score: 0
tagged with: while-loop
answer count: 4
has title: Accessing a while-loop created array outside of the loop
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/22738098
has answer: http://stackoverflow.com/a/22738102
tagged with: java
has body: I am creating an array using a while loop. (For reasons why I am creating an array this way, go to https://www.cia.gov/library/publications/the-world-factbook/rankorder/rawdata_2151.txt) Though once my array (data) is created inside the while loop, I cannot access it outside of the while loop. I was hoping to make it so the user could put in the name of a country, say India, and get the number of mobile users in that country. String address = "https://www.cia.gov/library/publications/the-world-factbook/rankorder/rawdata_2151.txt"; URL pageLocation = new URL(address); Scanner in1 = new Scanner(pageLocation.openStream()); Scanner in = new Scanner(System.in); String line; System.out.print("Please enter the name of the country you would like to see the mobile users for: "); String country = in.next(); while (in1.hasNextLine()){ line = in1.nextLine(); String[] data = line.split("\t"); if (data[1].contains(country) == true){ System.out.println("Country name: " + data[1]); System.out.println("Mobile phone subscribers: " + data[2]); return; } else{ System.out.println("No country found with that name!"); return; } } The input works if it is inside the loop, but will only work with China because it is the first country in the list. I understand why it is not working correctly, thought I'm unsure how to fix it other than putting the if statement outside of the loop, but if I do that, the statement cannot reach my array. Any suggestions?
has answer: http://stackoverflow.com/a/22738110
type: Question
possible better answer: http://stackoverflow.com/a/22738154
has answer: http://stackoverflow.com/a/22738154
accepted answer: http://stackoverflow.com/a/22738102

http://stackoverflow.com/q/22718001
answer count: 1
has comment: http://stackoverflow.com/comment/34620268
score: 0
tagged with: while-loop
linked to: http://stackoverflow.com/q/513832
tagged with: break
tagged with: java.util.scanner
type: UnansweredQuestion
type: Question
has comment: http://stackoverflow.com/comment/34620539
tagged with: if-statement
tagged with: java
duplicate of: http://stackoverflow.com/q/513832
has body: Below is my code, basically what I want the program to do is loop the while statement every time the enter key is hit, and then when "q" is submitted to the console, I want the program to end. What did I do wrong? With this code, it only runs once, and if i change if (moreEmps != "q") break; to if (moreEmps == "q") break; then it will continue no matter what is entered. can someone steer me in the right direction? Thanks! import java.text.NumberFormat; java.util.Scanner; /** * Input a number of hours and calculate the pay at $10.00 per hour * Pay time and one half for any hours over 40. */ public class PayCalc { public static void main (String[] args) { // Declare constants to be used in payroll calculation final double RATE = 10.00; // hourly rate final int REGULAR_HOURS = 40; // hours paid at regular rate double pay = 0.0; Scanner input = new Scanner (System.in); System.out.println("Employee Payroll Program"); System.out.println("Press enter to begin."); String moreEmps = ""; while (moreEmps != input.nextLine()) { System.out.print("Enter employee name: "); String employee = input.next(); System.out.print("Enter hours worked: "); int hours = input.nextInt(); if (hours &gt; REGULAR_HOURS) pay = RATE * REGULAR_HOURS + (hours - REGULAR_HOURS) * RATE * 1.5; else pay = hours * RATE; NumberFormat formit = NumberFormat.getCurrencyInstance(); System.out.println(); System.out.print("Total Pay for "); System.out.print(employee); System.out.println(" : " + formit.format(pay)); System.out.println("Any more employees?"); System.out.println("Press enter to input another employee's information, or q to quit."); moreEmps = input.next(); moreEmps.toLowerCase(); if (moreEmps != "q") break; } } }
has title: While statement ends no matter what the input is
has answer: http://stackoverflow.com/a/22718039

http://stackoverflow.com/a/22736352
has body: Here I am sharing you a nice Client Server Authentication Application having one server that is communicating with multiple clients using TCP protocol as per your requirement. Answer: Here each client is connected in a separate thread from server and that thread contains all the information about the client. It will solve your concurrency problem. See inline comments for more clarification. Note: replace host name in LiveChatClient.java file before running this program at port no 1234 Steps to run the program: First run LiveChatServer only for single time Then run LiveChatClient for multiple clients as many as you want to add Here is one more sample in the same context. Please have a look at Java Server with Multiclient communication. Opcode.java: Operation code that is used to set a client-server communication protocol /**************** an interface to define different operation code **************/ public interface Opcode { int CLIENT_USERNAME = 1; int CLIENT_INVALID_USERNAME = 2; int CLIENT_PASSWORD = 3; int CLIENT_INVALID_PASSWORD = 4; int CLIENT_CONNECTED = 5; } LiveChatServer.java: Single server that is controlling multiple clients /************************ Live Chat Server *******************/ import java.io.IOException; import java.net.InetAddress; import java.net.ServerSocket; import java.net.Socket; import java.util.HashMap; import java.util.LinkedHashMap; public class LiveChatServer { // Connection state info private static LinkedHashMap&lt;String, ClientThread&gt; clientInfo = new LinkedHashMap&lt;String, ClientThread&gt;(); // TCP Components private ServerSocket serverSocket; // Main Constructor public LiveChatServer() { startServer();// start the server } public void startServer() { String port = "1234"; try { // in constractor we are passing port no, back log and bind address whick will be local // host // port no - the specified port, or 0 to use any free port. // backlog - the maximum length of the queue. use default if it is equal or less than 0 //…
has comment: http://stackoverflow.com/comment/34659862
score: 6
has comment: http://stackoverflow.com/comment/34659990
has comment: http://stackoverflow.com/comment/34658974
has comment: http://stackoverflow.com/comment/34660364
has comment: http://stackoverflow.com/comment/34660680
has comment: http://stackoverflow.com/comment/34660717
has comment: http://stackoverflow.com/comment/34660661
upvote count: 6
has comment: http://stackoverflow.com/comment/34660621
has comment: http://stackoverflow.com/comment/34659887
has comment: http://stackoverflow.com/comment/34660690
answers question: http://stackoverflow.com/q/22732835
has comment: http://stackoverflow.com/comment/34660333
downvote count: 0
has comment: http://stackoverflow.com/comment/34660382
has comment: http://stackoverflow.com/comment/34664826
type: Answer
has comment: http://stackoverflow.com/comment/34659694

http://stackoverflow.com/a/22743315
type: Answer
has comment: http://stackoverflow.com/comment/34665217
has body: In Java, interfaces can only declare methods. The Comparable interface declares the compareTo method. So: temporary.compareTo(left)
has comment: http://stackoverflow.com/comment/34665178
score: 0
answers question: http://stackoverflow.com/q/22743294

http://stackoverflow.com/q/22720643
has comment: http://stackoverflow.com/comment/34625324
tagged with: c++
answer count: 0
tagged with: java
type: Question
has comment: http://stackoverflow.com/comment/34625508
tagged with: arrays
has comment: http://stackoverflow.com/comment/34625267
score: 0
has comment: http://stackoverflow.com/comment/34625306
has title: java: println(new String(byte[] b) ) equivalent in C++
has body: I'm kind-of converting a program from Java to C++. In Java I read an InputStream using a byte array, say b. Than I need to print the ASCII characters so I use new String(b). Now, I want to do something similar with C++; I read a stream and put my data in an unsigned char array, but when I print it I get many strange symbols that, instead, are not shown in Java Thank for helping
tagged with: string
type: UnansweredQuestion

http://stackoverflow.com/q/22706327
score: -1
tagged with: weka
answer count: 1
favorite count: 0
has answer: http://stackoverflow.com/a/22731841
type: UnansweredQuestion
has title: Name the clusters based on an attribute in kmeans algorithm
has comment: http://stackoverflow.com/comment/34603888
has body: I'm using the kmeans algorithm to classify my instances into different groups. I wrote a simple code in java that takes in the arff file and each instance is classified into a different cluster, where the number of clusters is given by me initially. My output is generated in this format: Instance 0-&gt; Cluster 1 Instance 1-&gt; Cluster 3 etc Is there any way in which I can give the clusters names based on a single attribute? Suppose my arff file is: @relation links @attribute num1 numeric @attribute num2 numeric @attribute num3 numeric @attribute data string @data 0,0,5,a 1,0,0,b 1,0,0,a 1,1,0,a etc I want my clusters to be formed using these attributes and names based on the data attribute So output should be: Instance 0-. cluster a Instance 1-&gt; cluster b Any ideas on how this can be done?
has comment: http://stackoverflow.com/comment/34599254
tagged with: java
downvote count: 1
type: Question
has comment: http://stackoverflow.com/comment/34599625
upvote count: 0
tagged with: k-means
tagged with: cluster-analysis
has comment: http://stackoverflow.com/comment/34603254

http://stackoverflow.com/comment/34547305
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/22677637
has text: Did you check all things mentioned in the error? Can you connect with SQL Server authenticatin?

http://stackoverflow.com/q/22713078
linked to: http://stackoverflow.com/q/299495
has title: How to set background image for JPanel in netbeans?
tagged with: java
duplicate of: http://stackoverflow.com/q/299495
accepted answer: http://stackoverflow.com/a/22713190
has comment: http://stackoverflow.com/comment/34611058
type: AnsweredQuestion
downvote count: 0
favorite count: 0
type: Question
score: 3
has body: i am using netbeans IDE problem is how to set background image for JPanel without using JLabel. Can anyone tell me how to do this?
upvote count: 3
has answer: http://stackoverflow.com/a/22713190
answer count: 1

http://stackoverflow.com/q/22690490
has body: I have an android dialog with EditText in it. When the user clicks the EditText, the keyboard is opened but the dialog is shrink. The dialog root background is a 9patch I want it to be cut, meaning its corners won't be rounded but square. Now, the user might think the shrink dialog is the dialog full size. I want the keyboard to be laid on the dialog in a way the user will see the dialog is originally larger there are not visible fields. I have tried this on the activity that opens the dialog: mDialog.getWindow().setSoftInputMode( WindowManager.LayoutParams.SOFT_INPUT_ADJUST_PAN); manifest: android:windowSoftInputMode="adjustPan"
downvote count: 0
tagged with: android
answer count: 1
has answer: http://stackoverflow.com/a/22814335
has comment: http://stackoverflow.com/comment/34662029
favorite count: 0
upvote count: 2
type: UnansweredQuestion
tagged with: nine-patch
score: 2
tagged with: android-layout
has comment: http://stackoverflow.com/comment/34662019
tagged with: java
has title: how to apply adjust_pan on 9patch correctly?
has comment: http://stackoverflow.com/comment/34876274
linked to: http://stackoverflow.com/q/22229794
type: Question
has comment: http://stackoverflow.com/comment/34661987
has comment: http://stackoverflow.com/comment/34907664
linked to: http://stackoverflow.com/q/17410499
tagged with: layout

http://stackoverflow.com/comment/34565780
type: Comment
comment on: http://stackoverflow.com/a/22687563
has text: wait now i have a failure instead of an error octopus D:
type: AnswerComment
score: 0

http://stackoverflow.com/q/22679712
has body: Hi I have been trying to map my controller with my jsp but however it is giving an error and displaying an old URL. I have tried cleaning project several times and changed my web.xml also. below is my xml: <?xml version="1.0" encoding="UTF-8"?> Sphibernate login.jsp index.htm index.jsp default.html default.htm default.jsp mvc-dispatcher org.springframework.web.servlet.DispatcherServlet 1 mvc-dispatcher *.htm Below is my Controller class : package com.lnt.controller; import java.util.ArrayList; import java.util.List; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Controller; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMethod; import org.springframework.web.bind.annotation.RequestParam; import org.springframework.web.servlet.ModelAndView; import com.lnt.services.AuthenticateServices; @Controller @RequestMapping("Login.htm") public class LoginController { //@Autowired AuthenticateServices authenticateService = new AuthenticateServices(); @RequestMapping(method=RequestMethod.POST) public ModelAndView processCredentials(HttpServletRequest req, HttpServletResponse res) { String userName =req.getParameter("userName") ; String password = req.getParameter("password"); System.out.println("into login controller"); String message = "Invalid credentials"; List<String> userdetails = new ArrayList<String>(); userdetails = authenticateService.verifyUserNameAndPassword(userName, password); if((userdetails.get(0))!= userName && (userdetails.get(1))!= password ) { message = "welcome" + userName ; } return new ModelAndView("results", "message", message) ; } } Here is my JSP: <%@ page language="java" contentType="text/html; charset=ISO-8859-1" pageEncoding="ISO-8859-1"%> Insert title here While calling my action through jsp i am getting an error : type Status report mess…
has title: Issue with Web.xml for Spring MVC
tagged with: jsp
has comment: http://stackoverflow.com/comment/34551130
score: 0
answer count: 3
has comment: http://stackoverflow.com/comment/34551209
has comment: http://stackoverflow.com/comment/34551779
tagged with: http://stackoverflow.com/tag/xml
possible better answer: http://stackoverflow.com/a/25399805
tagged with: spring
accepted answer: http://stackoverflow.com/a/22680068
tagged with: spring-mvc
type: AnsweredQuestion
tagged with: java
has answer: http://stackoverflow.com/a/50561458
has comment: http://stackoverflow.com/comment/34551544
has answer: http://stackoverflow.com/a/22680068
has comment: http://stackoverflow.com/comment/34550866
type: Question
has answer: http://stackoverflow.com/a/25399805

http://stackoverflow.com/comment/34751943
has text: This is the most correct, it's in the class declaration
score: 0
type: Comment
comment on: http://stackoverflow.com/a/22791439
type: AnswerComment

http://stackoverflow.com/q/22718638
accepted answer: http://stackoverflow.com/a/22719092
answer count: 1
tagged with: minesweeper
has comment: http://stackoverflow.com/comment/34622114
tagged with: java.util.scanner
has title: How to make a scanner in Java that checks if the first letter is a character between A-V and if the second character is a number between 1-20?
tagged with: input
has body: How to make a scanner that checks if the first letter is a character between A-V and if the second character is a number between 1-20? Some examples are: '.B4', 'H10.', '**V1', 'L19*', 'M12', or 'N14'. I'm kind a new to Java. Still learning it in school. I've followed the lessons for about half a year now. Now I've got an assignment for school. It is about creating a text-based minesweeper. I succeeded in printing the board and placing the mines. But now I'm stuck on getting the right input. If you use '*' in the scanner like * B4 or B4* it should mark a square. If you use '.' in the scanner like .B4 or B4. it should unmark a square. And if you enter B4 it should open. But I can't get this done in a neat way. I've tried to make sub-strings of it to check if every character is the right one but after I did that my code was kind of chaotic and it didn't work as supposed to. I've tried it like: "Example 3 : Validating vowels in: Validating input using java.util.Scanner" only I used a variable of the length of my board. So if the board was 10 by 10 it wouldn't go further than J10. But that didn't work either for me. So I was hoping that you could help me solving this problem.
type: AnsweredQuestion
tagged with: java
has answer: http://stackoverflow.com/a/22719092
type: Question
linked to: http://stackoverflow.com/q/3059333
score: 0
has comment: http://stackoverflow.com/comment/34621351
tagged with: validation

http://stackoverflow.com/q/22764175
answer count: 2
has body: I don't find any references in JDK 7 documentation regarding sun.* packages. Is it deprecated. But then what are the substitutes? For eg: sun.reflect.*; is deprecated, so what are the options now? It would be great if someone could post the deprecated packages and the new options available. Note: I succeded in using them by setting access rules to all available. What does this mean?
downvote count: 1
has answer: http://stackoverflow.com/a/22764229
has comment: http://stackoverflow.com/comment/34703461
favorite count: 0
has answer: http://stackoverflow.com/a/22764401
type: UnansweredQuestion
score: 1
has comment: http://stackoverflow.com/comment/34703389
tagged with: java
has title: what happened to sun.* packages
type: Question
upvote count: 2

http://stackoverflow.com/q/22735444
type: Question
has answer: http://stackoverflow.com/a/28531714
accepted answer: http://stackoverflow.com/a/28531714
tagged with: java
downvote count: 0
answer count: 1
favorite count: 0
has comment: http://stackoverflow.com/comment/34652151
tagged with: account
tagged with: privileges
score: 2
type: AnsweredQuestion
has body: Is it possible to create/delete windows user account and set its privileges to make it admin account , simple user account or guest account using java code ?
has comment: http://stackoverflow.com/comment/34670834
upvote count: 2
has title: Creating a Windows user account with java

http://stackoverflow.com/q/22662076
tagged with: java
tagged with: eclipse
type: Question
answer count: 2
possible better answer: http://stackoverflow.com/a/22662423
tagged with: search
has title: Perform Find and Insert in eclipse
score: 0
has answer: http://stackoverflow.com/a/22662356
accepted answer: http://stackoverflow.com/a/22662356
has answer: http://stackoverflow.com/a/22662423
has body: Instead of find and replace i want to perform a find and insert in eclipse. Eg: I want to insert a line say "@myAnnotation" before each line starting with "public static final String". How I can do this? Thanks
type: AnsweredQuestion

http://stackoverflow.com/q/22771399
score: 0
has answer: http://stackoverflow.com/a/22775774
has comment: http://stackoverflow.com/comment/34735374
tagged with: http://stackoverflow.com/tag/zip
type: UnansweredQuestion
has title: java.util.zip.Deflater and GWT
tagged with: gwt
tagged with: java
type: Question
has comment: http://stackoverflow.com/comment/34736036
answer count: 1
has body: Is java.util.zip.Deflater available in GWT 2.6.0? Do I need to do anything special to be able to use it? I get this error message currently when trying to compile as part of running Super Dev Mode: [ERROR] Line 238: No source code is available for type java.util.zip.Deflater; did you forget to inherit a required module?

http://stackoverflow.com/q/22701871
has comment: http://stackoverflow.com/comment/34591625
has answer: http://stackoverflow.com/a/22701961
tagged with: java
possible better answer: http://stackoverflow.com/a/22701948
upvote count: 1
tagged with: inputstream
has answer: http://stackoverflow.com/a/22701948
downvote count: 1
has answer: http://stackoverflow.com/a/22701975
has comment: http://stackoverflow.com/comment/34591502
has comment: http://stackoverflow.com/comment/34591627
type: Question
has comment: http://stackoverflow.com/comment/34591537
has answer: http://stackoverflow.com/a/22701982
score: 0
has title: Not sure why I'm getting red lined here
tagged with: user-interface
has comment: http://stackoverflow.com/comment/34591656
favorite count: 0
has comment: http://stackoverflow.com/comment/34591649
has comment: http://stackoverflow.com/comment/34591651
accepted answer: http://stackoverflow.com/a/22701982
has body: I'm creating something with GUI and binary IO and I'm getting red lined here when using InputStream. I have created a new Object, Buffered and File InputStream as in. when I use in.readUTF, in.readDouble, in.readObject why am I getting red lined? Thanks in advance! public RecordViewerPanel() throws IOException { initComponents(); try{ObjectInputStream in = new ObjectInputStream( new BufferedInputStream( new FileInputStream(filename))); } catch (FileNotFoundException ex) { Logger.getLogger(RecordViewerPanel.class.getName()).log(Level.SEVERE, null, ex); } } private void refreshUI() { SalesAgent sale = (customer.get(curIndex)); firstTextField.setText(sale.getFirst()); lastTextField.setText(sale.getLast()); salesTextField.setText("$" + String.valueOf(sale.getSales())); dateTextField.setText(String.valueOf(sale.getDate())); recordPanel.repaint(); } ArrayList&lt;SalesAgent&gt; salesForce = new ArrayList&lt;SalesAgent&gt;(); String first = in.readUTF(); String last = in.redUTF(); double sales = in.readDouble(); Date date = (Date)(in.readObject());
answer count: 4
type: AnsweredQuestion

http://stackoverflow.com/comment/34561989
type: Comment
has text: Thanks. About (1) I also think I can, but it doesn't seem to work, that is my problem.
type: AnswerComment
comment on: http://stackoverflow.com/a/22686006
score: 0

http://stackoverflow.com/q/22779413
favorite count: 0
tagged with: weak-references
type: UnansweredQuestion
tagged with: lambda
tagged with: java-8
answer count: 4
has comment: http://stackoverflow.com/comment/34754695
has answer: http://stackoverflow.com/a/22779617
tagged with: java
score: 6
tagged with: garbage-collection
has comment: http://stackoverflow.com/comment/34731190
upvote count: 7
downvote count: 1
type: Question
has answer: http://stackoverflow.com/a/63937906
has answer: http://stackoverflow.com/a/22787670
has answer: http://stackoverflow.com/a/22834839
has title: Java 8 lambda weak reference
has body: I create an object called Foo. When I create a lambda or method reference called Action, the Action object holds a reference to Foo. I pass the action to another class. But if I hold it as a weak reference, it gets gc immediately, because no one stores another reference to Action. But if i hold it as a strong reference, the Foo can't be gc, because Action holds a referene to it. So memory leaks happen and I want to prevent it. My question is: how can I hold a reference to Action without preventing gc of Foo. Example: Interface Action { void invoke(); } Class Foo() { public void someMethod() { .... } } Class Holder() { WeakRefrence&lt;Object&gt; foo; public Action action; void register(Object source, Action a) { foo = new WeakReference(source); ??? how can i hold the action without prevent source to gc able. } } main() { Holder holder = new Holder(); Foo foo = new Foo(); Action action = foo::someMethod; holder.register(foo,action); action = null; System.gc(); //only the holder store reference to action. //if i store in holder as weak reference i cannot invoke it any more cause it get gc. //foo = null; //System.gc(); //if i grab action in holder as strong refrence the foo cant be gc cause action hold refernce to it. holder.action.invoke(); }
has comment: http://stackoverflow.com/comment/34773957

http://stackoverflow.com/comment/34661805
type: Comment
score: 0
type: AnswerComment
has text: Sorry I rarely check my email. And yes I have been busy. If you want to set up a chat I have a little bit of time now
comment on: http://stackoverflow.com/a/22741338

http://stackoverflow.com/a/22729636
has body: Based on your description of the problem I believe the code you have provided is executing in the context of an EJB with a container managed transaction in effect. In a Java EE application server the JMS operations will be coordinated by the transaction. That means the send will not in fact complete until the transaction is committed by the container at the end of the EJB method. Although you have set false when creating the Session in a Java EE application server this is ignored and the session will be enrolled in any global transaction in effect. The solution to this problem is to ensure that the JMS send executes with no transaction. To do this the EJB method should be configured with a transaction type of NOT_SUPPORTED.
type: Answer
upvote count: 3
score: 3
has comment: http://stackoverflow.com/comment/34658865
answers question: http://stackoverflow.com/q/22718428
has comment: http://stackoverflow.com/comment/34711133
downvote count: 0

http://stackoverflow.com/comment/34532761
type: Comment
has text: I mean HTML parameter style, it specifies the input. And the rest information is mentioned in my question.
comment on: http://stackoverflow.com/q/22669034
score: 0
type: QuestionComment

http://stackoverflow.com/a/22790137
downvote count: 0
accepted answer of: http://stackoverflow.com/q/22790048
answers question: http://stackoverflow.com/q/22790048
upvote count: 2
has comment: http://stackoverflow.com/comment/34749693
type: AcceptedAnswer
has body: You ask: I wonder if it's possible to draw a line above the image on the same JFrame. Yes it's possible. As with most all Swing graphics, you wouldn't draw directly in the JFrame but rather in the paintComponent(Graphics g) method of an object that is derived from JComponent such as a JPanel that is held by and displayed in your JFrame. Tutorial Link. The details of your solution will all depend on the details of your problem. You ask: So if i draw in two paintComponet i can join the two together? Yep, you could display your image in an ImageIcon held by a JLabel, override JLabel's paintComponent(Graphics g), and draw your lines or whatevers on top of your image. I've got code that does just that somewhere as an answer on this site... will go look. Edit Please check out my answer and code here: repaint() not calling PaintComponent to use Graphics2D.
has comment: http://stackoverflow.com/comment/34749587
type: Answer
score: 2

http://stackoverflow.com/comment/34544336
type: Comment
has text: I had JavaAssist dump the class for me, and it' showing the method implemented.. It's a runtime issue. Is there any easy way to find out which class is causing the issue?
type: AnswerComment
comment on: http://stackoverflow.com/a/22675705
score: 0

arrays
tags question: http://stackoverflow.com/q/22734553
tags question: http://stackoverflow.com/q/22690761
tags question: http://stackoverflow.com/q/22751101
tags question: http://stackoverflow.com/q/22734491
tags question: http://stackoverflow.com/q/22696403
type: Tag
tags question: http://stackoverflow.com/q/22721968
tags question: http://stackoverflow.com/q/22718898
tags question: http://stackoverflow.com/q/22672421
tags question: http://stackoverflow.com/q/22727302
tags question: http://stackoverflow.com/q/22651308
tags question: http://stackoverflow.com/q/22710228
tags question: http://stackoverflow.com/q/22752433
tags question: http://stackoverflow.com/q/22720231
tags question: http://stackoverflow.com/q/22650711
tags question: http://stackoverflow.com/q/22701480
tags question: http://stackoverflow.com/q/22727309
tags question: http://stackoverflow.com/q/22778165
tags question: http://stackoverflow.com/q/22735076
tags question: http://stackoverflow.com/q/22687771
tags question: http://stackoverflow.com/q/22801321
tags question: http://stackoverflow.com/q/22798561
tags question: http://stackoverflow.com/q/22676012
tags question: http://stackoverflow.com/q/22783153
tags question: http://stackoverflow.com/q/22737403
tags question: http://stackoverflow.com/q/22699399
tags question: http://stackoverflow.com/q/22657007
tags question: http://stackoverflow.com/q/22703847
tags question: http://stackoverflow.com/q/22731320
tags question: http://stackoverflow.com/q/22799682
tags question: http://stackoverflow.com/q/22738271
tags question: http://stackoverflow.com/q/22800628
tags question: http://stackoverflow.com/q/22648461
tags question: http://stackoverflow.com/q/22787203
tags question: http://stackoverflow.com/q/22792097
tags question: http://stackoverflow.com/q/22775676
tags question: http://stackoverflow.com/q/22674830
tags question: http://stackoverflow.com/q/22695513
tags question: http://stackoverflow.com/q/22652532
tags question: http://stackoverflow.com/q/22690699
tags question: http://stackoverflow.com/q/22738173
tags question: http://stackoverflow.com/q/22669660
tags question: http://stackoverflow.com/q/22658111
tags question: http://stackoverflow.com/q/22797177
tags question: http://stackoverflow.com/q/22781713
tags question: http://stackoverflow.com/q/22731884
tags question: http://stackoverflow.com/q/22807607
tags question: http://stackoverflow.com/q/22733757
tags question: http://stackoverflow.com/q/22771981
tags question: http://stackoverflow.com/q/22674587
tags question: http://stackoverflow.com/q/22790721
tags question: http://stackoverflow.com/q/22766117
tags question: http://stackoverflow.com/q/22722869
tags question: http://stackoverflow.com/q/22701653
tags question: http://stackoverflow.com/q/22673246
tags question: http://stackoverflow.com/q/22795501
tags question: http://stackoverflow.com/q/22652582
tags question: http://stackoverflow.com/q/22719297
tags question: http://stackoverflow.com/q/22705846
tags question: http://stackoverflow.com/q/22724751
tags question: http://stackoverflow.com/q/22725622
tags question: http://stackoverflow.com/q/22760230
tags question: http://stackoverflow.com/q/22661982
tags question: http://stackoverflow.com/q/22685422
tags question: http://stackoverflow.com/q/22666755
tags question: http://stackoverflow.com/q/22703737
tags question: http://stackoverflow.com/q/22785202
tags question: http://stackoverflow.com/q/22799067
tags question: http://stackoverflow.com/q/22732808
tags question: http://stackoverflow.com/q/22774294
tags question: http://stackoverflow.com/q/22755754
tags question: http://stackoverflow.com/q/22746985
tags question: http://stackoverflow.com/q/22784513
tags question: http://stackoverflow.com/q/22724077
tags question: http://stackoverflow.com/q/22687430
tags question: http://stackoverflow.com/q/22748271
tags question: http://stackoverflow.com/q/22650220
tags question: http://stackoverflow.com/q/22756089
tags question: http://stackoverflow.com/q/22739259
tags question: http://stackoverflow.com/q/22747109

http://stackoverflow.com/comment/34702430
comment on: http://stackoverflow.com/a/22763693
score: 0
type: AnswerComment
has text: captureActionPerformed is not declared with throws.
type: Comment

http://stackoverflow.com/comment/34533776
comment on: http://stackoverflow.com/q/22669879
score: 0
type: Comment
type: QuestionComment
has text: Details added now please see what can be done

http://stackoverflow.com/comment/34737606
type: Comment
comment on: http://stackoverflow.com/a/22783492
score: 0
type: AnswerComment
has text: Thanx a lot ! Its working. I guess I was looking at an older version of documentation.

http://stackoverflow.com/q/22738138
tagged with: packet
type: UnansweredQuestion
tagged with: sockets
has answer: http://stackoverflow.com/a/22738388
has title: UDP Packet route in Java
score: 1
tagged with: java
upvote count: 1
type: Question
answer count: 2
tagged with: udp
has answer: http://stackoverflow.com/a/22739525
downvote count: 0
favorite count: 0
has body: I have a question considering udp packet life/route. I have a simple client server UDP scheme with a send call in the client side and a receive call in the server side. Lets say the send method gets called and the packet actually arrives in the other side BUT the server's code execution hasn't yet reached the receive method call. What happens with the packet in that time . Now i tried to stop the execution before the receive call with a simple command input prompt , waited a little and then let it continue and noticed that the packet got received . Can you explain WHY that happen, like is it buffered on a different OSI level? Thanks in advance.
tagged with: osi

http://stackoverflow.com/comment/34558643
comment on: http://stackoverflow.com/a/22683826
has text: See updated post as well. The exception you're getting is probably related to the `WrappingNeoServerBootstrapper`. Is it referring to the same `graphDatabaseService`?
type: AnswerComment
score: 0
type: Comment

heap-memory
tag name: heap-memory
tags question: http://stackoverflow.com/q/22681831
tags question: http://stackoverflow.com/q/22750971
tags question: http://stackoverflow.com/q/22675322
type: Tag
tags question: http://stackoverflow.com/q/22693459
tags question: http://stackoverflow.com/q/22774627

http://stackoverflow.com/a/22771547
accepted answer of: http://stackoverflow.com/q/22769799
upvote count: 24
answers question: http://stackoverflow.com/q/22769799
has comment: http://stackoverflow.com/comment/47357407
has body: I found a command line option that seems to do what I want. Launching the jar with java -XX:-CreateMinidumpOnCrash -jar myJar.jar Seems to do the trick and will generate error logs that are very small compared to the minidumps.
has comment: http://stackoverflow.com/comment/139619031
type: AcceptedAnswer
downvote count: 0
type: Answer
score: 24

http://stackoverflow.com/a/50529404
has body: Is "join" not what you looking for? Observable&lt;Integer&gt; a = Observable.fromArray(1, 2, 3); Observable&lt;String&gt; b = Observable.fromArray("a", "b"); Observable&lt;?&gt; left = Observable.never(); Observable&lt;?&gt; right = Observable.never(); Observable&lt;Pair&lt;Integer, String&gt;&gt; pairs = a.join(b, (aa)-&gt;left, (bb)-&gt;right, (ai, bi)-&gt; Pair.of(ai, bi));
score: 1
upvote count: 1
answers question: http://stackoverflow.com/q/22764250
downvote count: 0
type: Answer

osx-mavericks
type: Tag
tags question: http://stackoverflow.com/q/22700845
tags question: http://stackoverflow.com/q/22730437
tags question: http://stackoverflow.com/q/22770785
tag name: osx-mavericks

http://stackoverflow.com/comment/34707776
score: 0
type: Comment
comment on: http://stackoverflow.com/a/22766397
has text: Thanks alot and if i wanted to change the text inside the button all i use us label.setText(blahblh); right
type: AnswerComment

http://stackoverflow.com/q/22746127
has comment: http://stackoverflow.com/comment/34670252
has comment: http://stackoverflow.com/comment/34670912
has answer: http://stackoverflow.com/a/24645277
has comment: http://stackoverflow.com/comment/34671148
has body: I am pretty sure my program works,because it gives mw the same result as uv-output. But it said my answer is wrong. Some of you might know about this site. I'm still beginner and inexperienced, so I hope to have some help. Perhaps something that I miss about that problem. this is the probelm link >> (http://uva.onlinejudge.org/index.php?option=com_onlinejudge&amp;Itemid=8&amp;page=show_problem&amp;category=3&amp;problem=36&amp;mosmsg=Submission+received+with+ID+13417700) Here's my code. import java.io.*; import java.util.Scanner; class Main { public static void main(String[] args) throws FileNotFoundException { Main myWork=new Main(); File inputFile=new File("input.txt"); if(inputFile.exists()){ Scanner scan=new Scanner(inputFile); while(scan.hasNext()){ int i=scan.nextInt(); int j=scan.nextInt(); int count =0; for(int x=i; x&lt;=j;++x){ int y= myWork.doAlgorithem(x); if(count &lt;y) count=y; } System.out.println(i+" "+j+" "+count); }} System.exit(0); } public static int doAlgorithem(int i) { int count=1; while( i != 1){ if(i % 2 != 0){ count++; i= i*3 +1; } else { count++; i /=2; } } return count; } }
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/34671063
has comment: http://stackoverflow.com/comment/34670480
has comment: http://stackoverflow.com/comment/34670299
has title: UVa Online judge-3n+1probelm(Wrong answer)
has comment: http://stackoverflow.com/comment/34671180
tagged with: java
has comment: http://stackoverflow.com/comment/34670952
has comment: http://stackoverflow.com/comment/34670819
type: Question
has comment: http://stackoverflow.com/comment/34670357
has comment: http://stackoverflow.com/comment/34670335
score: 0
answer count: 1

http://stackoverflow.com/a/42794123
answers question: http://stackoverflow.com/q/22744700
has body: If you want to have access to both local &amp; remote processes, the above answers are still missing a step. From the Java 8 oracle docs: If the JMX agent uses a connector which is not included in the Java platform, you need to add the connector classes to the class path when you run the jconsole command, as follows. $ jconsole -J-Djava.class.path=JAVA_HOME/lib/jconsole.jar:JAVA_HOME/lib/tools.jar:connector-path In the command above, connector-path is the directory or the Java archive (Jar) file containing the connector classes that are not included in the JDK, that are to be used by JConsole. In your case, then, the command would be: $ jconsole -J-Djava.class.path=%JAVA_HOME%\lib\jconsole.jar;%JAVA_HOME%/lib/tools.jar:path_to_newjar_\newjar.jar When you leave off the JAVA_HOME/lib/tools.jar, local processes are no longer available.
type: Answer
score: 0

http://stackoverflow.com/comment/34576747
type: Comment
score: 2
comment on: http://stackoverflow.com/a/22694146
has text: Note that if you store your configuration parameters as String properties in a datastore, you can edit them manually in a Datastore viewer.
type: AnswerComment

http://stackoverflow.com/a/22723110
has comment: http://stackoverflow.com/comment/34629960
type: Answer
answers question: http://stackoverflow.com/q/22722971
upvote count: 4
has body: Gradle doesn't read the pom.xml file to build the project. But it does all the same things the pom normally describes. In your gradle script you must specify the repository location and the dependencies, then gradle should build your project as you expect. You are supposed to be able to convert a maven project into a gradle project in version 1.11 by using the "init" plugin. gradle init --type pom
downvote count: 0
has comment: http://stackoverflow.com/comment/34629678
score: 4
accepted answer of: http://stackoverflow.com/q/22722971
type: AcceptedAnswer

http://stackoverflow.com/q/22787944
score: 1
tagged with: java
type: Question
has answer: http://stackoverflow.com/a/22788053
downvote count: 0
tagged with: arraylist
upvote count: 1
answer count: 1
has body: It's my first question here, I have been looking for a answer a few weeks. My work is an app project that represents a purchase cart, that scans a QR code of the product and adds it into a ListView. My problem is when I try to add a product that already exists in the list the app should increase this product quantity. It works perfectly until I add a third product, then the app thows a CurrentModificationException. public void addProduto(Produto p) { //Check if the list is empty if (listItems.isEmpty()) { listItems.add(p); } else { for (Produto p2 : listItems) { //Verify if has a product in list with the same name if (p2.getName().equalsIgnoreCase(p.getName())) { //increase the product quantity p.setQuantity((int) (p2.getQuantity() + 1)); //then replace the curent product by the new one listItems.set(listItems.indexOf(p2), p); } else { listItems.add(p); } } } adapter.notifyDataSetChanged(); } I found some solutions for "CurrentModificationException", but they don't work in my code because I'm not trying to remove a row. I'm trying to update it, that's the point. In some examples that I found they use an Iterator to remove a row, but Iterator doesn't have a method to update.
favorite count: 0
has title: Android ListView throws CurrentModificationException when I try to update a row
tagged with: android
tagged with: concurrentmodification
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/22788053

http://stackoverflow.com/comment/99297232
score: 0
comment on: http://stackoverflow.com/q/22780970
type: Comment
type: QuestionComment
has text: And I'm from 2019. Mac OS X **10.14.5** (_Mojave_), Oracle JDK **1.8.0_192** and also [JetBrains Runtime](https://confluence.jetbrains.com/display/JBR/JetBrains+Runtime) **1.8.0_202**.

http://stackoverflow.com/q/22748113
has answer: http://stackoverflow.com/a/22748158
accepted answer: http://stackoverflow.com/a/22748158
answer count: 1
favorite count: 0
has title: trying to check if arraylist is subset of another
has comment: http://stackoverflow.com/comment/34674197
type: AnsweredQuestion
score: 2
downvote count: 0
tagged with: java
type: Question
has comment: http://stackoverflow.com/comment/34674151
has body: I am trying to implement a simple check to see if arraylist is subset of another one. I have following elements in my two lists, list1 [ A F K ] and list2 [B A C F K]. list1 has all its elements in list2 so it should return true i tried using list1.containsAll(list2) but it doesn't give me true. I tried looping through both the list and if a match is found I empty that position in the first list but it doesn't work as I suppose it suffers from concurrent modification. Here is my code public static boolean isSubset(TreeNode t1, TreeNode t2){ ArrayList&lt;String&gt; subTreeList = new ArrayList&lt;String&gt;(); ArrayList&lt;String&gt; mainTreeList = new ArrayList&lt;String&gt;(); treeCopyToList(t1,subTreeList); treeCopyToList(t2,mainTreeList); int mainTreeSize = mainTreeList.size(); for(int i = 0; i &lt; subTreeList.size(); i++){ for(int j = 0; j &lt; mainTreeSize; j++){ if( subTreeList.get(i).equals(mainTreeList.get(j)) ){ subTreeList.remove(i); } } } System.out.println(subTreeList); return subTreeList.isEmpty(); } Here the subTreeList finally outputs [A]. I know it skips the middle element as when I remove the size element is also modified. How do I go about solving this issue so that I get an empty list finally.
upvote count: 2
tagged with: arraylist
has comment: http://stackoverflow.com/comment/34674044

http://stackoverflow.com/a/22804851
has comment: http://stackoverflow.com/comment/34776625
upvote count: 4
accepted answer of: http://stackoverflow.com/q/22804817
answers question: http://stackoverflow.com/q/22804817
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/34776353
score: 4
type: Answer
has body: Without Break statement it will goes all the case Switch without Break
has comment: http://stackoverflow.com/comment/34777856

http://stackoverflow.com/comment/34595099
type: QuestionComment
comment on: http://stackoverflow.com/q/22703904
score: 1
has text: Have you heard about AJAX and JQuery?
type: Comment

http://stackoverflow.com/a/22667148
has comment: http://stackoverflow.com/comment/34536648
downvote count: 0
score: 1
has body: Make sure you import FragmentManager from android.support.v4.app package as well. import android.support.v4.app.FragmentManager; I don't have the complete view of your code. Hopefully, this will resolve your problem.
has comment: http://stackoverflow.com/comment/34541291
upvote count: 1
answers question: http://stackoverflow.com/q/22666439
type: Answer

http://stackoverflow.com/a/23157239
type: Answer
answers question: http://stackoverflow.com/q/22781640
upvote count: 1
score: 1
downvote count: 0
has body: instead of using &lt;radiogroup model="@load(experiment.replicatesFlagValues)" selectedItem="@bind(experiment.replicatesFlag)" hflex="1"&gt; try with children like &lt;radiogroup children="@load(experiment.replicatesFlagValues)" selectedItem="@bind(experiment.replicatesFlag)" hflex="1"&gt;

http://stackoverflow.com/q/22716249
linked to: http://stackoverflow.com/q/7080205
has answer: http://stackoverflow.com/a/26963118
has title: JavaFX dialog Box
score: 4
has comment: http://stackoverflow.com/comment/34623139
upvote count: 4
accepted answer: http://stackoverflow.com/a/22716831
answer count: 2
downvote count: 0
linked to: http://stackoverflow.com/q/8309981
favorite count: 0
has body: public void exitGame() { //pop up dialogue Platform.exit(); } I've tried a lot of different things I've seen on the internet but I can't get anything to work. All I need is a simple dialog box that pops up when you hit the Exit button in the menu and asks "Are you sure you want to exit?" and offers a working "Yes, I'm sure." and "No, cancel" button.
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/22716831
tagged with: dialog
tagged with: java
linked to: http://stackoverflow.com/q/13784333
possible better answer: http://stackoverflow.com/a/26963118
linked to: http://stackoverflow.com/q/14941084
type: Question

http://stackoverflow.com/q/22660260
type: AnsweredQuestion
score: 1
tagged with: java
tagged with: aop
has comment: http://stackoverflow.com/comment/34516356
answer count: 2
possible better answer: http://stackoverflow.com/a/22668157
downvote count: 0
has comment: http://stackoverflow.com/comment/34516376
accepted answer: http://stackoverflow.com/a/22661773
has answer: http://stackoverflow.com/a/22668157
favorite count: 0
has comment: http://stackoverflow.com/comment/34516606
tagged with: spring-aop
has title: Spring AOP: Accessing return value of advice
has body: I want to increase my knowledge of AOP which isn't great at the moment. I have the following program. In main, I'm creating some User objects and printing out their username. Just before creating the user, I have a security aspect which runs and prints out an error if it finds a hazardous word (checking for SQL injection). It works, but it always creates the user and prints out the username, even if security finds an error. Security check returns a boolean. Is it possible to only run the rest if check returns true? To do so, I'd need to access the return value of the advice. Or would it need to be done with more AOP and after-returning? If so, could someone explain how? I only know how to use before and after at the moment. Thanks for any help. Below is my code: public class App { public static void main( String[] args ){ ApplicationContext context = new ClassPathXmlApplicationContext("context.xml"); List&lt;String&gt; names = new ArrayList&lt;String&gt;(); List&lt;User&gt; users = new ArrayList&lt;User&gt;(); names.add("Chris"); names.add("Dave"); names.add(";DROP table"); names.add("Bob"); User user = null; for(String name : names){ user = context.getBean("user", User.class); user.setUsername(name); users.add(user); } for(User u : users){ System.out.println(u.getUsername()); } } } Here is Security: public class Security { private List&lt;String&gt; words = new ArrayList&lt;String&gt;(); { words.add("drop"); words.add("delete"); words.add("truncate"); words.add("remove"); } public boolean check(String input){ for(String word: words){ if(input.toLowerCase().contains(word)){ System.err.println("Unsafe word " + word + " found!!!!!"); return false; } } return true; } } And here is what I have in context.xml &lt;bean id="user" class="com.company.springAOPExample.User" scope="prototype" /&gt; &lt;bean id="security" class="com.company.springAOPExample.Security" /&gt; &lt;aop:config&gt; &lt;aop:aspect ref="security"&gt; &lt;aop:pointcut id="setUsername" expression="executi…
upvote count: 1
tagged with: spring
has answer: http://stackoverflow.com/a/22661773
type: Question

http://stackoverflow.com/comment/34498218
type: Comment
has text: BTW -- if you want to set a lot of variables when a class is constructed, you might consider using a fluent interface or a builder pattern.
comment on: http://stackoverflow.com/q/22649908
score: 1
type: QuestionComment

http://stackoverflow.com/comment/34727414
type: Comment
comment on: http://stackoverflow.com/a/22757232
score: 1
type: AnswerComment
has text: As I got from PRG, it is to avoid duplicates. My code is supposed to show a list of items for a specific category in a page called view. User selects few items and submit the form. Server needs to show the details of the selected items in a new page called update (separate address with view page). Then user is able to edit the details of items and submit the form to update the details of those items.

http://stackoverflow.com/q/22706486
upvote count: 1
has title: Is there any solution except timeline for small animation in java fx?
has comment: http://stackoverflow.com/comment/34599874
accepted answer: http://stackoverflow.com/a/22706952
tagged with: javafx-2
has comment: http://stackoverflow.com/comment/34599940
has body: I am a beginner in javafx. I need to use small animations so much . Is there any way to create small animation except timeline ? Thank's
has answer: http://stackoverflow.com/a/22706952
type: AnsweredQuestion
downvote count: 0
score: 1
tagged with: java
tagged with: scenebuilder
tagged with: javafx
has comment: http://stackoverflow.com/comment/34599404
type: Question
answer count: 1
favorite count: 0
tagged with: javafx-8

http://stackoverflow.com/comment/34704924
score: 0
type: Comment
comment on: http://stackoverflow.com/a/22765025
has text: Do you need to removeAll()? Wouldn't putAll() overwrite the values?
type: AnswerComment

http://stackoverflow.com/a/22670759
type: Answer
score: 6
upvote count: 6
has body: It appears that whatever logging mechanism you're using is using the MessageFormat class internally. If so, then you'll need to escape the apostrophe character, because it's a single-quote character. Single-quote characters are used to quote text that isn't meant to be interpreted. MessageFormat javadocs: Within a String, a pair of single quotes can be used to quote any arbitrary characters except single quotes. For example, pattern string "'{0}'" represents string "{0}", not a FormatElement. A single quote itself must be represented by doubled single quotes '' throughout a String. (emphasis mine) Try log.log( Level.WARNING, "Can''t {0}", new Object[] { var } ); This code: MessageFormat mf = new MessageFormat("Can''t {0}"); System.out.println(mf.format(new Object[] {false})); yields this output: Can't false
accepted answer of: http://stackoverflow.com/q/22670627
answers question: http://stackoverflow.com/q/22670627
has comment: http://stackoverflow.com/comment/34556205
type: AcceptedAnswer
downvote count: 0

http://stackoverflow.com/comment/34773878
score: 0
type: Comment
type: QuestionComment
has text: @anuruddhika it is saying empty not receiving data
comment on: http://stackoverflow.com/q/22802353

http://stackoverflow.com/comment/34521063
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/22663141
score: 1
has text: It __would__ throw `ArrayIndexOutOfBoundsException` given that you attempt to access `arr[len]` and `arr[len+1]`.

http://stackoverflow.com/q/22676515
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/34545512
has comment: http://stackoverflow.com/comment/34545544
tagged with: java
has comment: http://stackoverflow.com/comment/34545486
has comment: http://stackoverflow.com/comment/34545600
type: Question
has comment: http://stackoverflow.com/comment/34545502
has body: This is my first time asking on stackoverflow, so please tell me if I am doing something wrong. I am writing a program that implements a key listener, and I am trying to get it to change a color according to which key is pressed. (see code below) However, it does not change the color, but it still registers the key pressing. The way I am trying to test this is with the 'b' key, as seen in the code. Thanks in advance. import java.awt.*; import java.awt.event.*; import javax.swing.JFrame; import javax.swing.JPanel; class Spring extends JPanel implements KeyListener { private char f = 'a'; private int a = 0, b = 0, c = 0; private Color flower = new Color(a,b,c); public Spring() { //Constructor this.setPreferredSize(new Dimension(500, 500)); addKeyListener(this); } public void addNotify() { //the focus super.addNotify(); requestFocus(); } public void paintComponent(Graphics g) { g.clearRect(0, 0, getWidth(), getHeight()); //clear before next press g.drawString("the key that pressed is " + f, 0, 10); g.setColor(flower); Polygon flowa = new Polygon(); flowa.addPoint(220,270); flowa.addPoint(250,300); flowa.addPoint(270,270); flowa.addPoint(250,300); g.fillPolygon(flowa); g.fillRect(250,300,30,30); } public void keyPressed(KeyEvent e) { } public void keyReleased(KeyEvent e) { } public void keyTyped(KeyEvent e) { //when key is typed, do something f = e.getKeyChar(); //modify value of f switch (f){ case 'a': a = 10; b = 10; c = 10; case 'b': a = 223; b = 45; c = 45; System.out.println("Bals"); case 'c': a = 10; b = 10; c = 10; case 'd': a = 10; b = 10; c = 10; case 'e': a = 10; b = 10; c = 10; case 'f': a = 10; b = 10; c = 10; case 'g': a = 10; b = 10; c = 10; case 'h': a = 10; b = 10; c = 10; case 'i': a = 10; b = 10; c = 10; case 'j': a = 10; b = 10; c = 10; case 'k': a = 10; b = 10; c = 10; case 'l': a = 10; b = 10; c = 10; case 'm': a = 10; b = 10; c = 10; } repaint(); } public static void main(String[] s) { //main method, creates the frame JFrame f = new JFrame(); f.get…
tagged with: jpanel
possible better answer: http://stackoverflow.com/a/22676860
tagged with: keylistener
has answer: http://stackoverflow.com/a/22676860
score: 0
has comment: http://stackoverflow.com/comment/34545579
answer count: 2
has answer: http://stackoverflow.com/a/22676557
has title: Java KeyListener, trying to get a Color to change according to the key pressed
has comment: http://stackoverflow.com/comment/34545477
tagged with: swing
accepted answer: http://stackoverflow.com/a/22676557

http://stackoverflow.com/a/22681162
type: Answer
answers question: http://stackoverflow.com/q/22680851
score: 0
has body: In your cases. keyboard.next() is taking word by word. So the expression keyboard.next() will give you the first word - "The". So your whole of code will run for String str = "The". Change your keyboard.next() to keyboard.nextLine() or put your code in a while condition like while(keyboard.hasNext()) { }

http://stackoverflow.com/comment/34526417
type: QuestionComment
comment on: http://stackoverflow.com/q/22665860
has text: Mike, giving one example is not a sufficient definition of the problem. You have the explain how you want to split as well. As you can see from @BheshGurung there is easily more than one interpretation of this, which would yield different results for different examples, but the same result for this one.
score: 0
type: Comment

http://stackoverflow.com/a/22772327
upvote count: 3
accepted answer of: http://stackoverflow.com/q/22772109
has comment: http://stackoverflow.com/comment/34719840
answers question: http://stackoverflow.com/q/22772109
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/34718173
type: Answer
has comment: http://stackoverflow.com/comment/34718249
has comment: http://stackoverflow.com/comment/34719761
has body: No, this will not work. The phone and the computer are two separate computer devices, and the file system of your computer is not automatically mounted to your phone. Even when connected through USB cable. Furthermore, even if it was, the Android OS is based on Linux, so it does not understand the Windows OS volumes like C:, and as such the path you've provided will be invalid path. Also, you want to put the file name in parentheses, like this - "C:/Users/desiyosh/Desktop/patient1.txt", or the Java compiler will yell at you.
has comment: http://stackoverflow.com/comment/34718652
has comment: http://stackoverflow.com/comment/34719849
score: 3

http://stackoverflow.com/a/22775635
score: 0
has body: This is a pretty straight forward task and there is a bunch of tutorials, examples, similar questions on SO: How to perform an SQLite query within an Android application? In general - you need to query the database passing your search arguments. See the documentation. It will return you a Cursor with the matching results, which you can then iterate over and manipulate as you wish. Fyi - storing password in a database table is a bad idea. On Android databases can be accessed and easily read. You either need to encrypt your data or think of another way to store it if it's important.
answers question: http://stackoverflow.com/q/22775532
type: Answer

http://stackoverflow.com/comment/34753328
comment on: http://stackoverflow.com/q/22792038
score: 0
has text: please complete your question with putting all the java code
type: QuestionComment
type: Comment

http://stackoverflow.com/q/22764353
tagged with: ocr
score: 0
tagged with: tesseract
type: AnsweredQuestion
has title: java : how to use an ocr with 64 bits windows
has answer: http://stackoverflow.com/a/22797711
tagged with: java
type: Question
answer count: 1
linked to: http://stackoverflow.com/q/24184422
tagged with: windows-7-x64
has comment: http://stackoverflow.com/comment/51360967
accepted answer: http://stackoverflow.com/a/22797711
has body: i am trying to build a web application allowing the user to upload an image text and convert it into text file retrieving the text from it to do this i search the web looking for an open source java OCR i found tesseract , javaOCR , aspire( but only trial version ) tess4j etc tesseract OCR is highly recommended but doesn't have a java 64 bits version The reason I need a 64 bit version is that I'm using it as part of a Java project that requires a 64-bit JVM. The 32 bit version of Tesseract clearly won't work in the 64 bit JVM is there a version of tesseract ocr working on windows 64 bits ?

http://stackoverflow.com/q/22660410
has comment: http://stackoverflow.com/comment/34516245
type: Question
has comment: http://stackoverflow.com/comment/34516288
linked to: http://stackoverflow.com/q/16731240
has answer: http://stackoverflow.com/a/22660500
has answer: http://stackoverflow.com/a/22660587
has answer: http://stackoverflow.com/a/22660521
tagged with: java
score: 0
answer count: 3
upvote count: 1
downvote count: 1
has comment: http://stackoverflow.com/comment/34517193
favorite count: 0
has body: Is public static in any way more meaningful than static public (or vice verse)? I've noticed some IDEs offer public static, others static public...
type: UnansweredQuestion
has title: Is public static in any way more meaningful than static public (or vice verse)?

http://stackoverflow.com/q/22752555
tagged with: android
answer count: 1
tagged with: c++
has body: I want to make some preprocessing on preview of an image that was captured from the android device camera. I can describe the carcase of my application in this way: 1.) Java part. // Getting preview from camera. public void onPreviewFrame(byte[] arg0, Camera arg1) { if (imageFormat == ImageFormat.NV21) { frameData = arg0; // private byte[] frameData = null; } } // ... // After some code - call native function. ImageProcessing(width, height, frameData, output); // private int[] output= null; // Setting output to bitmap, etc... MyCameraPreview.setImageBitmap(bitmap); // Dislplay, etc... 2.) C++ part. ImageProcessing extern "C" jboolean huge_prefix_ImageProcessing( JNIEnv* env, jobject thiz, jint width, jint height, jbyteArray frameData, jintArray output) { jbyte* pFrameData = env-&gt;GetByteArrayElements(frameData, 0); jint* pOutput = env-&gt;GetIntArrayElements(output, 0); Mat gray(height, width, CV_8UC1, (unsigned char *)pFrameData); // Some processing and writing gray to result. // ... return true; } Everything works perfectly for grayscale images. But now I need to perform processing of RGB image. Can somebody give me an advice on doing it in a right way? I've made ​​several attempts: Inside of ImageProcessing function convert pFrameData to rgb format (from nv21). In function onPreviewFrame change nv21 to RGB_565 with additional changes in containers of images.
has answer: http://stackoverflow.com/a/22753102
has title: Need an advice: Processing color image from camera; Android; OpenCV; NDK; C++
tagged with: opencv
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/22753102
has comment: http://stackoverflow.com/comment/34700376
tagged with: java
tagged with: android-ndk
type: Question
has comment: http://stackoverflow.com/comment/34700324
has comment: http://stackoverflow.com/comment/34695712
score: 0

http://stackoverflow.com/comment/34541677
type: Comment
comment on: http://stackoverflow.com/a/22674201
has text: Because the line's bounding box has no width. I tried with a very long line that crosses the rectangle and it also returned `false`
score: 0
type: AnswerComment

http://stackoverflow.com/comment/34662125
type: AnswerComment
comment on: http://stackoverflow.com/a/22741597
has text: This is actually wrong statement in JavaDoc: there is no any `writeShort` analogue in `writeUTF` method.
type: Comment
score: 0

http://stackoverflow.com/comment/34665088
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/22743244
has text: It's much better to use `SAXParser` to parse XML on Mobile devices because it uses less resources and therefore less battery: http://code.tutsplus.com/tutorials/android-sdk-build-a-simple-sax-parser--mobile-9041

http://stackoverflow.com/q/22775344
possible better answer: http://stackoverflow.com/a/22789611
tagged with: eclipse
has body: I have a spring mvc app running in eclipse with hibernate and slf4j. I would like to turn off hibernate logging in the console because it is burying other console messages that I want to be able to see. How can I turn off hibernate logging? I have done a number of web searches on this topic, and looked at other postings on stack overflow, but the other postings do not answer my question. For example, the following code from another posting will not compile in eclipse because it gives messages that the methods are not part of the objects, even when I import every possible set of packages for the given object: List&lt;Logger&gt; loggers = Collections.&lt;Logger&gt;list(LogManager.getCurrentLoggers()); loggers.add(LogManager.getRootLogger()); for ( Logger logger : loggers ) { logger.setLevel(Level.OFF); } Also, doing a key word search in my workspace for show_sql produced no results, so it seems that I cannot just set hibernate.show_sql to false. Perhaps the other solutions are for outdated versions of the libraries? I am using eclipse kepler, slf4 1.7.5 and hibernate 4.2.
has answer: http://stackoverflow.com/a/22789672
answer count: 3
upvote count: 1
downvote count: 0
favorite count: 0
has answer: http://stackoverflow.com/a/22795890
linked to: http://stackoverflow.com/q/2077377
accepted answer: http://stackoverflow.com/a/22795890
has answer: http://stackoverflow.com/a/22789611
tagged with: spring
score: 1
tagged with: java
tagged with: hibernate
has title: turn off hibernate logging in eclipse
type: Question
type: AnsweredQuestion

http://stackoverflow.com/comment/34673934
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/22748053
score: 4
has text: Yes, just press Enter.

http://stackoverflow.com/tag/pdf
tags question: http://stackoverflow.com/q/22764293
tags question: http://stackoverflow.com/q/22766445
tags question: http://stackoverflow.com/q/22751819
tags question: http://stackoverflow.com/q/22793143
tags question: http://stackoverflow.com/q/22755816
tags question: http://stackoverflow.com/q/22701016
type: Tag
tag name: pdf
tags question: http://stackoverflow.com/q/22761706
tags question: http://stackoverflow.com/q/22704186
tags question: http://stackoverflow.com/q/22772932
tags question: http://stackoverflow.com/q/22743770
tags question: http://stackoverflow.com/q/22774668
tags question: http://stackoverflow.com/q/22665939
tags question: http://stackoverflow.com/q/22806794

http://stackoverflow.com/comment/34617582
has text: Congratulations. Let us know if you have any problems getting your work done.
type: QuestionComment
type: Comment
score: 2
comment on: http://stackoverflow.com/q/22715707

http://stackoverflow.com/a/22654485
answers question: http://stackoverflow.com/q/22652546
accepted answer of: http://stackoverflow.com/q/22652546
downvote count: 0
score: 1
type: AcceptedAnswer
has body: In Java it is not possible to create instances from generic type arguments, because generics are erased at run-time. Also, generic type arguments can not themselves declare additional type arguments like C&lt;T&gt;. Therefore the code you posted is entirely illegal and will not compile: private final C&lt;T&gt; result; // illegal result = new C&lt;T&gt;(); // illegal Aside from that, your declaration of the type arguments itself has some flaws. The following code is no legal Java code: public class LineLoader&lt;T&gt; implements LineProcessor&lt;C&lt;T&gt; extends Collection&lt;T&gt;&gt; It should actually look e.g. like this: public class LineLoader&lt;T, C extends Collection&lt;T&gt;&gt; implements LineProcessor&lt;C&gt; As a solution to your problem, you could declare your LineLoader as shown above, and add a protected constructor, that takes the generic collection as an argument: public abstract class LineLoader&lt;T, C extends Collection&lt;T&gt;&gt; implements LineProcessor&lt;C&gt; { private final C result; protected LineLoader(C collection) { result = collection; } protected boolean add(final T line) { return result.add(line); } @Override public boolean processLine(final String line) throws IOException { final T data = parser.parseLine(line); if (data == null) { return false; } return add(data); } @Override public C getResult() { return result; } } Then you can implement your LinkedLineLoader like so: class LinkedLineLoader&lt;T&gt; extends LineLoader&lt;T, LinkedList&lt;T&gt;&gt; { public LinkedLineLoader() { super(new LinkedList&lt;&gt;()); } }
upvote count: 1
type: Answer

http://stackoverflow.com/comment/34603952
has text: Checkgoogleapp com.app.checkgoogleapp.CheckgoogleappServlet Checkgoogleapp /checkgoogleapp com.sun.faces.enableThreading false index.html </web-app>
comment on: http://stackoverflow.com/q/22708288
type: Comment
score: 0
type: QuestionComment

http://stackoverflow.com/comment/34626250
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/22721125
type: Comment
has text: Don't forget the `Long`s.

http://stackoverflow.com/q/22774486
tagged with: null
has comment: http://stackoverflow.com/comment/34723328
answer count: 0
downvote count: 0
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/34723386
tagged with: nullpointerexception
has body: I'm new to game programming and I'm currently learning how to use double buffering. When I try and set a dbImage, it always comes back with a "null" error, regardless of what I do. Any help would be greatly appreciated! GamePanel Class: import java.awt.Color; import java.awt.Dimension; import java.awt.Graphics; import java.awt.Image; import java.awt.Toolkit; import java.awt.event.KeyAdapter; import java.awt.event.KeyEvent; import java.awt.image.BufferedImage; import java.io.File; import java.io.IOException; import javax.imageio.ImageIO; import javax.swing.JPanel; public class GamePanel extends JPanel implements Runnable { private final int WIDTH = 160; private final int HEIGHT = WIDTH/12 *9; private final int RATIO = 3; private Thread animator; private volatile boolean running; private volatile boolean gameOver; private double FPS = 60D; private double period = 1000/FPS; private Image dbImage = null; private Graphics dbg; public GamePanel() { setPreferredSize(new Dimension(WIDTH *3, HEIGHT*3)); setBackground(Color.white); setFocusable(true); requestFocus(); terminate(); setVisible(true); } public void addNotify() { super.addNotify(); startGame(); } public void paintComponent(Graphics g) { if (dbImage != null) { g.drawImage(dbImage, 0, 0, null); } } public void startGame() { System.out.println("Thread started"); animator = new Thread(new GamePanel()); animator.start(); } public void stopGame() { System.out.println("Thread stopped"); running = false; } public void run() { System.out.println("Running."); long beforeTime, timeDiff, sleepTime; beforeTime = System.currentTimeMillis(); running = true; while (running) { gameUpdate(); gameRender(); paintScreen(); timeDiff = System.currentTimeMillis() - beforeTime; sleepTime = (long) period - timeDiff; if(sleepTime &lt;= 0) sleepTime = 5; try { Thread.sleep(sleepTime); } catch (InterruptedException e) { e.printStackTrace(); } beforeTime = System.currentTimeMillis(); } System.exit(0); } public void gameRender() { if (dbImage =…
score: 1
has comment: http://stackoverflow.com/comment/34723276
has comment: http://stackoverflow.com/comment/34723253
has comment: http://stackoverflow.com/comment/34722018
favorite count: 0
has title: Java - Null Exception with Double Buffering?
type: Question
upvote count: 1
tagged with: swing
has comment: http://stackoverflow.com/comment/34723319
has comment: http://stackoverflow.com/comment/34723224
tagged with: java
has comment: http://stackoverflow.com/comment/34723309
has comment: http://stackoverflow.com/comment/34723250
has comment: http://stackoverflow.com/comment/34723372

http://stackoverflow.com/comment/34963464
comment on: http://stackoverflow.com/a/22895290
type: Comment
has text: @bdogru If your database is in Turkish locale, then need to configure same in fibernate configuration too, possibly - [tr_TR]. Also can refer this link - https://hibernate.atlassian.net/i#browse/HHH-8765 its fixed I think, look at your hibernate version.
score: 0
type: AnswerComment

http://stackoverflow.com/q/22768537
has comment: http://stackoverflow.com/comment/34711109
has comment: http://stackoverflow.com/comment/34711392
accepted answer: http://stackoverflow.com/a/22769927
type: Question
answer count: 2
has comment: http://stackoverflow.com/comment/34711350
has title: Multiple markers : why?
score: 0
possible better answer: http://stackoverflow.com/a/22806153
tagged with: android
has answer: http://stackoverflow.com/a/22806153
tagged with: osmdroid
has body: I just want to know why that code gives me a lot of markers at the same place when I try to get users current location ? I didn't manage to do that in a different class service if anyone knows how to do that in a service or AsyncTask that will help me a lot in my project. Thanks! package toutel.testcarte; import org.osmdroid.ResourceProxy; import org.osmdroid.bonuspack.overlays.Marker; import org.osmdroid.tileprovider.tilesource.TileSourceFactory; import org.osmdroid.util.GeoPoint; import org.osmdroid.views.MapController; import org.osmdroid.views.MapView; import org.osmdroid.views.overlay.ItemizedOverlay; import org.osmdroid.views.overlay.OverlayItem; import android.annotation.SuppressLint; import android.app.Activity; import android.content.Context; import android.content.Intent; import android.location.Location; import android.location.LocationListener; import android.location.LocationManager; import android.os.Bundle; import android.view.Menu; import android.view.MenuItem; import android.widget.Toast; public class MainActivity extends Activity { private MapController mapController; private MapView mapView; private GeoPoint myposition; private ItemizedOverlay&lt;OverlayItem&gt; mMyLocationOverlay; private ResourceProxy mResourceProxy; @SuppressLint("NewApi") @SuppressWarnings("deprecation") @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); mapView = (MapView) findViewById(R.id.mapview); mapController = (MapController) mapView.getController(); GeoPoint myposition = new GeoPoint(48.856614, 2.3522219000000177); mapView.setTileSource(TileSourceFactory.MAPNIK); mapView.setBuiltInZoomControls(false); mapView.setMultiTouchControls(true); // mapController.animateTo(myposition); mapController.setZoom(13); mapController.setCenter(myposition); Context context = getApplicationContext(); CharSequence text = "Activez votre GPS pour utiliser la localisation "; int duration = Toast.LENGTH_LONG;…
has answer: http://stackoverflow.com/a/22769927
tagged with: maps
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/34711061
tagged with: java

http://stackoverflow.com/a/23864952
accepted answer of: http://stackoverflow.com/q/22760001
has comment: http://stackoverflow.com/comment/36747157
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/36755493
type: Answer
score: 1
has comment: http://stackoverflow.com/comment/36735036
upvote count: 1
answers question: http://stackoverflow.com/q/22760001
has body: This loosely couples the scripting language, but with the caveats that the functions need to be named, and the returned object needs to be a Map (Rhino does this, but I'm not sure about JRuby). ScriptEngineManager factory = new ScriptEngineManager(); ScriptEngine engine = factory.getEngineByName("JavaScript"); engine.eval("function x() { return { foo: 10 } }"); Object o = ((Invocable)engine).invokeFunction("x"); if (o instanceof Map) { Map m = (Map&lt;Object, Object&gt;)o; System.out.println(m.get("foo")); } or CompiledScript script = ((Compilable)engine).compile("(function() { return {bar:20} })()"); System.err.println(((Map)script.eval()).get("bar")); But you have to cheat and call your function by padding it with (...)().

inputstream
tags question: http://stackoverflow.com/q/22740582
tags question: http://stackoverflow.com/q/22742617
tags question: http://stackoverflow.com/q/22704876
tags question: http://stackoverflow.com/q/22745747
tags question: http://stackoverflow.com/q/22663904
tag name: inputstream
tags question: http://stackoverflow.com/q/22701871
type: Tag
tags question: http://stackoverflow.com/q/22726792
tags question: http://stackoverflow.com/q/22705921
tags question: http://stackoverflow.com/q/22700920
tags question: http://stackoverflow.com/q/22805415
tags question: http://stackoverflow.com/q/22702238

http://stackoverflow.com/comment/78833555
comment on: http://stackoverflow.com/a/22747610
type: Comment
has text: @kensai https://github.com/highsource/hyperjaxb3/tree/master/ejb/schemas/customizations/src/main/resources
type: AnswerComment
score: 0

http://stackoverflow.com/q/22770953
score: 0
tagged with: osgi
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/34716710
has title: Import package when two bundles are exporting the same packages with different versions
answer count: 0
tagged with: java
type: Question
has comment: http://stackoverflow.com/comment/34716212
has comment: http://stackoverflow.com/comment/34715872
has body: I have three hypothetical bundles: bundleA exporting package1(2.0.0) and package2(1.0.0) bundleB exporting package1(1.0.0) and package2(2.0.0) bundleC importing package1(2.0.0) and package2(2.0.0) When I run this, bundleC is importing packages package1(2.0.0) from bundleA, package2(2.0.0) from bundleB, but also package2(1.0.0) from bundleA. Why does this happen? EDIT: This is what the OSGi console shows me: Imported packages anotherdualpackage; version="2.0.0"&lt;bundleA_1.0.0.qualifier [5]&gt; dualpackage; version="2.0.0"&lt;bundleB_1.0.0.qualifier [3]&gt; dualpackage; version="1.0.0"&lt;bundleA_1.0.0.qualifier [5]&gt;

http://stackoverflow.com/comment/34751440
type: QuestionComment
has text: How did you configure your Eclipse to show that warning (at least in that place) despite the `default`? Don't get me wrong, I do not doubt you, but AFAIK this is not standard behaviour, and otherwise we can't reproduce the problem.
type: Comment
comment on: http://stackoverflow.com/q/22789442
score: 0

http://stackoverflow.com/comment/34534197
has text: @AntonioJunior I just added some more debug options you can try.
type: AnswerComment
score: 0
type: Comment
comment on: http://stackoverflow.com/a/22669883

http://stackoverflow.com/q/22709058
has comment: http://stackoverflow.com/comment/34605069
possible better answer: http://stackoverflow.com/a/22709889
has title: How to work with JLabel?
has answer: http://stackoverflow.com/a/22709476
score: 0
answer count: 3
tagged with: jlabel
has comment: http://stackoverflow.com/comment/34604149
has comment: http://stackoverflow.com/comment/34604163
has comment: http://stackoverflow.com/comment/34605238
has comment: http://stackoverflow.com/comment/34604185
has comment: http://stackoverflow.com/comment/34604049
has answer: http://stackoverflow.com/a/22709453
has comment: http://stackoverflow.com/comment/34604121
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/34604628
accepted answer: http://stackoverflow.com/a/22709453
has answer: http://stackoverflow.com/a/22709889
tagged with: java
has comment: http://stackoverflow.com/comment/34604145
has comment: http://stackoverflow.com/comment/34604092
tagged with: swing
has body: Hi i am trying to make java desktop application where i am using JLabel I wrote some test on JLabel I want to set text from the top and I am using multiple line in JLabel I want to set different different color for every line. Here is my code: JLabel label = new JLabel("&lt;html&gt;Case &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;Item&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; CaseNum&lt;br&gt;Party1&lt;br&gt;Party2&lt;/html&gt;"); How can I achieve this?
type: Question

http://stackoverflow.com/comment/34747134
type: Comment
comment on: http://stackoverflow.com/a/22788790
type: AnswerComment
has text: I edited the post. Result.Score can't be null cuz i made it 0 from the start.
score: 0

http://stackoverflow.com/comment/95406300
has text: Nice line of code. Has nothing to do with the question.
type: AnswerComment
comment on: http://stackoverflow.com/a/34740998
type: Comment
score: 6

http://stackoverflow.com/q/22676169
tagged with: macos
has title: Mac: JRE 7 crashes in 10.6.8 running threaded program
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/34553874
answer count: 0
tagged with: java
has comment: http://stackoverflow.com/comment/34546664
type: Question
has body: I installed JDK 7 ("7u51") using Pacifist on my server running Mac OS X 10.6.8 and switched the main version to it in Java Preferences. I know that it's not supported by Oracle, but many do it and say that it works fine. It works, but if I try to launch my Bukkit server, it crashes after about 30 seconds. I get the following error messages: java[34338:1707] *** NSInvocation: warning: object 0x115f8a3a0 of class 'ThreadUtilities' does not implement methodSignatureForSelector: -- trouble ahead java[34338:1707] *** NSInvocation: warning: object 0x115f8a3a0 of class 'ThreadUtilities' does not implement doesNotRecognizeSelector: -- abort I'm assuming it runs the code fine until it tries and fails to make a new thread. Same thing happens with JRE 8 and JRE 7u11. Any solutions?
tagged with: osx-snow-leopard
score: 0

http://stackoverflow.com/comment/34566766
has text: @jonSkeet was curious, i just wanted to know, was searching on google for around half an hour, thaen i asked here, sorry if hurted anyone.
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/22688688

http://stackoverflow.com/comment/34758350
score: 0
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/22767380
has text: Sure, I'll put my code in a github repo and put it under the WTFPL license.

http://stackoverflow.com/comment/34591554
type: AnswerComment
score: 0
type: Comment
comment on: http://stackoverflow.com/a/22701862
has text: Yeah, that's what I thought the OP wanted to do as well, but I believe they want to add `"****"` BEFORE each matching element, not prefix it - could be wrong, but that's how I now read it :P

http://stackoverflow.com/comment/34629992
type: Comment
comment on: http://stackoverflow.com/a/22709336
score: 0
type: AnswerComment
has text: When you already HAVE a predefined data set, then you don't have to use the "generateGraph..." method. Any beyond that: I provided large and perfectly running examples answering exactly your questions. If you are looking for someone who writes a complete application for you, then you should should not look on a Q/A site like stackoverflow, but on a job exchange site.

http://stackoverflow.com/q/22787030
tagged with: opencv
score: 2
type: AnsweredQuestion
downvote count: 0
tagged with: java
has answer: http://stackoverflow.com/a/22787194
type: Question
answer count: 2
has body: My image is of type CV_8UC3 (it is a grayscale image) and I need it as CV_8UC1. How can I do the transformation? I already tried Mat right = new Mat(rectRight.width(), rectRight.height(), CvType.CV_8UC1); rectRight.convertTo(right, CvType.CV_8UC1,255,0); But it still gives me a 3-channel image. RectLeft is the rectified version of this image: Imgproc.undistort(Highgui.imread(images[0], Imgproc.COLOR_BGR2GRAY), undist_left, cameraMatrix, distCoeff); The rectification is done using this part of code: Mat rectLeft = new Mat(); Imgproc.initUndistortRectifyMap(cameraMatrix, distCoeff, R1, newCameraMatrix_left, left.size(), CvType. CV_32FC1, map1_left, map2_left); Imgproc.remap(left, rectLeft, map1_left, map2_left, Imgproc.INTER_LANCZOS4); The rectified image (and its partner of the right camera) should be used in StereoBM stereoAlgo = new StereoBM(); stereoAlgo.compute(left, right, disparity); But there is an exception which says that both input images should be of type CV_8UC1 but I've checked and rectLeft.type() gives me a 16. (I guess this is CV_8UC1).
has answer: http://stackoverflow.com/a/22787163
accepted answer: http://stackoverflow.com/a/22787163
upvote count: 2
has title: OpenCV CV_8UC3 to CV_8UC1
linked to: http://stackoverflow.com/q/14364563
possible better answer: http://stackoverflow.com/a/22787194
favorite count: 0

http://stackoverflow.com/comment/34579026
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/22694596
has text: I see a statement that says `Helper.m("Positions size: " + pos.size());` but I don't see an output line that matches this.
score: 0

http://stackoverflow.com/comment/34499486
score: 0
type: QuestionComment
type: Comment
has text: It's funny that you are using the observer as an observable that delegates a fire event, you can have an infinite recursion there..
comment on: http://stackoverflow.com/q/22648359

http://stackoverflow.com/q/22793594
tagged with: nullpointerexception
has answer: http://stackoverflow.com/a/22793747
tagged with: android
has comment: http://stackoverflow.com/comment/34756561
has comment: http://stackoverflow.com/comment/34756060
possible better answer: http://stackoverflow.com/a/22793747
accepted answer: http://stackoverflow.com/a/22793829
score: 0
has comment: http://stackoverflow.com/comment/34756338
type: Question
type: AnsweredQuestion
tagged with: java
has comment: http://stackoverflow.com/comment/34756291
has body: I have two classes, MainActivity and HjorthClass. I have a nullpointer exception which I believe is coming from my arrays, but I cannot figure out where the error is. Please direct your attention to TestSeizureDetected() in MainActivity. This issue occurs when I push a button that calls that method. I did not include String huge, because it includes 7681 separate numbers. The basic format format of String huge = "1.3870574e+01 2.0512821e+01 3.8485958e+01 4.9816850e+01 6.7789988e+01 6.7789988e+01 6.5836386e+01 7.7557998e+01 8.2246642e+01" Please see below MainActivity, HjorthClass, and the relevant LogCat when the error appears. MainActivity package com.example.android.BluetoothChat; import android.R.string; import android.app.Activity; import android.bluetooth.BluetoothAdapter; import android.content.Context; import android.content.Intent; import android.location.Location; import android.location.LocationListener; import android.location.LocationManager; import android.net.Uri; import android.os.Bundle; import android.os.CountDownTimer; import android.os.Handler; import android.speech.tts.TextToSpeech; import android.speech.tts.TextToSpeech.OnInitListener; import android.telephony.SmsManager; import android.util.Log; import android.view.View; import android.view.View.OnClickListener; import android.widget.ArrayAdapter; import android.widget.Button; import android.widget.ListView; import android.widget.TextView; import android.widget.Toast; import java.util.Locale; import java.util.Set; import android.bluetooth.BluetoothDevice; import java.io.BufferedReader; import java.io.FileNotFoundException; import java.io.FileReader; import java.io.InputStream; import java.io.OutputStream; import java.io.Reader; import android.bluetooth.BluetoothSocket; import android.widget.EditText; import java.io.IOException; import java.util.UUID; public class MainActivity extends Activity implements LocationListener{ Button start, stop; Button textData; TextView tv; TextView tv2; TextView s…
has comment: http://stackoverflow.com/comment/34756219
answer count: 3
has title: NullPointer exception 2D Arrays Class
tagged with: arrays
has answer: http://stackoverflow.com/a/22793829
has answer: http://stackoverflow.com/a/22794961
has comment: http://stackoverflow.com/comment/34756133

http://stackoverflow.com/comment/34571767
has text: Are you running code compiled for 6 inside a 7 JRE? Or did you recompile at 7?
type: QuestionComment
comment on: http://stackoverflow.com/q/22691435
type: Comment
score: 1

http://stackoverflow.com/comment/34651086
score: 0
type: AnswerComment
type: Comment
has text: So what does ALL mean? Imagine someone is sending you mail, in your mailbox. They might send you more than one letter, they might not. You want to reply only when they've finished each batch - how do you know when they've finished? You need some indication - maybe sending a 'special message', reserve a special character or command that indicates the end of a batch, etc.
comment on: http://stackoverflow.com/a/22734730

http://stackoverflow.com/comment/34596588
comment on: http://stackoverflow.com/q/22704423
has text: I could not get your problem. please explain the complete scenario.
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/q/22752433
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/22765669
has title: Fourier Transform get about half the outputs wrong
tagged with: audio
type: Question
has body: My project plays music and constantly writes the "intensity" of the bass into a text file. However, about half of the intensities are wrong, meaning my fourier transform output is janked up or something. It causes an output like this: http://pastebin.com/yxyBwv2Q Where all the bars should line up. There are 3 different tones in that pastebin, in the order of (3,1,2) regarding how hard they are hitting. That makes sense, the project definitely shows when and only when the bass is hitting hard. It's just not smooth at all, there's an error margin. This is the code: package script; import javazoom.jl.decoder.BitstreamException; import javazoom.jl.decoder.Decoder; import javazoom.jl.decoder.DecoderException; import javazoom.jl.decoder.Header; import javazoom.jl.decoder.JavaLayerException; import javazoom.jl.decoder.Obuffer; import javazoom.jl.decoder.SampleBuffer; import javazoom.jl.decoder.Bitstream; import javazoom.jl.player.Player; import java.text.NumberFormat; import java.util.Arrays; import java.awt.AWTException; import java.awt.Robot; import java.awt.event.KeyEvent; import java.io.BufferedWriter; import java.io.File; import java.io.FileInputStream; import java.io.FileWriter; import java.io.IOException; import java.io.InputStream; import java.util.Map; import javax.sound.sampled.AudioFileFormat; import javax.sound.sampled.AudioSystem; import javax.sound.sampled.UnsupportedAudioFileException; import org.tritonus.share.sampled.file.TAudioFileFormat; import edu.emory.mathcs.jtransforms.fft.DoubleFFT_1D; public class MusicPlayer { static double getDurationWithMp3Spi(File file) throws UnsupportedAudioFileException, IOException { AudioFileFormat fileFormat = AudioSystem.getAudioFileFormat(file); if (fileFormat instanceof TAudioFileFormat) { Map&lt;?, ?&gt; properties = ((TAudioFileFormat) fileFormat).properties(); String key = "duration"; Long microseconds = (Long) properties.get(key); int mili = (int) (microseconds / 1000); int sec = (mili / 1000); int min = (mili / 10…
tagged with: java
score: 0
tagged with: arrays
answer count: 1
tagged with: fft

hibernate
tags question: http://stackoverflow.com/q/22651520
tags question: http://stackoverflow.com/q/22721709
tags question: http://stackoverflow.com/q/22654906
tags question: http://stackoverflow.com/q/22792343
tags question: http://stackoverflow.com/q/22731506
tags question: http://stackoverflow.com/q/22662928
tags question: http://stackoverflow.com/q/22787345
tags question: http://stackoverflow.com/q/22687322
tags question: http://stackoverflow.com/q/22668513
tags question: http://stackoverflow.com/q/22782683
tags question: http://stackoverflow.com/q/22767309
tags question: http://stackoverflow.com/q/22676191
tags question: http://stackoverflow.com/q/22742547
tags question: http://stackoverflow.com/q/22787153
tags question: http://stackoverflow.com/q/22761356
tags question: http://stackoverflow.com/q/22761281
tags question: http://stackoverflow.com/q/22706178
tags question: http://stackoverflow.com/q/22664681
tags question: http://stackoverflow.com/q/22689189
tags question: http://stackoverflow.com/q/22683491
tags question: http://stackoverflow.com/q/22678567
tags question: http://stackoverflow.com/q/22673633
tags question: http://stackoverflow.com/q/22675723
tags question: http://stackoverflow.com/q/22679398
tags question: http://stackoverflow.com/q/22758820
tags question: http://stackoverflow.com/q/22691252
tags question: http://stackoverflow.com/q/22782706
tags question: http://stackoverflow.com/q/22789196
tags question: http://stackoverflow.com/q/22684834
tags question: http://stackoverflow.com/q/22665316
tags question: http://stackoverflow.com/q/22688402
tags question: http://stackoverflow.com/q/22698405
tags question: http://stackoverflow.com/q/22808566
tags question: http://stackoverflow.com/q/22735285
tags question: http://stackoverflow.com/q/22784271
tags question: http://stackoverflow.com/q/22657895
tags question: http://stackoverflow.com/q/22659580
tags question: http://stackoverflow.com/q/22779313
tags question: http://stackoverflow.com/q/22702836
tags question: http://stackoverflow.com/q/22705605
tags question: http://stackoverflow.com/q/22786493
tag name: hibernate
tags question: http://stackoverflow.com/q/22673588
tags question: http://stackoverflow.com/q/22739812
tags question: http://stackoverflow.com/q/22686385
tags question: http://stackoverflow.com/q/22726128
tags question: http://stackoverflow.com/q/22695663
tags question: http://stackoverflow.com/q/22776803
tags question: http://stackoverflow.com/q/22719221
tags question: http://stackoverflow.com/q/22806131
tags question: http://stackoverflow.com/q/22653388
tags question: http://stackoverflow.com/q/22787137
tags question: http://stackoverflow.com/q/22732656
tags question: http://stackoverflow.com/q/22792629
tags question: http://stackoverflow.com/q/22786260
tags question: http://stackoverflow.com/q/22747026
tags question: http://stackoverflow.com/q/22672580
tags question: http://stackoverflow.com/q/22702851
tags question: http://stackoverflow.com/q/22729791
tags question: http://stackoverflow.com/q/22782493
tags question: http://stackoverflow.com/q/22785501
tags question: http://stackoverflow.com/q/22684945
tags question: http://stackoverflow.com/q/22735266
tags question: http://stackoverflow.com/q/22788068
tags question: http://stackoverflow.com/q/22743273
tags question: http://stackoverflow.com/q/22725547
tags question: http://stackoverflow.com/q/22752981
tags question: http://stackoverflow.com/q/22708320
tags question: http://stackoverflow.com/q/22729740
tags question: http://stackoverflow.com/q/22782521
tags question: http://stackoverflow.com/q/22733631
tags question: http://stackoverflow.com/q/22740199
tags question: http://stackoverflow.com/q/22795900
tags question: http://stackoverflow.com/q/22778450
tags question: http://stackoverflow.com/q/22661207
tags question: http://stackoverflow.com/q/22662939
tags question: http://stackoverflow.com/q/22729312
tags question: http://stackoverflow.com/q/22754930
tags question: http://stackoverflow.com/q/22686846
tags question: http://stackoverflow.com/q/22680925

http://stackoverflow.com/q/22746208
type: AnsweredQuestion
tagged with: java
type: Question
score: 0
answer count: 1
tagged with: android
has title: Errors with Android studio?
has answer: http://stackoverflow.com/a/22746311
accepted answer: http://stackoverflow.com/a/22746311
has body: When I install android studio I get these errors: and I set up an emulator but the error is still happening. This is the first time I'm using android studio. Can you tell me what I'm doing wrong?

http://stackoverflow.com/q/22674691
tagged with: android
tagged with: facebook
tagged with: logout
score: 1
tagged with: java
tagged with: authentication
upvote count: 1
has title: Android: facebook login & logout
has body: I want to integrate facebook API into my android application. I use connect, disconnect, share and like functions. Connection function is called from a login button in an activity HomeActivity Disconnection function is called from the logout button in an activity setingsActivity Share and like are used at DetailActivity Is it possible to use a single class grouping the 3 activities? This class is declared at the facebook platform
type: Question
has answer: http://stackoverflow.com/a/22674748
answer count: 1
downvote count: 0
favorite count: 0
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/34542792

http://stackoverflow.com/comment/34604123
type: AnswerComment
comment on: http://stackoverflow.com/a/22693816
type: Comment
has text: I don't understand your last sentence. I don't want to edit the source code as that is auto-generated. I also think that it would be good on the Apache Thrift website to provide some guidance on naming. For example, we could have rolled out extensive Thrift services and have lots of clients in Python and C#, all working. Then a year later we decide to create Java clients. Bang - the Java clients won't work unless the IDL is edited, but then all the Python/C# clients would have to be regenerated too! Or do you mean the Python/C# clients don't need changing as long as the field IDs don't change?
score: 0

http://stackoverflow.com/comment/34900809
has text: Hi prasad, thanks, getting closer... maybe. The container at least initializes, but when I try to access the sessionFactory I get this `org.springframework.web.util.NestedServletException: Request processing failed; nested exception is org.hibernate.HibernateException: No Session found for current thread `
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/22750449

http://stackoverflow.com/comment/34553642
type: QuestionComment
has text: @Radiodef : By "using the loop that you don't want to use.", what I meant is, if there is some system call that we can make to do this, which will improve the performance (like memcopy or std::copy in C).
score: 0
comment on: http://stackoverflow.com/q/22661982
type: Comment

http://stackoverflow.com/comment/34597226
score: 2
has text: JFileChooser. setAcceptAllFileFilterUsed(false);
comment on: http://stackoverflow.com/q/22705189
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/34721768
type: AnswerComment
score: 0
type: Comment
has text: I was under the impression that it was a pre-loaded method from the way the book put it, thanks for the input.
comment on: http://stackoverflow.com/a/22774301

http://stackoverflow.com/comment/34781264
score: 0
has text: @Yury Lankovskiy could be an interesting question, your requirement to make me sence, but here will based on your SSCCE / MCVE / MCTRE, short, runnable, compilable with hardcoded value in local variables
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/22807407

http://stackoverflow.com/a/22709546
type: AcceptedAnswer
has body: You have to split each line by the coma and add two parts of it to your result list: public Shortener( String inAbbreviationsFilePath ) throws FileNotFoundException { Scanner s = new Scanner(new File(inAbbreviationsFilePath)); ArrayList&lt;String&gt; list = new ArrayList&lt;String&gt;(); while (s.hasNext()) { //HERE String line = s.next(); String[] lineSplit = line.split(","); //split into two tokens list.add(lineSplit[0]); //word list.add(lineSplit[1]); //number } abbreviations = list.toArray(new String[list.size()]); s.close(); }
score: 0
type: Answer
accepted answer of: http://stackoverflow.com/q/22709474
answers question: http://stackoverflow.com/q/22709474

http://stackoverflow.com/q/22768632
has answer: http://stackoverflow.com/a/22768702
has body: I have this code using C# to manipulate data in SQL Server: using (SqlConnection myDatabaseConnection = new SqlConnection(myConnectionString.ConnectionString)) { myDatabaseConnection.Open(); using (SqlCommand SqlCommand = new SqlCommand("Select * from Users where Username = @UserName and Password = @Password", myDatabaseConnection)) { SqlCommand.CommandType = CommandType.Text; SqlCommand.Parameters.AddWithValue("@UserName", TextBox1.Text); SqlCommand.Parameters.AddWithValue("@Password", TextBox2.Text); SqlDataReader DR1 = SqlCommand.ExecuteReader(); if (DR1.Read()) { //some code } } } How would I translate it to Java using JDBC and MySQL as the database? And can I avoid SQL injection? My attempt: try (Connection conn = DriverManager.getConnection(dbURL, username, password)) { String sql = "Select * from Users where Username = @UserName and Password = @Password"; Statement statement = conn.createStatement(); //parameters? ResultSet result = statement.executeQuery(sql); while (result.next()) { //some code } } catch (SQLException ex) { ex.printStackTrace(); }
answer count: 1
favorite count: 0
accepted answer: http://stackoverflow.com/a/22768702
has title: How to Convert from C# to Java JDBC
score: 0
tagged with: jdbc
type: AnsweredQuestion
upvote count: 1
downvote count: 1
type: Question
tagged with: c#
tagged with: java
tagged with: mysql

http://stackoverflow.com/comment/34736606
type: AnswerComment
has text: Brilliant! Thanks @Artem. I'm a little new to spring integration and xd. I did see the Example you mentioned an was a bit frustrated that nothing was said about filters :) It was the MessageSelector implementation that did it for me.
comment on: http://stackoverflow.com/a/22782500
type: Comment
score: 0

http://stackoverflow.com/q/22728909
answer count: 0
has comment: http://stackoverflow.com/comment/34641015
tagged with: java
has body: I am using Android shared prefs for saving user settings. The problem is that it creates java objects every time you commit values. A compromise is to only commit the changes every-so-often which works, but still generates garbage and may lose settings if the application ends soon after a change. Is there a way to save prefs often and prevent garbage generation (or a usable alternative). One could imagine allocating a fixed number of characters in shared-pref storage and updating it without creating strings but that would take a lot of effort to develop (ie converting floats, booleans and integers into characters without creating objects). Besides, re-implementing framework code seems like a bad idea.
tagged with: sharedpreferences
type: Question
score: 0
has comment: http://stackoverflow.com/comment/34639886
type: UnansweredQuestion
tagged with: android
tagged with: garbage-collection
has title: Android SharedPrefs without Garbage
has comment: http://stackoverflow.com/comment/34640740

http://stackoverflow.com/q/22771544
upvote count: 4
type: AnsweredQuestion
linked to: http://stackoverflow.com/q/16532293
downvote count: 0
tagged with: dns
accepted answer: http://stackoverflow.com/a/22774520
type: Question
tagged with: nginx
tagged with: java
has answer: http://stackoverflow.com/a/22774520
score: 4
has title: How can Nginx add the Subdomain as parameter when a proxy_pass to Tomcat is executed
answer count: 1
tagged with: tomcat
favorite count: 0
tagged with: wildcard-subdomain
has body: What I am trying to achieve The web application should be able to support multiple subdomains without having to make any changes on the nginx or tomcat every time a new subdomain is used. (I have already done the required changes to DNS to support wild card subdomains) Nginx listens to port 80. It does a proxy_pass to tomcat at port 8080. nginx should be able to support multiple subdomain. My current setup is based on this answer. But it is not passing the parameter Nginx proxy_pass : Is it possible to add a static parameter to the URL? Every possible subdomain dynamic_subdomain_1.localhost dynamic_subdomain_2.localhost nginx setup server { listen 80 default_server; server_name ~^(?&lt;subdomain&gt;.+)\.localhost$; location / { set $args ?$args&amp;site=$subdomain; proxy_pass http://127.0.0.1:8080; } } Nginx should append the subdomain as a parameter when it invokes Tomcat. The Calls to Tomcat should be as follows for each subdomain http://127.0.0.1:8080?site=dynamic_subdomain_1 http://127.0.0.1:8080?site=dynamic_subdomain_2 I have tried the above setup but the query parameter always shows up as null. What should I change in nginx to make this possible?

http://stackoverflow.com/comment/34775665
has text: The first result for googling "GetTypeFromProgID" is http://msdn.microsoft.com/en-us/library/vstudio/system.type.gettypefromprogid. You will have some trouble using *that* method in java.
type: Comment
comment on: http://stackoverflow.com/q/22804519
score: 0
type: QuestionComment

http://stackoverflow.com/comment/34748059
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/22789293
has text: @MironBalcerzak Because that's not what he said he wanted to do at all.
score: 0

http://stackoverflow.com/comment/34538212
has text: Please paste the logs
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/22672580
score: 1

http://stackoverflow.com/comment/53537532
has text: Does this actually work? I get an error because cordova looks from my jar in the plugins directory even though I specified a path in the directory folder.
type: AnswerComment
comment on: http://stackoverflow.com/a/22785818
type: Comment
score: 0

http://stackoverflow.com/comment/34754857
type: QuestionComment
comment on: http://stackoverflow.com/q/22787345
type: Comment
score: 0
has text: I create a class for each table. I map every column to a variable and use the @Column annotation. I do not know how to declare the columns which come from the join as a variable. That is where I am seeking help :)

http://stackoverflow.com/comment/34700719
type: AnswerComment
has text: I'm currently synchronizing with synchronized methods and wait() and notify() where all 3 threads are submitted to the executor service and am obviously running into a deadlock.
type: Comment
comment on: http://stackoverflow.com/a/22760039
score: 0

http://stackoverflow.com/q/22743512
upvote count: 1
type: Question
score: 1
tagged with: java
has comment: http://stackoverflow.com/comment/34672117
has body: I was looking at source code of ConcurrentHashMap how how concurrent update has been handled. But looks like its to complex to understand. Then i thought if i need to implement it my self how should i go about it. I came up with simple algorithm. My question is is my algo on right path(i think yes) and if i compare it with the jre 6 prescribed implementation where it lacks at high level? Basically we have to do locking at individual bucket level(instead of whole HashMap) so that concurrent update requires locks only for entries which got to same bucket. Now bucket gets determined based on key's hashcode.similarly if we get the lock based on hashcode, problem will be solved. So two keys having different hashcode will go to the separate buckets and hence we can use synchronize block on interned hashcode value(purpose of using interned value is so that lock is acquired on same object which lies under same bucket). In this case synchronization will happen on different interned hashcode strings. so, concurrent hashcode can happen. So two keys having equal hashcode will go to the same buckets .So, we can use synchronize block on interned hashcode value and avoid concurrent update here is my proposed put method public V put(K key, V value) { int hashCode = geKeyHashcode(); String stringHashcode = hashCode + ""; synchronized (str.intern()) { // line A // proceed for put operation } } Now at line A, we can stop concurrent updates lying under same bucket/segment, though proceed for lying under separate bucket/segment I am sure it can be improved a lot but main point it can be achieved be simple algorithm also. Is n't it? UPDATE :- If someone can forward/point to the resource which explains java 6 prescribed ConcurrentHashMap in easier manner it would be great(I tried Googling but couldn't spot which explains how put method is implementated like usage of unsafe etc)
has comment: http://stackoverflow.com/comment/34670358
downvote count: 0
has comment: http://stackoverflow.com/comment/34666580
has comment: http://stackoverflow.com/comment/34665578
has title: Internal working of ConcurrentHashMap?
tagged with: dictionary
favorite count: 0
has comment: http://stackoverflow.com/comment/34665677
answer count: 0
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/34666012
tagged with: concurrenthashmap

http://stackoverflow.com/comment/34709181
has text: Sorry for that. I have also created a new question and can you please look in to that...here is the link http://stackoverflow.com/questions/22722561/syntax-error-in-sql-statement-with-keyword-throwing-exception Thanks a lot!!!
type: AnswerComment
comment on: http://stackoverflow.com/a/22700470
type: Comment
score: 0

http://stackoverflow.com/comment/34573715
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/22677061
type: Comment
has text: Finished editing. Both solutions works very fast, but they give different kinds of borders as you will see.

http://stackoverflow.com/q/22717577
has comment: http://stackoverflow.com/comment/34619310
tagged with: java
upvote count: 1
type: Question
has body: I have got a listView. Every row contains different items (let's say a TextView and an ImageView). I set a OnClickListener on the TextView and another one on the ImageView in order to perform a specific action in case of click on one of these two items. My problem is that the clicks on these items are not detected in a reliable way. I have to click several times in order to enter the OnClickListener. Anybody already had this kind of problems ? Thanks !
tagged with: listview
has title: Android : clicks on items included in the rows of a ListView not detected properly
has answer: http://stackoverflow.com/a/22718127
tagged with: android-listview
answer count: 1
downvote count: 0
favorite count: 0
tagged with: listener
linked to: http://stackoverflow.com/q/22700768
type: UnansweredQuestion
tagged with: android
has comment: http://stackoverflow.com/comment/34619995
score: 1

http://stackoverflow.com/q/22757878
tagged with: spring-data-mongodb
tagged with: spring
has comment: http://stackoverflow.com/comment/35239100
has body: Short question: Why does a mongodb query via spring-data MongoTemplate is slower when my entity contains an empty array ? Long question: I'm currently working on an application running on Spring 4.0.0 MVC backed by a MongoDB database. The relevant part of my pom.xml is: org.springframework spring-context 4.0.0.RELEASE org.springframework spring-webmvc 4.0.0.RELEASE org.springframework.data spring-data-mongodb 1.4.0.RC1 org.springframework.data spring-data-commons 1.7.0.RC1 org.springframework.hateoas spring-hateoas 0.9.0.BUILD-SNAPSHOT joda-time joda-time 2.3 And the version of the transitively loaded java driver for mongo is 2.11.4. And now, my problem. One of my domain entity is as follow: @Document public class Team extends IdentifiableEntity{ private List<String> skills = new ArrayList<>(); private List<String> tools = new ArrayList<>(); private String phone; private String mail; // getters, setters, constructors } IdentifiableEntity is common superclass for all my entities: public abstract class IdentifiableEntity { @Indexed protected String id; @Indexed protected String name; @CreatedDate private DateTime createdAt; @LastModifiedDate private DateTime lastModified; // also getters and setters } In my DAO I use MongoTemplate to interact with MongoDB, using basic queries. On my development workstation, I'm forced to used an old 2.0.9 version of MongoDB because it's running an old Windows XP 32bits and I've no choice to change this at the moment. Tomcat version is 7.0.41.0 and Java version is 1.7.0_45. Processor is an old Celeron G1610 with 3Go of RAM (heavily charged because running netbeans, redmine, jenkins and a bunch of resource-eating-tools). There were no sensible problem when I tested my code on this workstation. I recently deployed my app on a demo platform running an old RHEL 5 unix, but using the last version (2.4.9) of MongoDB. Tomcat version is 7.0.52 and Java version is 1.7.0_51-b13. Everything is still 32 bits. Server is a VM using one Core of an In…
answer count: 0
score: 1
tagged with: java
tagged with: spring-data
upvote count: 1
has comment: http://stackoverflow.com/comment/34746714
type: Question
tagged with: mongodb
has comment: http://stackoverflow.com/comment/34734320
downvote count: 0
has title: Spring Data mongodb converting empty array may be slow
favorite count: 0
type: UnansweredQuestion

http://stackoverflow.com/comment/34715319
type: QuestionComment
has text: Added source code. Unfortunately, I'm very explicitly not allowed to use AWT.
score: 0
comment on: http://stackoverflow.com/q/22769904
type: Comment

http://stackoverflow.com/comment/34708319
comment on: http://stackoverflow.com/q/22766888
score: 0
has text: You should really create a class `User`. You would just have a list of Users and then iterate through it and check each password.
type: Comment
type: QuestionComment

marker
tag name: marker
tags question: http://stackoverflow.com/q/22764387
type: Tag

http://stackoverflow.com/a/22783444
upvote count: 1
type: AcceptedAnswer
downvote count: 0
answers question: http://stackoverflow.com/q/22783153
has body: CopyOnArrayListsame as ArrayList but allows concurrent modifications.
accepted answer of: http://stackoverflow.com/q/22783153
type: Answer
score: 1

http://stackoverflow.com/comment/34684071
type: AnswerComment
comment on: http://stackoverflow.com/a/22753303
type: Comment
has text: You mean on the stack, or in a CPU register?
score: 0

http://stackoverflow.com/comment/58910858
has text: This solution actually worked for me, not the accepted answer. In my case I had some older Spring configurations that defined PropertyPlaceholderConfigurer. Once I removed those references, everything worked as documented.
score: 0
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/22672729

http://stackoverflow.com/comment/34754467
type: Comment
has text: This is fantastic. Over-ride for testing is so simple, and I can implement it easily. This is exactly what I needed, thank you!
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/22779058

http://stackoverflow.com/comment/34499102
type: Comment
has text: `how can I know that at the end of 1 sec, what would be the location` do it with pen and paper...then translate it to Java.
score: 1
type: QuestionComment
comment on: http://stackoverflow.com/q/22650404

http://stackoverflow.com/a/22720070
downvote count: 0
score: 1
answers question: http://stackoverflow.com/q/22719576
type: Answer
upvote count: 1
has body: This is a modified flood-fill algorithm. Rather than filling a pixel and then its neighbors, you fill a whole horizontal "run" of pixels and then its neighbors. The recursion goes as follows: To Fill(X0, X1, Y, Old, New): # Precondition: the segment [X0 X1]/Y has the old color and can't be lengthened Find all connected runs [X0' X1'] in row Y-1 having old color and Fill(X0', X1', Y-1, Old, New) Find all connected runs [X0' X1'] in row Y+1 having old color and Fill(X0', X1', Y+1, Old, New) To find all connected runs in a new row, start from X0 and move left as long as you are on an old pixel, or move right as long as you are on an non-old pixel (stop at X1); you have X0'. Then continue to the right on old pixels; you have X1'. Repeat the search to the right as long as X0' is in [X0 X1]. A few implementation details depend on the 4/8 connexity rule you choose.
has comment: http://stackoverflow.com/comment/34624910

http://stackoverflow.com/q/22802536
has comment: http://stackoverflow.com/comment/34772881
has answer: http://stackoverflow.com/a/22804265
tagged with: spring
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/22802781
tagged with: java
tagged with: hibernate
possible better answer: http://stackoverflow.com/a/22804265
has comment: http://stackoverflow.com/comment/34772853
has comment: http://stackoverflow.com/comment/34772267
type: Question
linked to: http://stackoverflow.com/q/10041938
answer count: 2
tagged with: jpa
downvote count: 0
accepted answer: http://stackoverflow.com/a/22802781
favorite count: 0
tagged with: spring-roo
has title: Hibernate & Spring Roo: org.hibernate.PersistentObjectException: detached entity passed to persist
score: 2
has body: I'm using Spring Roo to generate an entity based on a table(created on the MS SQL Server). The following is my sql script: CREATE TABLE [dbo].[JMSMessage]( [MessageID] [nvarchar](100) NOT NULL, [Destination] [varchar](50) NOT [Status] [varchar](15) NULL, CONSTRAINT [PK_JMSMessage] PRIMARY KEY CLUSTERED ( [MessageID] ASC ) WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF,ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY] ) ON [PRIMARY] Java entity generated by Spring Roo is @Entity @Table(schema = "dbo",name = "JMSMessage") @Configurable public class Jmsmessage { @Column(name = "Destination", length = 50) @NotNull private String destination; @Column(name = "Status", length = 15) private String status; public String getDestination() { return destination; } public void setDestination(String destination) { this.destination = destination; } public String getStatus() { return status; } public void setStatus(String status) { this.status = status; } @Id @GeneratedValue(strategy = GenerationType.AUTO) @Column(name = "MessageID", length = 100) private String messageId; public String getMessageId() { return this.messageId; } public void setMessageId(String id) { this.messageId = id; } @PersistenceContext transient EntityManager entityManager; public static final EntityManager entityManager() { EntityManager em = new Jmsmessage().entityManager; if (em == null) throw new IllegalStateException("Entity manager has not been injected (is the Spring Aspects JAR configured as an AJC/AJDT aspects library?)"); return em; } public static Jmsmessage findJmsmessage(String messageId) { if (messageId == null || messageId.length() == 0) return null; return entityManager().find(Jmsmessage.class, messageId); } @Transactional public void persist() { if (this.entityManager == null) this.entityManager = entityManager(); this.entityManager.persist(this); } @Transactional public void remove() { if (this.entityManager == null) this.entityManager = entityManager(); if (…
upvote count: 2

http://stackoverflow.com/comment/34539987
score: 0
type: Comment
type: QuestionComment
has text: Why at all you use `Character[]` as the key, not `String`? Using arrays as HashMap keys is generally a bad idea, since you can't override their `equals()` and `hashCode()` methods. So arrays are always compared by reference, not by the actual contents.
comment on: http://stackoverflow.com/q/22672690

http://stackoverflow.com/q/22749300
has body: I am trying to make an app that, once connected, runs a specific method on each available network that have been used in the past. I try to make sure that the wifi is fully connected before running the method and connecting to the next available network, but that part of code seems to not be working correctly. Any suggestions would be appreciated! List&lt;WifiConfiguration&gt; networkList = wifiManager.getConfiguredNetworks(); List&lt;ScanResult&gt; scannedList = wifiManager.getScanResults(); for (ScanResult i: scannedList){ for (WifiConfiguration z: networkList){ if(z.SSID.substring(1, (z.SSID.length() - 1)).equals(i.SSID)){ //System.out.println("NETWORK: " + i.SSID); System.out.println("NETWORK: " + i.SSID + "STATE " + wifiManager.getConnectionInfo().getSupplicantState().toString()); wifiManager.disconnect(); wifiManager.enableNetwork(z.networkId, true); wifiManager.reconnect(); while(wifiManager.getConnectionInfo().getSupplicantState().toString() != "COMPLETED"){ } runMethod(wifiManager); } } } }
score: 0
tagged with: android
has comment: http://stackoverflow.com/comment/34865848
tagged with: wifi
answer count: 0
type: UnansweredQuestion
tagged with: wifimanager
has comment: http://stackoverflow.com/comment/34850741
has title: Connecting to all available Wifi networks on Android
has comment: http://stackoverflow.com/comment/34676541
tagged with: java
type: Question
tagged with: network-programming

http://stackoverflow.com/comment/34520832
type: QuestionComment
comment on: http://stackoverflow.com/q/22662285
has text: See my answer. Should work out for you
score: 0
type: Comment

http://stackoverflow.com/comment/34665550
score: 0
has text: Good answer, but you're missing hostname verification on the client side. Using [`sslParameters.setEndpointIdentificationAlgorithm("HTTPS")`](http://stackoverflow.com/a/18174689/372643) is probably the best way to do this (even for non-HTTPS). In addition, you don't need to use `startHandshake`, it will all be done for you when you start using the I/O streams.
type: AnswerComment
comment on: http://stackoverflow.com/a/22738568
type: Comment

http://stackoverflow.com/q/22785266
score: 0
has title: Primefaces wizard with dynamic image: what scope to use?
linked to: http://stackoverflow.com/q/10162391
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/34745643
has body: I created a wizard (p:wizard) where a user can define his profile. In one of the wizard's tabs, the user can upload his profile photo. The photo will be rendered in the final wizard step. So, my question is, what Scope should I use? I tried View, but p:graphicImage with dynamic image doesn't work with View scope (will throw npe, because two requests are made when rendering the image). I tried Request, but in the wizard when you click next/back, a new request is made, and all my previous entered data is lost (bean is reinitialized). Finally, I`ve put Session scope, and it works. I'm not a big fan of Session scope, because the bean remains in scope untill the session is invalidated/expires. What would be the correct aproach? Invalidate the bean? FacesContext context = FacesContext.getCurrentInstance(); context.getExternalContext().getSessionMap.put("#{MySessionBean}", null); Is it "ethically" correct to "destroy" a session bean? Should I create a reset() method wich makes all his attributes null? (Bean will still remain in session).
tagged with: jsf
tagged with: primefaces
tagged with: java
type: Question
answer count: 1
has answer: http://stackoverflow.com/a/22785568
linked to: http://stackoverflow.com/q/18897752
tagged with: scope

http://stackoverflow.com/comment/34743974
type: QuestionComment
comment on: http://stackoverflow.com/q/22786965
score: 0
type: Comment
has text: Open cmd again and check, if you have installed Java in C:\Windows or C:\Windows\System32.

http://stackoverflow.com/comment/34695260
comment on: http://stackoverflow.com/a/22743904
has text: Would it be the best to start new with the program? It´s really frustrating always errors :S Or is there a diffrent way i could try? thank you really for your time!
score: 0
type: AnswerComment
type: Comment

http://stackoverflow.com/q/22707026
has comment: http://stackoverflow.com/comment/34601458
tagged with: java
tagged with: calendar
has answer: http://stackoverflow.com/a/22707351
has body: I am working on an android app that has a follow-up feature. People will be able to put in some information including a description and the number of days in the future they want this event to start (IE 1 day, 10 days, 20 days) and then click the create button to create it. The problem I am having is that I want the date to start X number of days in the future where X is the number of days in the future where it would start(an int passed in of days, IE 1 day, 10 days). Here is my code: //Create Calendar event public void CreateEvent(){ //Variables title, location, description, and days_from_now are all defined elsewhere Calendar mycal = Calendar.getInstance(); Intent calIntent = new Intent(Intent.ACTION_INSERT); calIntent.setType("vnd.android.cursor.item/event"); //Put information in calIntent.putExtra(Events.TITLE, title); calIntent.putExtra(Events.EVENT_LOCATION, location); calIntent.putExtra(Events.DESCRIPTION, description); **//Increment the date by X days mycal.add(mycal.DATE, days_from_now ); //Start and end time long startTime = mycal.getTimeInMillis(); //Convert to milliseconds long endTime = startTime+900000; //15 minutes //Put the calculated start and end time into the calIntent Intent calIntent.putExtra(CalendarContract.EXTRA_EVENT_BEGIN_TIME, startTime); calIntent.putExtra(CalendarContract.EXTRA_EVENT_END_TIME, endTime);** startActivity(calIntent); } Finally got it working! The bolded code is what was missing. Thanks for the ideas guys as they led me to the right code!
downvote count: 0
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/22707351
score: 1
tagged with: android-activity
has comment: http://stackoverflow.com/comment/34636296
favorite count: 0
type: Question
tagged with: android
upvote count: 1
tagged with: android-intent
has title: How to create an Android Calendar event that ends X days from today
answer count: 1

http://stackoverflow.com/comment/34658641
type: Comment
comment on: http://stackoverflow.com/a/22739309
has text: It's so frustrating @MikeSamuel, all this confusion is because of learning Java in spanish and now trying to explain myself in English. Thank you for the link.
type: AnswerComment
score: 0

http://stackoverflow.com/q/22664574
tagged with: java
has title: Which design pattern or idea do I use for a distributed system based on mvc
type: AnsweredQuestion
linked to: http://stackoverflow.com/q/2885385
tagged with: distributed
accepted answer: http://stackoverflow.com/a/22668076
downvote count: 0
score: 1
favorite count: 0
type: Question
tagged with: android
possible better answer: http://stackoverflow.com/a/22668322
answer count: 2
has answer: http://stackoverflow.com/a/22668322
upvote count: 1
has answer: http://stackoverflow.com/a/22668076
tagged with: model-view-controller
has body: First I'd like to begin by illustrating the basic idea that I want to get done. I'm designing a system by following the layered model view controller design. I essentially have a server and I would like to use tablets as the view/display. Now because I want to send data to and from the tablets through serialization, I can't figure out where to play the view controller classes for those tablets. Ideally, when you'll boot up the tablet, you will have an option as to which view you wish the tablet to display (1 through whatever), but a view can't instantiate it's own controller I don't think. So I just don't know where to have the view controller that technically creates the said views and how to allow it to communicate to said tablets. (This will be done in java/android)

http://stackoverflow.com/comment/34541156
comment on: http://stackoverflow.com/q/22673586
type: Comment
type: QuestionComment
has text: Is there a big difference comparing your solution to pools? In that case I would always need to search for the "invisible" ImageView. Could work, I would need to try it. Could you post your suggestion as answer, please? I will implement that by tomorrow, to give it a try.
score: 0

http://stackoverflow.com/q/22756803
has title: Parse data from a .gpx file to CSV file
possible better answer: http://stackoverflow.com/a/25515039
score: 2
type: AnsweredQuestion
downvote count: 0
tagged with: java
tagged with: xslt
type: Question
upvote count: 2
accepted answer: http://stackoverflow.com/a/22757183
has body: I have a .gpx file which looks like this: <?xml version="1.0" encoding="UTF-8"?> <gpx version="1.1"> asd <email id="asd" domain="gmail.com"/> Endomondo 2014-03-25T15:58:33Z http://www.endomondo.com/ endomondo MOUNTAIN_BIKING <trkseg> 2013-09-16T12:01:23Z 627.5 2013-09-16T12:01:28Z ...additional nodes I would like to extract the longitude and latitude, time and elevation values from each trkpt node and output them in a CSV file. I've heard of XSLT transformations but I don't know how to write them. Another way would be to use a xml/gpx parser. Is there a quicker way I could retrieve these values? The output CSV should be in this form: latitude \t longitude \t elevation(if present) \t time
answer count: 2
tagged with: http://stackoverflow.com/tag/csv
has comment: http://stackoverflow.com/comment/34690026
has answer: http://stackoverflow.com/a/22757183
tagged with: gpx
has answer: http://stackoverflow.com/a/25515039
favorite count: 0
tagged with: http://stackoverflow.com/tag/xml

http://stackoverflow.com/q/22670384
has answer: http://stackoverflow.com/a/22670624
has comment: http://stackoverflow.com/comment/34534503
has comment: http://stackoverflow.com/comment/34535099
type: AnsweredQuestion
tagged with: java
has comment: http://stackoverflow.com/comment/34534824
type: Question
tagged with: gwt
tagged with: google-visualization
has body: I have code writen on Java public class MyClass implements EntryPoint { public void onModuleLoad() { // Create a callback to be called when the visualization API // has been loaded. Runnable onLoadCallback = new Runnable() { public void run() { RootLayoutPanel rp = RootLayoutPanel.get(); // Create a Dock Panel DockLayoutPanel dockLayoutPanel = new DockLayoutPanel(Unit.EM); dockLayoutPanel.setStyleName("dockpanel"); dockLayoutPanel.getElement().getStyle().setProperty("border", "solid lightblue 4px"); // Add text all around dockLayoutPanel.addNorth(new HTML("This is the first north component."), 2); //dockPanel.addEast(col.asWidget(), 1); dockLayoutPanel.addWest(new HTML("This is the west component."), 3); VerticalPanel verticalPanel = new VerticalPanel(); ColumnChart col = new ColumnChart(createTable(), createOptions()); col.addSelectHandler(createSelectHandler(col)); verticalPanel.add(col); dockLayoutPanel.add(verticalPanel); rp.add(dockLayoutPanel); } }; // Load the visualization api, passing the onLoadCallback to be called // when loading is done. VisualizationUtils.loadVisualizationApi(onLoadCallback, ColumnChart.PACKAGE); } } Help me, peoples!)) How add ColunnChart in DockLayoutPanel? In this code I add ColumnChart to VerticalPanel,then add VerticalPanel to dockLayoutPanel, and then dockLayoutPanel add to RootLayoutPanel. But ERROR.
accepted answer: http://stackoverflow.com/a/22670624
has title: How add ColumnChart to DockLayoutPanel in Java?
has comment: http://stackoverflow.com/comment/34534981
score: 0
answer count: 1

http://stackoverflow.com/comment/34714164
type: AnswerComment
comment on: http://stackoverflow.com/a/22769929
type: Comment
has text: So it would become: [code] java -XX:-OmitStackTraceInFastThrow -Xms1024m -Xmx1024m -server -cp ./bin:lib/log4j-1.2.16.jar:lib/mysql-connector-java-5.1.18-bin.jar:lib/netty-3.5.2.Final.jar:lib/FileStore.jar:lib/GTLVote.jar com.rs.Launcher [/code] This still gives me the same error: Error: Could not find or load main class com.rs.Launcher Sorry for how unskilled i am at ubuntu, i never used it before and using google didn't help.
score: 0

http://stackoverflow.com/q/22738736
has comment: http://stackoverflow.com/comment/34657475
has comment: http://stackoverflow.com/comment/34657469
downvote count: 0
favorite count: 0
has comment: http://stackoverflow.com/comment/34657499
has body: If I change the else if portion of this code to an else statement it runs without any problems so I get how to make it run. What I'm a little confused about is why I get a missing return statement error when it is in its current form. My return is dependent on the value of the boolean variable of negative. I covered the true and false states, isn't that good enough to cover everything? Or is it that I always have to have a return statement within an else or to add a meaningless return true to the bottom of my function for the compiler to accept my code as covering every case? import java.util.*; import java.lang.*; import java.io.*; class Ideone { public boolean posNeg(int a, int b, boolean negative) { if (!negative) { return (a &lt; 0 &amp;&amp; b &gt; 0) || (a &gt; 0 &amp;&amp; b &lt; 0); } else if (negative) { return (a &lt; 0 &amp;&amp; b &lt; 0); } } public static void main (String[] args) throws java.lang.Exception { } }
has answer: http://stackoverflow.com/a/22738800
has answer: http://stackoverflow.com/a/22738787
has comment: http://stackoverflow.com/comment/34657512
has answer: http://stackoverflow.com/a/22738759
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/22738787
tagged with: java
has title: Why does this code have a missing return statement error?
possible better answer: http://stackoverflow.com/a/22739223
has answer: http://stackoverflow.com/a/22739223
type: Question
has answer: http://stackoverflow.com/a/22738797
score: 5
has comment: http://stackoverflow.com/comment/34657349
has answer: http://stackoverflow.com/a/22739960
upvote count: 5
answer count: 6

http://stackoverflow.com/q/22658322
has answer: http://stackoverflow.com/a/73452509
tagged with: performance
has comment: http://stackoverflow.com/comment/34516019
has comment: http://stackoverflow.com/comment/34516132
answer count: 6
has comment: http://stackoverflow.com/comment/34520328
has answer: http://stackoverflow.com/a/22670380
has body: I'm new to Java 8. I still don't know the API in depth, but I've made a small informal benchmark to compare the performance of the new Streams API vs the good old Collections. The test consists in filtering a list of Integer, and for each even number, calculate the square root and storing it in a result List of Double. Here is the code: public static void main(String[] args) { //Calculating square root of even numbers from 1 to N int min = 1; int max = 1000000; List&lt;Integer&gt; sourceList = new ArrayList&lt;&gt;(); for (int i = min; i &lt; max; i++) { sourceList.add(i); } List&lt;Double&gt; result = new LinkedList&lt;&gt;(); //Collections approach long t0 = System.nanoTime(); long elapsed = 0; for (Integer i : sourceList) { if(i % 2 == 0){ result.add(Math.sqrt(i)); } } elapsed = System.nanoTime() - t0; System.out.printf("Collections: Elapsed time:\t %d ns \t(%f seconds)%n", elapsed, elapsed / Math.pow(10, 9)); //Stream approach Stream&lt;Integer&gt; stream = sourceList.stream(); t0 = System.nanoTime(); result = stream.filter(i -&gt; i%2 == 0).map(i -&gt; Math.sqrt(i)).collect(Collectors.toList()); elapsed = System.nanoTime() - t0; System.out.printf("Streams: Elapsed time:\t\t %d ns \t(%f seconds)%n", elapsed, elapsed / Math.pow(10, 9)); //Parallel stream approach stream = sourceList.stream().parallel(); t0 = System.nanoTime(); result = stream.filter(i -&gt; i%2 == 0).map(i -&gt; Math.sqrt(i)).collect(Collectors.toList()); elapsed = System.nanoTime() - t0; System.out.printf("Parallel streams: Elapsed time:\t %d ns \t(%f seconds)%n", elapsed, elapsed / Math.pow(10, 9)); }. And here are the results for a dual core machine: Collections: Elapsed time: 94338247 ns (0,094338 seconds) Streams: Elapsed time: 201112924 ns (0,201113 seconds) Parallel streams: Elapsed time: 357243629 ns (0,357244 seconds) For this particular test, streams are about twice as slow as collections, and parallelism doesn't help (or either I'm using it the wrong way?). Questions: Is this test fair…
downvote count: 0
linked to: http://stackoverflow.com/q/504103
favorite count: 0
has answer: http://stackoverflow.com/a/22659950
has comment: http://stackoverflow.com/comment/34515697
has comment: http://stackoverflow.com/comment/34516213
has title: Java 8: performance of Streams vs Collections
has comment: http://stackoverflow.com/comment/34516025
upvote count: 181
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/33812775
tagged with: java-8
has comment: http://stackoverflow.com/comment/126643787
score: 181
tagged with: java-stream
has comment: http://stackoverflow.com/comment/34531077
tagged with: java
has answer: http://stackoverflow.com/a/67785926
has comment: http://stackoverflow.com/comment/34515800
tagged with: collections
has comment: http://stackoverflow.com/comment/70307404
has answer: http://stackoverflow.com/a/22658458
type: Question

http://stackoverflow.com/comment/65161822
type: AnswerComment
comment on: http://stackoverflow.com/a/22667201
type: Comment
has text: @joeytwiddle I think Brian is probably talking about the instrumentation of lambdas at the JVM level. When he says "lambdas-as-objects" he's probably referring to instrumenting lambdas as inner classes. If they did that, they'd probably make it really hard to support actual function types in the future. However they didn't do that to instrument lambdas, [they used invokeDynamic and a few other tricks](http://medianetwork.oracle.com/video/player/1113272510001) and it is implemented such that if the JVM ever supports structural function types, their solution can be adapted to that as well.
score: 1

http://stackoverflow.com/q/22756781
favorite count: 0
score: -1
has answer: http://stackoverflow.com/a/22759827
tagged with: return
type: Question
answer count: 2
tagged with: void
has comment: http://stackoverflow.com/comment/34690274
tagged with: recursion
has comment: http://stackoverflow.com/comment/34691052
has answer: http://stackoverflow.com/a/22757791
tagged with: java
has title: Return function in void method when using Recursion
accepted answer: http://stackoverflow.com/a/22759827
downvote count: 1
has body: I am currently learning the basics of Java from a book and I've got this code as an example of Nested Loops using Recursion. I understand everything, but the usage of return function in the end of the code. I cannot figure out how the program decide, when to stop exactly when K=4. I've tried to debug it and this continued to be like a mystery for me. Here is the code : import java.util.Scanner; public class nestedLoops { public static int numberOfLoops; public static int numberOfIterations; public static int[] loops; public static void main(String[] args) { Scanner input = new Scanner(System.in); System.out.print("N = "); numberOfLoops = input.nextInt(); System.out.print("K = "); numberOfIterations = input.nextInt(); input.close(); loops = new int[numberOfLoops]; nestedLoops(0); } public static void nestedLoops(int currentLoop) { if (currentLoop == numberOfLoops) { printLoops(); return; } for (int counter=1;counter&lt;=numberOfIterations;counter++) { loops[currentLoop] = counter; nestedLoops(currentLoop + 1); } } public static void printLoops() { for (int i = 0; i &lt; numberOfLoops; i++) { System.out.printf("%d ", loops[i]); } System.out.println(); } } It would be very helpful if someone explain me how return works in this particular example in the end when numbers are "4.4" and also how it works at all in a void method, because I've been searching for explanation of that but did not succeed... Thank you beforehand !
possible better answer: http://stackoverflow.com/a/22757791
type: AnsweredQuestion
upvote count: 0

http://stackoverflow.com/comment/34758055
has text: What's the problem with your output? Is it only the missing ` ` in the nested list? Your input doesn't match the data in the output.
type: Comment
type: QuestionComment
score: 1
comment on: http://stackoverflow.com/q/22794473

http://stackoverflow.com/a/22801097
has comment: http://stackoverflow.com/comment/46771178
has comment: http://stackoverflow.com/comment/34769560
has comment: http://stackoverflow.com/comment/46581063
has comment: http://stackoverflow.com/comment/46586424
has comment: http://stackoverflow.com/comment/34800587
has comment: http://stackoverflow.com/comment/46771166
has body: So, some of the Dagger/Guice folks at Google created a thing called AutoFactory (http://github.com/google/auto) in a project that includes AutoFactory (code-generated assisted injection), AutoValue (code-generated custom value types) and AutoService (auto-generation of java services metadata files). AutoFactory pretty much operates like you would expect - it generates the factory you would otherwise have hand-rolled. It's a very early version, and we have a lot more flexibility planned, but it will generate a factory class that will take a type that includes some JSR-330 injectable dependencies and some call-stack parameters, and merge them together in creating instances of the annotated type. In essence it will generate the factory you wrote, automatically if you properly annotate your factory-created type. For instance, if you create your class: @AutoFactory public class ImageDownloader { // Get these dependencies from the injector. private final HttpClient httpClient; private final ExecutorService executorService; // Get these from the caller. private final URL imageUrl; private final ImageCallback callback; ImageDownloader( @Provided HttpClient httpClient, @Provided ExecutorService executorService, ImageCallback callback, URL imageUrl) { // assignments } } AutoFactory will generate: @Generated("com.google.auto.factory.processor.AutoFactoryProcessor") public final class ImageDownloaderFactory { private final Provider&lt;ExampleClasses.HttpClient&gt; httpClientProvider; private final Provider&lt;java.util.concurrent.ExecutorService&gt; executorServiceProvider; @Inject public ImageDownloaderFactory( Provider&lt;ExampleClasses.HttpClient&gt; httpClientProvider, Provider&lt;java.util.concurrent.ExecutorService&gt; executorServiceProvider) { this.httpClientProvider = httpClientProvider; this.executorServiceProvider = executorServiceProvider; } public ImageDownloader create(ImageCallback callback, URL imageUrl) { return new ImageDownloader( httpClientProvider.get(), ex…
upvote count: 18
has comment: http://stackoverflow.com/comment/34811363
has comment: http://stackoverflow.com/comment/34810940
has comment: http://stackoverflow.com/comment/34801778
type: AcceptedAnswer
downvote count: 0
score: 18
has comment: http://stackoverflow.com/comment/34803188
has comment: http://stackoverflow.com/comment/34814723
has comment: http://stackoverflow.com/comment/46771116
type: Answer
answers question: http://stackoverflow.com/q/22799407
has comment: http://stackoverflow.com/comment/34808030
has comment: http://stackoverflow.com/comment/46580768
accepted answer of: http://stackoverflow.com/q/22799407

http://stackoverflow.com/comment/34654553
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/22674055
score: 0
has text: Is there a way to redirect output to /dev/null using Java 6? I don't have Java 7.

http://stackoverflow.com/comment/34657523
score: 0
type: Comment
type: QuestionComment
has text: I tested `SimpleTextClient` on eclipse, and it ran fine without any issue on Ubuntu.
comment on: http://stackoverflow.com/q/22737535

http://stackoverflow.com/comment/34553941
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/22681424
score: 0
has text: Ohh sorry.. http://stackoverflow.com/a/1326239/235710

http://stackoverflow.com/comment/34687808
score: 0
type: Comment
comment on: http://stackoverflow.com/a/22755598
type: AnswerComment
has text: @ambigram_maker LOL ;-)

ruby
tags question: http://stackoverflow.com/q/22737685
tag name: ruby
tags question: http://stackoverflow.com/q/22801741
tags question: http://stackoverflow.com/q/22740252
type: Tag

http://stackoverflow.com/comment/34668541
has text: I've added the error message to my post.
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/22744058
score: 0

http://stackoverflow.com/a/22736201
score: 1
answers question: http://stackoverflow.com/q/22704418
type: Answer
accepted answer of: http://stackoverflow.com/q/22704418
upvote count: 1
has body: After looking deeper at your code, there are two things to note: In your template you need to use the helper tags for your form fields. The helpers will display field specific errors for you: http://www.playframework.com/documentation/2.2.x/JavaFormHelpers I don't think your form has any global errors, which is why that code isn't displaying anything. Try the helpers and see if that works for you.
type: AcceptedAnswer
downvote count: 0

http://stackoverflow.com/q/22776711
answer count: 1
has comment: http://stackoverflow.com/comment/34727218
favorite count: 0
has answer: http://stackoverflow.com/a/22776722
has body: I'm just starting out to learn Guava and I notice something peculiar with ImmutableList.builder(). This doesn't compile: List&lt;String&gt; iList = ImmutableList.builder().add("One").add("Two").build(); //Type mismatch: cannot convert from List&lt;Object&gt; to List&lt;String&gt; This works: List&lt;String&gt; iList = new ImmutableList.Builder&lt;String&gt;().add("One").add("Two").build(); I can live with using new ImmutableList.Builder&lt;String&gt;() but is this a bug with ImmutableList.builder()?
upvote count: 13
type: AnsweredQuestion
downvote count: 1
type: Question
has title: ImmutableList.builder() bug?
tagged with: guava
accepted answer: http://stackoverflow.com/a/22776722
tagged with: java
score: 12
has comment: http://stackoverflow.com/comment/34727379

http://stackoverflow.com/a/22680644
downvote count: 0
has comment: http://stackoverflow.com/comment/34562287
upvote count: 3
type: AcceptedAnswer
has body: It's because Infinispan registers itself with the transaction manager by default as a "synchronization" instead of a full XA resource. Synchronizations are not allowed to throw XAExceptions in their afterCompletion() methods, and the transaction managers (including DummyTransactionManagerLookup) swallow any runtime exceptions. In optimistic mode, the keys and values are replicated during beforeCompletion(), which is allowed to throw an exception in order to cancel the transaction. In pessimistic mode, you should configure Infinispan to register as an XA resource instead: configuration.transaction().useSynchronization(false); Edit: By default, DummyTransactionManager doesn't support XA transactions, so you also need to configure it for XA (or even better, use Narayana): DummyTransactionManager.getInstance().setUseXaXid(true);
type: Answer
accepted answer of: http://stackoverflow.com/q/22663923
answers question: http://stackoverflow.com/q/22663923
score: 3

http://stackoverflow.com/a/22802345
downvote count: 0
has body: You can basically use the simplest method... i.e methods provided with the String API.. public boolean startsWith(String prefix, int toffset) or public boolean startsWith(String prefix) For example : String str = new String("http://www.google.com"); str.startsWith("http://"); It returns true if the condition is met else will return false.
answers question: http://stackoverflow.com/q/22802234
type: Answer
score: 2
upvote count: 2

http://stackoverflow.com/a/22714263
score: 6
downvote count: 0
answers question: http://stackoverflow.com/q/22713863
type: Answer
has body: This is my understanding what is going on. The problem is that you expect the compiler to use expected assignment type, in this case List&lt;Callable&lt;Double&gt;&gt;, to infer the type arguments. However, the .mapToObj isn't the last statement in the chain and it doesn't return a List. This code below works though, because here the compiler can match the result of the .mapToObj call to what you have declared as the return type, and therefore it can infer the type arguments for the stream. Stream&lt;Callable&lt;Double&gt;&gt; temporaryVariable = IntStream.range(1, 99) .mapToObj(value -&gt; (() -&gt; calculateResult(value))); List&lt;Callable&lt;Double&gt;&gt; list = temporaryVariable.collect(Collectors.toList()); Because it is not the last statement in the chain, if I were a compiler I wouldn't really like to go through all the possible values of Stream&lt;?&gt; (which essentially is the return type of .mapToObj) to find one call that would match the next call to return List&lt;Callable&lt;Double&gt;&gt;.
upvote count: 6

http://stackoverflow.com/a/22669665
has comment: http://stackoverflow.com/comment/34533199
upvote count: 1
type: AcceptedAnswer
type: Answer
downvote count: 0
accepted answer of: http://stackoverflow.com/q/22669452
answers question: http://stackoverflow.com/q/22669452
score: 1
has body: NodeList doesn't have any method getFirstChild(). http://docs.oracle.com/javase/7/docs/api/org/w3c/dom/NodeList.html Once you have the NodeList NodeList nodeList = (NodeList)xPath1.compile(temp).evaluate(xmlDocument,XPathConstants.NODESET); before getting any Node from the nodeList, check for it's length if (nodeList.getLength() &gt; 0) Node node = nodeList.items(0); Similarly, once you have the Node and you want to get the first child here, you need to be sure that the node have some childs if (node.hasChildNodes()) String value = node.getFirstChild().getNodeValue(); This way you can avoid null values.

http://stackoverflow.com/a/22714526
has body: How do you define getter for inners member? Check that it always returns valid list: List&lt;InnerClass&gt; inners = new LinkedList&lt;InnerClass&gt;(); OR public List&lt;InnerClass&gt; getInners() { if (inners == null) { inners = new LinkedList&lt;InnerClass&gt;(); } return inners; }
answers question: http://stackoverflow.com/q/22714340
score: 0
has comment: http://stackoverflow.com/comment/36777457
has comment: http://stackoverflow.com/comment/34617127
type: Answer

http://stackoverflow.com/q/22759196
has comment: http://stackoverflow.com/comment/34720812
tagged with: socketchannel
tagged with: nio
type: Question
accepted answer: http://stackoverflow.com/a/22773877
has title: Distinguish between messages sent from CLIENT and other
downvote count: 0
has comment: http://stackoverflow.com/comment/34702028
has comment: http://stackoverflow.com/comment/34703844
has answer: http://stackoverflow.com/a/22773877
has comment: http://stackoverflow.com/comment/34701994
has body: I am using SocketChannel and Selector to write a server. The servers job is to allow clients to connect, read messages from clients and write messages to clients. I am having some difficulty distinguishing between messages sent from the client, and other data that's firing off the read instruction. ex. When a client connects, I noticed the read instruction is executed, without the client having sent any data. This is important, because after the server has read a message from the client, it must add that message to a message queue. These message will be removed and processed from the queue by an external application. The problem is, that every time the read fires, these yet UFM (unidentified messages) are breaking the external application when trying to decode them. I am sorry if this question has already been answered I couldn't find a complete answer. Here is my accept method that, if I am not mistaken, tells the selector to notify us when data is available to read. private void accept(SelectionKey key) throws IOException { ServerSocketChannel serverSocketChannel = (ServerSocketChannel) key.channel(); // Accept the connection and make it non-blocking SocketChannel socketChannel = serverSocketChannel.accept(); socketChannel.configureBlocking(false); socketChannel.register(this.selector, SelectionKey.OP_READ); } Here is the selector method which waits for an event. while (should_run) { try { //Load all pending operations to key while (!operations.isEmpty()) { SelectionKey key = client.keyFor(getSelector()); if (!key.isValid()) { operations.remove(); throw new Exception("Key not valid"); } key.interestOps(operations.remove()); } selector.select(); Iterator selectedKeys = selector.selectedKeys().iterator(); while (selectedKeys.hasNext()) { SelectionKey key = (SelectionKey) selectedKeys.next(); //Check if key is valid if (!key.isValid()) { throw new Exception("Key not valid"); } if (key.isAcceptable()) { accept(key); } else if (key.isReadable()) { read(key); } else if …
upvote count: 1
answer count: 1
has comment: http://stackoverflow.com/comment/34698164
favorite count: 0
has comment: http://stackoverflow.com/comment/51108060
has comment: http://stackoverflow.com/comment/34703087
type: AnsweredQuestion
score: 1
tagged with: java

http://stackoverflow.com/comment/34526851
comment on: http://stackoverflow.com/q/22666008
score: 0
type: QuestionComment
type: Comment
has text: How are you executing this? Extending Applet would suggest it to be run as an Applet but you have a `main()` method that essentially does nothing. Also, are you forced to use AWT components instead of Swing components?

http://stackoverflow.com/q/22670725
type: UnansweredQuestion
has body: This used to work with all previous versions of JAXB. I've upgraded to version 2.2.7 of JAXB and now xjc throws the following: java.lang.AssertionError: javax.xml.bind.JAXBException - with linked exception: [com.sun.xml.internal.bind.v2.runtime.IllegalAnnotationsException: 1 counts of IllegalAnnotationExceptions com.sun.xml.bind.api.impl.NameConverter is an interface, and JAXB can't handle interfaces. this problem is related to the following location: at com.sun.xml.bind.api.impl.NameConverter at public com.sun.xml.bind.api.impl.NameConverter com.sun.tools.xjc.reader.xmlschema.bindinfo.BIGlobalBinding.nameConverter at com.sun.tools.xjc.reader.xmlschema.bindinfo.BIGlobalBinding ]
has answer: http://stackoverflow.com/a/56170117
has answer: http://stackoverflow.com/a/45420244
score: 7
tagged with: java
has answer: http://stackoverflow.com/a/22670726
tagged with: jaxb
upvote count: 7
type: Question
has title: xjc fails to generate classes when using bindings
answer count: 3
downvote count: 0
favorite count: 0

http://stackoverflow.com/q/22790052
favorite count: 0
has body: I've got JPA entity class like this: @Entity @Table(name = "person") public class Person { @Id private Long id; private String lastName; private String firstName; private String country; private String gender; ... //setters and getters are omitted } I need searching method like this List&lt;Person&gt; findAll(Person searchCriteria) Usage example: Person criteria1 = new Person(); criteria1.setFristName("John"); criteria1.setCountry("Usa"); //returns all John from Usa with any lastName List&lt;Person&gt; searchingResult = findAll(criteria1); Person criteria2 = new Person(); criteria2.setGender("m"); criteria2.setCountry("Holland"); //returns all man from Holland List&lt;Person&gt; anotherSearchingResult = findAll(criteria2); My idea of findAll method is String query = "select * from person where "; if(criteria.getLastName() != null) query+= "last_name = "+ criteria.getLastName(); if(criteria.getGender() != null) query+= "gender = "+ criteria.getGender(); etc List&lt;Person&gt; = session.execute(query); But this is so ugly and looks like some overhead. Can anyone help me to invite that findAll method more prettily? I can use any java technology or framework.
accepted answer: http://stackoverflow.com/a/22790637
type: AnsweredQuestion
score: 1
tagged with: java
tagged with: hibernate
upvote count: 1
type: Question
possible better answer: http://stackoverflow.com/a/22790343
has answer: http://stackoverflow.com/a/22790343
answer count: 2
has answer: http://stackoverflow.com/a/22790637
tagged with: sql
tagged with: jpa
downvote count: 0
has title: Search hibernate entities by prototype

http://stackoverflow.com/a/22760547
has body: The bitwise ^ operator performs a bitwise exclusive OR operation. Applied, this does: false ^ false = false false ^ true = true true ^ false = true true ^ true = false When it comes to integer varibles (including the type char) the numbers are converted to their binary representation and then the operator takes place. For example: 3 ^ 5 = 011 ^ 101 = 110 = 6
type: Answer
upvote count: 4
downvote count: 0
answers question: http://stackoverflow.com/q/22760510
score: 4

http://stackoverflow.com/comment/34732650
has text: @dimzak Have you found any problem with solution2 until now?
score: 0
type: QuestionComment
comment on: http://stackoverflow.com/q/22775233
type: Comment

http://stackoverflow.com/comment/35213262
has text: I don't think this answers the question. OP asked about visibility and you talked about performance. You also say that final is at least as expensive as volatile because final variables incur some kind of barrier once per constructor invocation, but volatile variables incur that cost on every access, even on a single thread. Moreover, most often one wants a variable to be final because it's going to be constant, in which case you can't declare it volatile at all, so your conclusion that final variables have no benefit in concurrent programming doesn't make sense.
type: Comment
score: 0
comment on: http://stackoverflow.com/a/22745616
type: AnswerComment

http://stackoverflow.com/comment/34511732
type: QuestionComment
has text: I written the code as:String selectFromAssetTabelQuery = "SELECT SERIALNO FROM ASSET"; rs1 = destinationStmt.executeQuery(selectFromAssetTabelQuery); rs1.setFetchSize(100000); Vector<String> serialNoVec=new Vector<String>(); while(rs1.next()){ serialNoVec.add(rs1.getString("SERIALNO")); }
score: 0
comment on: http://stackoverflow.com/q/22657468
type: Comment

http://stackoverflow.com/comment/34725410
type: QuestionComment
comment on: http://stackoverflow.com/q/22776382
has text: No. Unless you tell it to. You can put something like `while(true) {Thread.sleep(1000)}`, then your program will never finish.
score: 0
type: Comment

http://stackoverflow.com/a/22759067
score: 5
has comment: http://stackoverflow.com/comment/34694463
upvote count: 5
accepted answer of: http://stackoverflow.com/q/22758851
has comment: http://stackoverflow.com/comment/34694126
has comment: http://stackoverflow.com/comment/34694087
answers question: http://stackoverflow.com/q/22758851
has comment: http://stackoverflow.com/comment/34694430
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/34694558
has comment: http://stackoverflow.com/comment/34695174
has comment: http://stackoverflow.com/comment/34697731
type: Answer
has comment: http://stackoverflow.com/comment/34694414
has comment: http://stackoverflow.com/comment/34695134
has body: you should use this: private final Game&lt;GamePlayer&gt; game; you're using the raw type of Game.

http://stackoverflow.com/q/22736103
tagged with: spring-mvc
has title: spring mvc 3.0 HTTP Status 404
tagged with: java
type: Question
has answer: http://stackoverflow.com/a/22736140
tagged with: tomcat
score: 0
answer count: 1
has body: I know this type of questions were asked earlier here, and I have gone through many but couldn't find the solution I'm looking for.... I'm keep on getting "HTTP Status 404" for my test spring mvc 3.0 app. whenever I hit "http://127.0.0.1:8080/com.test.andro/androTest1.jsp" via browser. This is simple app. which should read the 1st line of text from a file and should return the content as response. Below are configuration files, can someone please figure it out what's going wrong here. -------------------------------web.xml------------------------------- Archetype Created Web Application mvc-dispatcher org.springframework.web.servlet.DispatcherServlet 1 mvc-dispatcher /* contextConfigLocation /WEB-INF/mvc-dispatcher-servlet.xml org.springframework.web.context.ContextLoaderListener log4jConfigLocation WEB-INF/classes/log4j.properties org.springframework.web.util.Log4jConfigListener --------------------------------- mvc-dispatcher-servlet.xml -------------------------------------- <beans xmlns="http://www.springframework.org/schema/beans" xmlns:context="http://www.springframework.org/schema/context" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation=" http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.0.xsd http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-3.0.xsd"> <context:component-scan base-package="com.test.andro" /> </beans> -----------------------------------------Controller--------------------------------------- package com.test.controller; import java.io.BufferedReader; import java.io.File; import java.io.FileReader; import org.springframework.stereotype.Controller; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMethod; import org.springframework.web.bind.annotation.ResponseBody; @Controller public class AndroController { @RequestMapping(value="/androTest1.jsp", …
type: UnansweredQuestion
tagged with: spring

http://stackoverflow.com/comment/34656010
comment on: http://stackoverflow.com/q/22738023
type: QuestionComment
has text: I personally like GSON which allows you to map JSON objects to java objects that you define, you may want to look into it, https://code.google.com/p/google-gson/
score: 3
type: Comment

http://stackoverflow.com/a/22758862
has comment: http://stackoverflow.com/comment/34697780
has body: I would recommend to try to change your LAF in your main method, like: public static void main(String[] args){ Frame f; // Your (J)Frame or GUI-Class. // some code here... try{ UIManager.setLookAndFeel(new NimbusLookAndFeel()) // Because it seems to be Nimbus what you want. SwingUtilities.updateComponentTreeUI(f); // To refresh your GUI }catch(Exception e){ // Do whatever you want if a problem occurs like LAF not supported. } } Or you could do it without SwingUtilities.updateComponentTreeUI(f); if you call f.setVisible(true); after the change of your LAF.
has comment: http://stackoverflow.com/comment/34694273
has comment: http://stackoverflow.com/comment/34694371
has comment: http://stackoverflow.com/comment/34697762
answers question: http://stackoverflow.com/q/22758459
has comment: http://stackoverflow.com/comment/34694209
has comment: http://stackoverflow.com/comment/34697435
has comment: http://stackoverflow.com/comment/34694727
has comment: http://stackoverflow.com/comment/34694579
has comment: http://stackoverflow.com/comment/34693948
downvote count: 0
has comment: http://stackoverflow.com/comment/34694162
has comment: http://stackoverflow.com/comment/34693768
upvote count: 2
has comment: http://stackoverflow.com/comment/34694993
type: Answer
has comment: http://stackoverflow.com/comment/34694103
has comment: http://stackoverflow.com/comment/34694031
has comment: http://stackoverflow.com/comment/34695067
score: 2
has comment: http://stackoverflow.com/comment/34697805

http://stackoverflow.com/comment/34720725
has text: He is talking about screen sizes `hdpi` is a screen density suffix
score: 0
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/22773788

http://stackoverflow.com/q/22787260
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/22804502
has comment: http://stackoverflow.com/comment/34746775
has title: I need to separate my DOM from "persistence layer"
score: 1
tagged with: java
accepted answer: http://stackoverflow.com/a/22833321
type: Question
answer count: 2
tagged with: jtree
downvote count: 0
has comment: http://stackoverflow.com/comment/34745541
tagged with: persistence
has comment: http://stackoverflow.com/comment/34745230
has comment: http://stackoverflow.com/comment/34746199
tagged with: layer
has answer: http://stackoverflow.com/a/22833321
favorite count: 0
has comment: http://stackoverflow.com/comment/34745885
upvote count: 1
has body: I have created an application that refers to a list of users, allocated from an XML file to a JTree component, which can then be viewed and edited accordantly. My code so far: public class DomainModel extends JFrame { private JTree tree; private String fileSource = "users.xml"; private NodeList listOfUsers; private String objID; private JTextField textName; private JTextField textAge; private JTextField textDOB; private JButton editBtn; private JTextField textEditName; private JTextField textEditAge; private JTextField textEditDOB; private JButton saveBtn; private JButton cancelBtn; public DomainModel() { createGUI(); } public void createGUI() { JPanel mainPanel = new JPanel(); mainPanel.setLayout(new GridLayout(1, 2)); JPanel leftPanel = new JPanel(); leftPanel.setLayout(new GridLayout(1, 1)); leftPanel.setBorder(BorderFactory.createCompoundBorder( BorderFactory.createTitledBorder("Domain Model"), BorderFactory.createEmptyBorder(10, 10, 10, 10))); createTree(); tree.setLayout(new GridLayout(1, 1)); tree.setBorder(new EmptyBorder(10, 10, 10, 10)); tree.getSelectionModel().addTreeSelectionListener(new TreeSelectionListener() { public void valueChanged(TreeSelectionEvent e) { nodeChange(e); } }); JPanel rightPanel = new JPanel(); rightPanel.setLayout(new GridLayout(2, 1)); JPanel detailsPanel = new JPanel(new FlowLayout(FlowLayout.RIGHT)); detailsPanel.setBorder(BorderFactory.createCompoundBorder( BorderFactory.createTitledBorder("Node Details"), BorderFactory.createEmptyBorder(5, 5, 5, 5))); JLabel labelName = new JLabel("Name"); JLabel labelAge = new JLabel("Age"); JLabel labelDOB = new JLabel("DOB"); textName = new JTextField(15); textAge = new JTextField(15); textDOB = new JTextField(15); editBtn = new JButton("Edit"); editBtn.addActionListener(new ButtonListener()); detailsPanel.add(labelName); detailsPanel.add(textName); detailsPanel.add(labelAge); detailsPanel.add(textAge); detailsPanel.add(labelDOB); detailsPanel.add(textDOB); detailsPanel.add(editBtn); JPanel…
possible better answer: http://stackoverflow.com/a/22804502

http://stackoverflow.com/q/22804519
score: 0
answer count: 1
type: UnansweredQuestion
has title: how to check whether outlook is install in system or not using java?
has answer: http://stackoverflow.com/a/22804676
has body: hello i am searching about is outlook installed in system or not? i am working in Java. i have found few link but i cant reach at my goal.i found one method "Type officeType = Type.GetTypeFromProgID("Outlook.Application");", but i dont know which package i should import. i write following code but it gives me error. Type officeType = Type.GetTypeFromProgID("Outlook.Application"); if (officeType == null) { // Outlook is not installed. // Show message or alert that Outlook is not installed. } else { // Outlook is installed. // Continue your work. } help to solve this issue. thanks in advance...
type: Question
tagged with: outlook
has comment: http://stackoverflow.com/comment/34775852
has comment: http://stackoverflow.com/comment/34775665
tagged with: java

http://stackoverflow.com/comment/34735831
type: Comment
has text: Moreover, the interruption mechanism would be as useless, and as broken, as the deprecated *stopping* mechanism if that quote was indeed normative, and applicable to `Thread.interrupt()`.
comment on: http://stackoverflow.com/a/22782021
type: AnswerComment
score: 0

http://stackoverflow.com/a/22785750
type: AcceptedAnswer
type: Answer
downvote count: 0
score: 1
answers question: http://stackoverflow.com/q/22785525
accepted answer of: http://stackoverflow.com/q/22785525
has body: If you want to write the hire.toString(), simply use this : bw.write(hire.toStrig()); else Javac can't know if your calling bw.write(int)or bw.write(String) or other ...
upvote count: 1

http://stackoverflow.com/q/22722379
score: 1
tagged with: java
accepted answer: http://stackoverflow.com/a/23162463
upvote count: 1
has title: How to start an activity that is in a jar file?
type: Question
tagged with: intellij-idea
has comment: http://stackoverflow.com/comment/35421154
answer count: 1
downvote count: 0
has answer: http://stackoverflow.com/a/23162463
tagged with: android-simple-facebook
favorite count: 0
tagged with: android
has body: I'm working on an android app which uses facebook sdk and the android-simple-facebook library (a "wrapper" library). The android-simple-facebook lib depends on facebook sdk and my app depends on android-simple-facebook. I created a jar file (via Artificats in IDEA's Module Settings) containing the compile output of both libraries. I need the facebook sdk compile output too because I have this reference to facebook's LoginActivity in my AndroidManifest.xml: &lt;activity android:name="com.facebook.LoginActivity" android:label="@string/app_name" android:theme="@android:style/Theme.Translucent.NoTitleBar" /&gt; The reason I created this jar file is that i'm not the only developer working on this project, and I don't want anyone who develops this project to reference 2 libraries. I just want them to work with a static jar I create. So the jar get's created and everything is fine, no compile errors, but when calling the login() function, which starts facebook's LoginActivity I guess, I get the following exception: Unable to resume activity {com.example.example/com.facebook.LoginActivity}: android.content.res.Resources$NotFoundException: Resource ID #0x7f02000a What I suspect is, LoginActivity.onCreate() executes setContentView(R.layout.com_facebook_login_activity_layout) but I don't see any resources (the layout files for example) inside the jar file. Any help on how to accomplish my goal of having one working jar will be greatly appreciated! Some additional info about my setup: My libs folder and jar's contents: Artificat settings:
type: AnsweredQuestion

http://stackoverflow.com/q/22707942
tagged with: wcf-interoperability
has comment: http://stackoverflow.com/comment/34629498
type: Question
tagged with: c#
has title: Java Client(Metro) Connecting to WCF Created with ExpressInterop Bindings
linked to: http://stackoverflow.com/q/22332829
has body: I have a WCF Service created with the help of ExpressInteropBindings Extension for VS2010. Things Mentioned while creating ExpressInteropBindings: Interoperability Platform : Metro Main Settings 1)Security : Username over certificate 2)Secure Conversation : NO 3)Reliable Messaging : NO Advanced Settings: 1)Algorithm : Default 2)Encoding : Default Certificate Selection: 1) Store Location : Localmachine 2) Store Name: Root 3) Certificate: I Created one with the CodeProject.com link Then I created the Simple Java Project using NetBeans added a webservice client with wsdl location created my own truststore and added the above created certificate, Given the username and password as it is Custom Authentication by "Edit Web Service Attributes" in Netbeans when i try to call the Service it throws &gt; java.lang.NullPointerException at &gt; java.util.PropertyResourceBundle.handleGetObject(PropertyResourceBundle.java:166) &gt; at java.util.ResourceBundle.getObject(ResourceBundle.java:441) at &gt; java.util.ResourceBundle.getString(ResourceBundle.java:407) at &gt; java.util.logging.Formatter.formatMessage(Formatter.java:118) at &gt; java.util.logging.SimpleFormatter.format(SimpleFormatter.java:151) at &gt; java.util.logging.StreamHandler.publish(StreamHandler.java:211) at &gt; java.util.logging.ConsoleHandler.publish(ConsoleHandler.java:116) at &gt; java.util.logging.Logger.log(Logger.java:731) at &gt; java.util.logging.Logger.doLog(Logger.java:754) at &gt; java.util.logging.Logger.log(Logger.java:864) at &gt; com.sun.xml.ws.security.impl.policy.CertificateRetriever.digestBST(CertificateRetriever.java:136) &gt; at &gt; com.sun.xml.wss.jaxws.impl.SecurityClientTube.processRequest(SecurityClientTube.java:211) &gt; at com.sun.xml.ws.api.pipe.Fiber.__doRun(Fiber.java:629) at &gt; com.sun.xml.ws.api.pipe.Fiber._doRun(Fiber.java:588) at &gt; com.sun.xml.ws.api.pipe.Fiber.doRun(Fiber.java:573) at &gt; com.sun.xml.ws.api.pipe.Fiber.runSync(Fiber.java:470) at &gt; com.sun.xml.ws.client…
score: 0
tagged with: netbeans
tagged with: wcf
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/35134882
answer count: 0
tagged with: java

http://stackoverflow.com/comment/34786099
comment on: http://stackoverflow.com/q/22808066
has text: Thanks for reply @Ravinder. I place the reading file in 30 in 30 minutes. So in one hour he made ​​a 2 reading file. If these two readings the file is blank he warned. You undestand my answer? Thanks again
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/a/25399805
type: Answer
has body: 1.Check Whether the control comes to the controller by printing some values in the console from the controller.If it prints then there is no problem with the request mapping. 2.Ensure the path to the jsp provided under the viewResolver bean matches with the path of the jsp file on the server. 3.If the controller does not reach the controller then try changing the @RequestMapping from "Login.htm" to "/Login.htm" because the browser I believe usually appends "/" before submitting a form. If I have the same problem I would solve it the above way. :)
answers question: http://stackoverflow.com/q/22679712
score: 0

http://stackoverflow.com/a/22793119
has comment: http://stackoverflow.com/comment/54199563
downvote count: 1
answers question: http://stackoverflow.com/q/22793006
has comment: http://stackoverflow.com/comment/68125337
type: Answer
has comment: http://stackoverflow.com/comment/54411857
score: 70
has comment: http://stackoverflow.com/comment/54369383
has comment: http://stackoverflow.com/comment/54155674
has comment: http://stackoverflow.com/comment/53535870
has body: It works with params if you capture an array with one element, that holds the current index. int[] idx = { 0 }; params.forEach(e -&gt; query.bind(idx[0]++, e)); The above code assumes, that the method forEach iterates through the elements in encounter order. The interface Iterable specifies this behaviour for all classes unless otherwise documented. Apparently it works for all implementations of Iterable from the standard library, and changing this behaviour in the future would break backward-compatibility. If you are working with Streams instead of Collections/Iterables, you should use forEachOrdered, because forEach can be executed concurrently and the elements can occur in different order. The following code works for both sequential and parallel streams: int[] idx = { 0 }; params.stream().forEachOrdered(e -&gt; query.bind(idx[0]++, e));
has comment: http://stackoverflow.com/comment/53503634
has comment: http://stackoverflow.com/comment/79660789
upvote count: 71

http://stackoverflow.com/q/22709987
tagged with: security
answer count: 1
downvote count: 0
favorite count: 0
has body: I just wrote an application using JWS. However, when I tried to access it over on a client computer over a network, it requires the Java Security Level to be set to minimum. At this rate, each client will have to reduce the Java security levels on their computers. Is there a way to avoid this? P.S I'm using Java 7 to run and I also use Netbeans to build the application
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/34612911
has title: Java Web Start Application requires medium secuirity
score: 1
tagged with: java
upvote count: 1
type: Question
has comment: http://stackoverflow.com/comment/34607819
has answer: http://stackoverflow.com/a/22727731
tagged with: java-web-start

executorservice
type: Tag
tags question: http://stackoverflow.com/q/22800319
tags question: http://stackoverflow.com/q/22657019
tag name: executorservice
tags question: http://stackoverflow.com/q/22748273
tags question: http://stackoverflow.com/q/22738912
tags question: http://stackoverflow.com/q/22690415
tags question: http://stackoverflow.com/q/22693203
tags question: http://stackoverflow.com/q/22656737
tags question: http://stackoverflow.com/q/22655266
tags question: http://stackoverflow.com/q/22755151

http://stackoverflow.com/a/22678656
answers question: http://stackoverflow.com/q/22678056
type: Answer
has body: Are you certain that you want to use a ScrollView for this? It sounds like you might be better served with a ListView. In case a ListView is what you need, this tutorial on vogella.com is one of the best tutorials I know for how to use them.
score: 0

http://stackoverflow.com/q/22676105
upvote count: 1
tagged with: persistence.xml
type: Question
accepted answer: http://stackoverflow.com/a/22679559
answer count: 1
tagged with: jpa
downvote count: 0
favorite count: 0
tagged with: objectdb
has body: while following this tutorial: http://www.objectdb.com/tutorial/jpa/eclipse I receive the following error: Exception in thread "main" [ObjectDB 2.5.4_05] javax.persistence.PersistenceException Type tutorial.model.Point is not found (error 301) at com.objectdb.jpa.EMImpl.persist(EMImpl.java:437) at objectdb.tutorial.main.Main.main(Main.java:25) Caused by: com.objectdb.o.TEX: Type tutorial.model.Point is not found at com.objectdb.o.MSG.e(MSG.java:107) at com.objectdb.o.TYM.ay(TYM.java:1017) at com.objectdb.o.TYM.ap(TYM.java:807) at com.objectdb.o.TYM.ao(TYM.java:757) at com.objectdb.o.TYM.at(TYM.java:873) at com.objectdb.o.TYM.aw(TYM.java:945) at com.objectdb.o.OBM.bB(OBM.java:371) at com.objectdb.o.OBM.bB(OBM.java:257) at com.objectdb.jpa.EMImpl.persist(EMImpl.java:434) ... 1 more Caused by: java.lang.ClassNotFoundException: tutorial.model.Point at com.objectdb.o.TYM.findClass(TYM.java:1033) at com.objectdb.o.ACL.loadClass(ACL.java:131) at java.lang.ClassLoader.loadClass(ClassLoader.java:247) at com.objectdb.o.TYM.ay(TYM.java:1013) ... 8 more` I am looked at this post (Problems searching empty user database with ObjectDB), but for some reason, my instance of EntityManager does not have the member function getMetamodel(). So, I tried to create my own persistence unit which I have below with my code. I still receive the runtime error which seems to occur on em.persist(p) in the first for loop. package objectdb.tutorial.main; import javax.persistence.*; import objectdb.tutorial.model.Point; import java.util.*; public class Main { public static void main(String[] args) { // Open a database connection // (create a new database if it doesn't exist yet): EntityManagerFactory emf = Persistence.createEntityManagerFactory("my-pu"); EntityManager em = emf.createEntityManager(); // Store 1000 Point objects in the database: em.getTransaction().begin(); for (int i = 0; i < 1000; i++) { Point p = new Point(i, i); em.persist(p); } em.getTransaction().commit(); // Find the number of …
linked to: http://stackoverflow.com/q/20752124
has answer: http://stackoverflow.com/a/22679559
type: AnsweredQuestion
score: 1
tagged with: java
has title: ObjectDB: Persistence Exception type not found error 301

http://stackoverflow.com/q/22708732
has comment: http://stackoverflow.com/comment/34924485
tagged with: image
downvote count: 0
tagged with: frame
score: 1
favorite count: 0
type: Question
has body: Im extracting frames from a video (using javacv) and those are rotated by 180° because the video was taken with a tablet this way. How can I get the position (if the head is pointing down or not) of a video/frame? Because some videos are ok and others not.
tagged with: android
has comment: http://stackoverflow.com/comment/34668505
tagged with: video
tagged with: java
has title: Video/Frame rotation in android
upvote count: 1
has comment: http://stackoverflow.com/comment/39445022
answer count: 0
type: UnansweredQuestion

http://stackoverflow.com/comment/34670212
type: QuestionComment
comment on: http://stackoverflow.com/q/22746100
has text: [Java synchronization](http://docs.oracle.com/javase/tutorial/essential/concurrency/sync.html)
score: 0
type: Comment

http://stackoverflow.com/comment/34672541
has text: possible duplicate of [Hibernate don't update entity after changing something directly in database?](http://stackoverflow.com/questions/22526050/hibernate-dont-update-entity-after-changing-something-directly-in-database)
type: Comment
comment on: http://stackoverflow.com/q/22747026
score: 0
type: QuestionComment

http://stackoverflow.com/q/22705921
type: Question
tagged with: bufferedreader
score: -1
answer count: 2
upvote count: 0
favorite count: 0
has answer: http://stackoverflow.com/a/22720672
has body: I'm trying to write a few helper methods to take care of reading and writing an encrypted file. I have two methods which successfully fulfill this and return an InputStream or an OutputStream (which are really the Cipher version) that I can use to read or write to the file. I have confirmed that these methods work peachy keen when wrapped with an Object stream and used to read and write an encrypted Object to file. However, the problem arises when I try to read from an encrypted text file. I can verify that the String I feed it is being encrypted and written to the correct file, but when I try to read back from this file, the BufferedReader reports an EOF (null). The InputStream.available() method returns 0. I can assure that the file is there, is being found, and that the InputStream itself is not null. Can anybody tell me what might cause this? Reading/Writing encrypted Object works beautifully (CorruptedStreamException is good here): private static void testWriteObject() { String path = "derp.derp"; Derp start = new Derp("Asymmetril: " + message, 12543, 21.4, false); FilesEnDe.writeEncryptedObject(key, "derp.derp", start); echo("original"); echo("&gt;"+start); Object o; try { ObjectInputStream ois = new ObjectInputStream(ResourceManager.getResourceStatic(path)); o = ois.readObject(); echo("encrypted"); echo("&gt;"+o); ois.close(); } catch (Exception e) { e.printStackTrace(); } o = FilesEnDe.readEncryptedObject(key, path); echo("decrypted"); echo("&gt;"+o); } Output: original &gt;Asymmetril: WE CAME, WE SAW, WE CONQUERED.; 12543; 21.4; false [RM] &gt; Trying to load resource: derp.derp java.io.StreamCorruptedException [RM] &gt; Trying to load resource: derp.derp decrypted &gt;Asymmetril: WE CAME, WE SAW, WE CONQUERED.; 12543; 21.4; false Trying to decrypt the text file doesn't (note that the encrypted text is readable): private static void testWriteFile() { String path = "EncryptedOut.txt"; BufferedReader bis1, bis2; try { BufferedOutputStream os = new BufferedOut…
possible better answer: http://stackoverflow.com/a/22706396
accepted answer: http://stackoverflow.com/a/22720672
has answer: http://stackoverflow.com/a/22706396
type: AnsweredQuestion
tagged with: java
tagged with: inputstream
has title: CipherInputStream is Empty when trying to decrypt file
downvote count: 1

http://stackoverflow.com/comment/34713814
comment on: http://stackoverflow.com/a/22769929
type: AnswerComment
score: 0
type: Comment
has text: You need to be more careful. When you put directories in your classpath, if they are not included in the path, then you need to put "./bin:" instead of "bin:", etc. The issue you are having has nothing to do with Java and everything to do with referencing paths on Unix. Windows automatically puts the current directory in the path unlike Linux (unless you configure it that way on purpose).

http://stackoverflow.com/a/22769616
has comment: http://stackoverflow.com/comment/34713365
downvote count: 0
has comment: http://stackoverflow.com/comment/34713135
type: Answer
has body: The following form is preferable: &lt;s:if test="userFullyLogged"&gt;Content&lt;/s:if&gt; See Struts2 if documentation: the test attribute is an expression. Struts will resolve expression properties by calling your action class getters, assuming your getters are named according to JavaBean specification (which is the case, in your example).
answers question: http://stackoverflow.com/q/22769224
score: 1
has comment: http://stackoverflow.com/comment/34739744
has comment: http://stackoverflow.com/comment/34714449
upvote count: 1

http://stackoverflow.com/a/22781234
accepted answer of: http://stackoverflow.com/q/22781213
answers question: http://stackoverflow.com/q/22781213
has comment: http://stackoverflow.com/comment/34772156
has body: For HashMap&lt;Pair&lt;Long, Long&gt;&gt;, type parameter K is inferred as Pair&lt;Long, Long&gt;. So you need to pass Class&lt;Pair&lt;Long, Long&gt;&gt; but you're passing Class&lt;Pair&gt;. You need to use appropriate cast: calculateSimilarity(newValue1, (Class&lt;Pair&lt;Long, Long&gt;&gt;)(Class&lt;?&gt;)Pair.class); The cast is required because you can't directly get the required Class type using .class literal.
score: 3
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/34734890
has comment: http://stackoverflow.com/comment/34734195
type: Answer
upvote count: 3

http://stackoverflow.com/q/22785597
has comment: http://stackoverflow.com/comment/34741536
tagged with: datetime
has answer: http://stackoverflow.com/a/22785883
has comment: http://stackoverflow.com/comment/34741513
type: UnansweredQuestion
tagged with: java
upvote count: 1
downvote count: 1
has comment: http://stackoverflow.com/comment/34741498
type: Question
has comment: http://stackoverflow.com/comment/34741625
has answer: http://stackoverflow.com/a/22785812
has body: I have a list of dates and a target date object. I need to find the nearest previous date(before the target date). I have tried the following but I don't think it will work for only previous date. private Date getDateNearest(List&lt;Date&gt; dates, Date targetDate) { Date returnDate = targetDate; for (Date date : dates) { if (date.compareTo(targetDate) &lt;= 0 &amp;&amp; date.compareTo(returnDate) &gt; 0) { returnDate=date; } } return returnDate; }
tagged with: date
has title: Find the nearest previous date
has comment: http://stackoverflow.com/comment/34741402
score: 0
answer count: 3
linked to: http://stackoverflow.com/q/186311
favorite count: 0
has comment: http://stackoverflow.com/comment/34741558
has answer: http://stackoverflow.com/a/22785858

http://stackoverflow.com/comment/34639158
score: 0
type: QuestionComment
comment on: http://stackoverflow.com/q/22728431
type: Comment
has text: 1) [What have you tried?](http://www.whathaveyoutried.com/) Showing your effort will encourage others to help. 2) For better help sooner, post an [MCVE](http://stackoverflow.com/help/mcve) (Minimal Complete and Verifiable Example). 3) One way to get image(s) for an example is to hot-link to the images seen in [this answer](http://stackoverflow.com/a/19209651/418556).

http://stackoverflow.com/comment/77068645
comment on: http://stackoverflow.com/a/39148570
type: AnswerComment
type: Comment
has text: luckily my centos is just the same like fedora :)
score: 0

http://stackoverflow.com/q/22765603
upvote count: 1
type: Question
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/22766051
has answer: http://stackoverflow.com/a/34247031
tagged with: java
tagged with: eclipse
has answer: http://stackoverflow.com/a/52627245
has answer: http://stackoverflow.com/a/67603026
has answer: http://stackoverflow.com/a/71406292
has body: The project description file (.project) for 'AutoClicker' is missing. This file contains important information about the project. The project will not function properly until this file is restored. I had moved computers in class and moved all my projects on a 1TB hard drive over to the new computer and I had gotten all the projects to work, but one. I have no idea how to fix it, I feel like the path to the file is wrong, but I don't see anything wrong with it. If anyone has any idea on how to fix this error, it would be greatly appreciated.
downvote count: 0
possible better answer: http://stackoverflow.com/a/52627245
has comment: http://stackoverflow.com/comment/34705969
score: 1
answer count: 6
favorite count: 0
has title: 'Open Project' has encountered an error
tagged with: android
has answer: http://stackoverflow.com/a/22766051
has comment: http://stackoverflow.com/comment/34707061
has answer: http://stackoverflow.com/a/26321885

http://stackoverflow.com/q/22768419
score: 0
tagged with: concatenation
has answer: http://stackoverflow.com/a/22768534
answer count: 1
tagged with: string
favorite count: 0
type: UnansweredQuestion
tagged with: android
has body: I've got many resources with names based on a pattern: R.drawable.small_house_red R.drawable.small_house_blue R.drawable.big_house_black R.drawable.small_tree_red I've got 3 strings: size, type, color. I can put all required resources to map, and get them by concated string but is it possible to get them without manually entering all combinations to the map?
tagged with: java
upvote count: 1
downvote count: 1
type: Question
has comment: http://stackoverflow.com/comment/34710922
has comment: http://stackoverflow.com/comment/34710986
has title: Getting Resource from strings

http://stackoverflow.com/comment/34635177
has text: you need to update button text every second? Then look at the `Timer` class: http://developer.android.com/reference/java/util/Timer.html
type: AnswerComment
comment on: http://stackoverflow.com/a/22726084
score: 0
type: Comment

http://stackoverflow.com/a/22806737
has body: That's how you set the size of array of objects Object[] array = new Object[size]; And that's how you set size of ArrayList List&lt;Object[]&gt; obj = new ArrayList&lt;Object[]&gt;(size);
score: 1
upvote count: 1
downvote count: 0
answers question: http://stackoverflow.com/q/22806661
type: Answer

http://stackoverflow.com/q/22801066
upvote count: 6
linked to: http://stackoverflow.com/q/6477318
has answer: http://stackoverflow.com/a/22846365
has comment: http://stackoverflow.com/comment/34769816
tagged with: classloader
linked to: http://stackoverflow.com/q/20913149
answer count: 1
linked to: http://stackoverflow.com/q/14622300
tagged with: java
type: UnansweredQuestion
linked to: http://stackoverflow.com/q/6069702
has title: Java replace jar at runtime
has body: I encounter some problems when I replace jar at runtime. I creaded 2 jars all named A.jar, the jar just contain 1 class named A.class, the code for A.class is very simple, the first jar is: System.out.println("before replacement"), the second jar is: System.out.println("after replacement"), I want to replace the first jar with the second jar at the runtime, so I put the first jar under C: and the second jar under C:\test\ my codes are: import java.lang.reflect.Method; public class B { public static void main(String[] args) throws Exception{ final String src = "C:\\test\\A.jar"; final String desc = "C:\\"; System.out.println("start to copy A.jar"); String cmd = "cmd /c xcopy " + src + " " + desc + " /y"; Runtime.getRuntime().exec(cmd).waitFor(); System.out.println("finish to copy A.jar"); Class&lt;?&gt; cls = Class.forName("A"); Object obj = cls.newInstance(); Method m = cls.getMethod("test"); m.invoke(obj, null); /*A a = new A(); a.test();*/ } } I found 2 problems: when I run the codes in the eclipse, the result is "after replacement", it's OK. But when I run the same code using command line, it will throw ClassNotFoundException. What's the problem with the command line? In the eclipse when I replace Java reflection codes Class&lt;?&gt; cls = Class.forName("A"); Object obj = cls.newInstance(); Method m = cls.getMethod("test"); m.invoke(obj, null); with A a = new A(); a.test(); the output is "before replacement". I think the A class should be loaded at the runtime,so when new A() the class should be first loaded, at that time the jar has been replaced, why the output still "before replacement" and jave reflection codes works fine? Give me some directions please. Thanks! Add more, I used -verbose:class to print all class load information, I found for class.forname the A.jar is loaded after the replacement finished, whereas for new A() the A.jar is loaded successful between my codes System.out.println("start to copy A.jar") and System.out.println("finish to copy A.jar"…
downvote count: 0
score: 6
has comment: http://stackoverflow.com/comment/34820771
favorite count: 0
type: Question
has comment: http://stackoverflow.com/comment/34769871

http://stackoverflow.com/comment/34565285
score: 0
type: AnswerComment
has text: but I need it in my laptop !!
comment on: http://stackoverflow.com/a/22686749
type: Comment

http://stackoverflow.com/comment/34537467
type: QuestionComment
type: Comment
has text: "It is not guaranteed that the convertView will have been previously created by getGroupView(int, boolean, View, ViewGroup)." So if you're not setting the holder on getChildView you'll probably have a nullpointer.
comment on: http://stackoverflow.com/q/22671995
score: 0

http://stackoverflow.com/comment/34728190
type: AnswerComment
has text: Using Integer is important when dealing with items that must take a Object. For example, you can have an ArrayList<Integer> but you cannot have an ArrayList<int>; because, int cannot be cast to an Object, so the `add(T item)` method cannot be implemented. (as `int` is not a subclass of `Object`, while `Integer` is). These days auto-boxing hides most of these distinctions, but occasionally it is still important to understand the differences.
type: Comment
comment on: http://stackoverflow.com/a/22777842
score: 0

http://stackoverflow.com/a/33677394
score: 0
has comment: http://stackoverflow.com/comment/55128669
answers question: http://stackoverflow.com/q/22710155
type: Answer
has body: You can achieve this using maps within a map. Create maps corressponding to each row, with column name as key and cell values as values. Now the parent map will contain a unique row value as key, say Company name, and maps as the value. While retriving, 1st retrive the row map using the unique key and then out of that map, use he column name as key to get values. Row maps: Map(String, String) Parent map: Map(String, Map)

http://stackoverflow.com/comment/64300214
type: AnswerComment
comment on: http://stackoverflow.com/a/22684902
type: Comment
has text: If it does not deep copy the elements of list then its not deep copy.
score: 0

http://stackoverflow.com/a/22668230
has body: show me the onclick method, and the container u have fragment one in... its one of two things, either you are programmatically adding a view which already exists, or you are tryin to update the ui without a handler.... handlers can be worked around in fragments, so im assuming its the first one....
type: Answer
score: 0
answers question: http://stackoverflow.com/q/22668049

http://stackoverflow.com/comment/34670317
score: 0
type: AnswerComment
type: Comment
has text: @AnandK: Nothing. You are done. The contents of `libs/` are automatically added both to your compile-time classpath and to your runtime classpath.
comment on: http://stackoverflow.com/a/22745739

http://stackoverflow.com/q/22780692
has title: Java Use string as object call
possible better answer: http://stackoverflow.com/a/22780909
has answer: http://stackoverflow.com/a/22781145
downvote count: 0
tagged with: string
has answer: http://stackoverflow.com/a/22780909
has answer: http://stackoverflow.com/a/22780987
has comment: http://stackoverflow.com/comment/34733018
favorite count: 0
has comment: http://stackoverflow.com/comment/34778235
answer count: 4
type: AnsweredQuestion
has body: Good Afternoon, i would like to ask regarding the methods to use string as reference. Let say, that i got two object of type LinkedList named ChinaShip and HongkongShip Normally, if i wanted to access a method (for example getFirst()) i will type ChinaShip.getFirst() Now, let say that in other object, i got a variable Destination which content is a String. The example of the Content will be China and Hongkong Is it possible to use the content of the variable as the name for accessing the LinkedList object? my approach first would be concatenate the variable first, which will be Destination + "Ship" This will produce a string which is ChinaShip and HongkongShip The reason i'm doing this way rather than comparing the string is that the Destination consist of hundreds of posibilities. Thank You Very Much. Regards,
accepted answer: http://stackoverflow.com/a/22781145
score: 1
tagged with: java
upvote count: 1
has comment: http://stackoverflow.com/comment/34732718
type: Question
tagged with: object
has answer: http://stackoverflow.com/a/22783987

http://stackoverflow.com/q/22685447
linked to: http://stackoverflow.com/q/5693623
tagged with: processbuilder
possible better answer: http://stackoverflow.com/a/22686006
has answer: http://stackoverflow.com/a/22686006
type: Question
tagged with: gwt
has answer: http://stackoverflow.com/a/22687721
type: AnsweredQuestion
linked to: http://stackoverflow.com/q/2413722
tagged with: java
score: 0
tagged with: bash
answer count: 2
tagged with: gwt-rpc
accepted answer: http://stackoverflow.com/a/22687721
has body: I want to call a bash script from GWT server I coded up my first application with GWT/RPC, and I need to call a bash script on the server side (from MyOwnServiceImpl extends RemoteServiceServlet implements MyOwnService). ProcessBuilder doesn't work To do that, I confess that I am using java.lang.ProcessBuilder, which is apparently "not supported by GAE" (I just ignored the warning). As it is running on the server side, it seemed to me that it should work anyways. I feel that I am missing something. Something seems to be preventing the call from being executed, even though the required packages are correctly imported, the binaries are found, the execution doesn't crash. But the call is just not successful (for example even mkdir is not executed on the server). Related posts weren't much help... How to execute a Unix shell script via GWT? (does not give a complete answer, and I could not simply comment on the answer) GWT + ProcessBuilder (mentions precisely the solution I implemented which is not working for me, see above) Any thoughts on this would be much appreciated, thanks!
has title: How to call a bash script from GWT-RPC server (Java)

http://stackoverflow.com/comment/34676365
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/22749336
has text: None of the lines of code make any sense (except the ones with `}`) You can't program based on what you meant the code to do. Can you show us what code you have which compiles at least.

http://stackoverflow.com/q/22791429
has comment: http://stackoverflow.com/comment/34751969
has comment: http://stackoverflow.com/comment/34753438
tagged with: togglebutton
tagged with: java
has body: For school I'm making an Android application which is basically a drum pattern sequencer. My Android application contains 64 Toggle Buttons which I drew programmatically in my MainActivity.java in OnCreate(). How I drew 16 of the 64 Toggle Buttons: LinearLayout.LayoutParams lp = new LinearLayout.LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.MATCH_PARENT, (float)1.0); lp.width = (int)TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, 0, getResources().getDisplayMetrics()); int i; /* 16 toggle buttons for Row 0 */ int id0; for (i=0; i&lt;16; i++) { ToggleButton myButton = new ToggleButton(this); myButton.setText(null); myButton.setTextOff(null); myButton.setTextOn(null); myButton.setBackgroundResource(R.drawable.statelist); LinearLayout ll0 = (LinearLayout)findViewById(R.id.LinearLayoutRow0); ll0.addView(myButton, lp); id0 = Integer.parseInt(Integer.toString(110) + Integer.toString(i)); myButton.setTag(id0); myButton.setOnClickListener(new View.OnClickListener() { public void onClick(View v) { Log.i("MainActivity", "Button Tag: " + v.getTag().toString() ); } }); } Now what I'm trying to do is: Make it possible to select any or all of the 64 Toggle Buttons by simply dragging a finger across the screen. To be specific: The Toggle Buttons will initially be off, then dragging a finger across the screen will turn on all the Toggle Buttons I have "drawn over." After that I want to add a button in the Action Bar to select if dragging will turn the Toggle Buttons on or off but not both.
has comment: http://stackoverflow.com/comment/34752986
type: Question
downvote count: 0
favorite count: 0
linked to: http://stackoverflow.com/q/5597592
tagged with: android
score: 2
answer count: 0
upvote count: 2
type: UnansweredQuestion
tagged with: gestures
has title: How do I activate Android ToggleButtons by dragging my finger across them?

http://stackoverflow.com/a/22769675
has comment: http://stackoverflow.com/comment/34738929
accepted answer of: http://stackoverflow.com/q/22769014
upvote count: 3
score: 3
has comment: http://stackoverflow.com/comment/34714472
type: AcceptedAnswer
downvote count: 0
answers question: http://stackoverflow.com/q/22769014
has body: The JVM running on your Intel stores int as little-endian.
type: Answer
has comment: http://stackoverflow.com/comment/34714843

http://stackoverflow.com/comment/34765383
score: 0
comment on: http://stackoverflow.com/q/22798401
has text: Well it apparently can read that file type. Done and done.
type: Comment
type: QuestionComment

http://stackoverflow.com/a/22776401
has comment: http://stackoverflow.com/comment/34725586
has comment: http://stackoverflow.com/comment/34725279
has comment: http://stackoverflow.com/comment/34770018
answers question: http://stackoverflow.com/q/22776125
has comment: http://stackoverflow.com/comment/34752666
has comment: http://stackoverflow.com/comment/34725565
has body: public class Machine{ private String dataCenter; private String machineName; private String hostname; private int zeroCount = 0; //getters setters, except for zeroCount // constructor with datacenter,machine as args private boolean isEligibleForLogging(String dataSyncs){ if(dataSyncs.equals("0")){ zeroCount++; }else{ zeroCount = 0; } if(zeroCount &gt; 5){ zeroCount = 0; return true; } return false; } } static List&lt;Machine&gt; machines = new ArrayList&lt;Machine&gt;(); static{ Machine machine1 = new Machine("DC1", "name1","hostname1"); machines.add(machine1); //repeat the above two lines per each machine. } protected static void generalUtility() { try { for (Machine machine : machines) { String host_name = machine.getHostName(); String url = "http://" + host_name + ":8080/textbeat"; String dataSyncs = //execute url and get datasyncs if(machine.isEligibleForLogging()){ System.out.println(machine.getName() + ... +machine.getDataCenter() + ... + dataSyncs......); } } } catch (Exception e) { e.printStackTrace(); } }
score: 0
type: Answer

http://stackoverflow.com/comment/34729808
type: Comment
has text: Well, that's exactly the stuff you would like to remove from my code by using EasyMockSupport...
comment on: http://stackoverflow.com/a/22766344
score: 0
type: AnswerComment

http://stackoverflow.com/comment/52383591
type: QuestionComment
has text: Did you ever manage to solve this? I've got the exact same issue and cannot seem to figure out what the issue is
score: 0
type: Comment
comment on: http://stackoverflow.com/q/22799024

http://stackoverflow.com/a/22734934
has comment: http://stackoverflow.com/comment/34663444
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/34651114
has body: First of all you can't store the number 10 as a single char. It is two chars, 1 and 0. So the result array has to be something else than a char array. If it is int your working with then you are probably best of storing them in an int array. intarray[i][j] = (letters[i][j] - 'a'); where intarray is your array of int values that has the same size as the char array. Other option is to make a string array if you must store the result in the same array and convert it to a number and then into a string. Like this String [][] letters = {{"i", "u"}, {"a", "g"}, {"e", "k"}}; for (int i = 0; i &lt; letters.length; i++) { for (int j = 0; j &lt; letters[i].length; j++) { if (letters[i][j].charAt(0) &gt;= 'a' &amp;&amp; letters[i][j].charAt(0) &lt;= 'z') { letters[i][j] = Integer.toString((letters[i][j].charAt(0) - 'a'); } } } The reason is that the ascii table only has the numbers 0 to 9 as symbols. So in your case you get the first 10 letters to convert but after that you start getting various symbols in the ascii table. k for example would be :, l is ; m is &lt; and so on. When you are working with converting chars to numbers you are better working with them as int as they are easier to do math on. You could do the same without converting it into an int but that mean you need to find out char - 'a' is bigger than 10. If so you need get the number divided by 10 and then after that the modulo of the number and give each of them the associated ascii symbol to make them into a string. This is a lot more complex and hard to do, specially considering how easy this is by just doing it with ints. There are 2 other options for you but I still feel the string option above is by far the easiest. First would be to have the 2d array as an int. You could then initialize the ints to be letters. Then you can do arithmetic on them to find the number they fit. Like this: int [][] letters = {{'i', 'u'}, {'a', 'g'}, {'e', 'k'}}; for (int i = 0; i &lt; letters.length; i++) { for (int j = 0; j &l…
has comment: http://stackoverflow.com/comment/34672581
type: Answer
has comment: http://stackoverflow.com/comment/34650833
score: 2
has comment: http://stackoverflow.com/comment/34650854
accepted answer of: http://stackoverflow.com/q/22734785
upvote count: 2
has comment: http://stackoverflow.com/comment/34675518
has comment: http://stackoverflow.com/comment/34672474
has comment: http://stackoverflow.com/comment/34672404
has comment: http://stackoverflow.com/comment/34668775
has comment: http://stackoverflow.com/comment/34671942
has comment: http://stackoverflow.com/comment/34660074
has comment: http://stackoverflow.com/comment/34650751
answers question: http://stackoverflow.com/q/22734785
has comment: http://stackoverflow.com/comment/34671640
has comment: http://stackoverflow.com/comment/34671962
has comment: http://stackoverflow.com/comment/34672372

http://stackoverflow.com/comment/34676066
type: Comment
score: 1
comment on: http://stackoverflow.com/a/22748844
type: AnswerComment
has text: This solves a problem in the original code but is not the proper way to wait for threads to complete. There's almost always a better approach than calling Thread.sleep, whatever the problem. See the invokeAll answer below.

http://stackoverflow.com/a/22698951
type: Answer
upvote count: 3
has body: you need to qualify the enclosing class: EnclosingClass.super.onBackPressed(); I'm not 100% sure that works for super but it does for this.
score: 3
downvote count: 0
answers question: http://stackoverflow.com/q/22698939

http://stackoverflow.com/q/22664634
tagged with: uiinclude
tagged with: ajax
type: Question
tagged with: jsf
has body: I'm new to jsf. I'm trying to send value to java bean from commandButton to change src in ui:include and render it with ajax so I when clicked commandButton I could refresh part from the page without load the whole page and below is my code \\\\\\\ The Bean File import javax.enterprise.context.RequestScoped; import javax.inject.Named; @Named("urls") @RequestScoped public class URLPagesBean { private String urlSRC = ""; public String getUrlSRC() { return urlSRC; } public void setUrlSRC(String urlSRC) { this.urlSRC = urlSRC; } public String getURL() { String url = ""; if(urlSRC == "page1" || urlSRC == "" || urlSRC == null) { url = "page1.xhtml"; } else if (urlSRC == "page2") { url = "page2.xhtml"; } return url; } } ///////////// The Index file \\\\\\\\\\\\\\\\\\\\\\ <h:body > <h:panelGroup layout="block" styleClass="mainContentBox"> <h:panelGroup layout="block" styleClass="mainTopBox"> <h:panelGroup layout="block" styleClass="logoBox"></h:panelGroup> </h:panelGroup> <h:form id="subMenuForm"> <h:panelGroup layout="block" styleClass="mainLiftBox"> <h:panelGroup id="msgBoard" layout="block" styleClass="mainMenuButtons">Message Board <h:panelGroup layout="block" styleClass="subMenuBox"> <h:commandButton id="showMsgBoard" styleClass="subMenuButtonCommand" value="Page1"/> </h:panelGroup> </h:panelGroup> <h:panelGroup layout="block" styleClass="mainMenuButtons">Registrations Book <h:panelGroup layout="block" styleClass="subMenuBox"> <h:commandButton id="registrInternalApprov" styleClass="subMenuButtonCommand" value="Page2"> <f:ajax render="mainCenterBox" /> </h:commandButton> </h:panelGroup> </h:panelGroup> </h:panelGroup> <h:panelGroup id="mainCenterBox" styleClass="mainCenterBox" layout="block"> <ui:include id="centerView" src="#{urls.URL}"/> </h:panelGroup> </h:form> </h:panelGroup> </h:body> /////////////////////////////////////// page1.xhtml \\\\\\\\\\\\\\\\\\\\\ <?xml version='1.0' encoding='UTF-8' ?> <h:head> Page 1 </h:head> <h:body> <ui:fragment> Page 1 </ui:fragmen…
has answer: http://stackoverflow.com/a/22702799
score: 0
answer count: 1
has title: how to send value from commandButton to java bean to change ui
has comment: http://stackoverflow.com/comment/34554065
tagged with: java
accepted answer: http://stackoverflow.com/a/22702799
tagged with: commandbutton
type: AnsweredQuestion

http://stackoverflow.com/comment/34542196
score: 2
has text: Do you know what the `static` modifier means and how it affects class attributes?
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/22674631

http://stackoverflow.com/comment/34555008
type: QuestionComment
comment on: http://stackoverflow.com/q/22664582
has text: Where do you get null? Does invocation.getExpression() return null? Or are you talking aboput expression.resolveTypeBinding()? or typeBinding.getName()?
score: 0
type: Comment

http://stackoverflow.com/comment/34729029
type: AnswerComment
comment on: http://stackoverflow.com/a/22777970
score: 0
type: Comment
has text: you can go from 0 and keep on increasing too, but then you have to let the function know both ends of the array, when we decrease from n to 0, we know that the least index possible to check is 0(that becomes implicit), if you want to increase, you have to explicitly pass on the max limit on the length of the array

http://stackoverflow.com/comment/34516319
type: Comment
type: QuestionComment
has text: Okay, then problem might be you have 2 jar files somewhere that include the same package and classes.
score: 0
comment on: http://stackoverflow.com/q/22660397

http://stackoverflow.com/q/22780664
has comment: http://stackoverflow.com/comment/34732876
type: UnansweredQuestion
linked to: http://stackoverflow.com/q/326390
type: Question
has comment: http://stackoverflow.com/comment/34732667
tagged with: http://stackoverflow.com/tag/xml
has answer: http://stackoverflow.com/a/22780725
score: 0
has title: split big xml file to multiple files that contains eg. 100 elements in java
tagged with: java
has body: hello every one i have a very big challenge tody , is to split a big xml file that contains for example 2000 elements (eg) : ` AAABBBCCC DDDEEEFFF GGGHHHIII ....... ....... ` the result is multiple files with 100 element per file without losing the header ' ' per file ! how to proceede please ?
answer count: 1

reference
tags question: http://stackoverflow.com/q/22677148
type: Tag
tags question: http://stackoverflow.com/q/22718123
tag name: reference

http://stackoverflow.com/q/22681046
has answer: http://stackoverflow.com/a/22682121
has title: Connection Reset error in HttpClient
tagged with: java
tagged with: connection-reset
type: Question
score: 0
has answer: http://stackoverflow.com/a/62218489
answer count: 2
has body: This is scenario I am testing. The steps are as follows Create an instance of HttpClient(org.apache.commons.httpclient.HttpClient)3.1 Use the instance to get response from a url (http://www.example.com/submitData) Bring down the server hosting the url mentioned in step 2. Bring up the url Wait till the url is up Use the instance of HttpClient created in step 1 to get response from the url (http://www.example.com/getData) I get an error - Connection Reset. Can anyone help me understand. I have used the following params in the HttpClient httpClient.getParams().setParameter("http.socket.timeout", new Integer(0)); httpClient.getParams().setParameter("http.connection.stalecheck", new Boolean(true)); Edited after comments from Peter This is how I create the HttpClient HttpClient httpClient = new HttpClient(); AuthScope authScope = new AuthScope("www.example.com", 80, AuthScope.ANY_REALM); Credentials defaultcreds = new UsernamePasswordCredentials("username", "pwd"); httpClient.getState().setCredentials(authScope, defaultcreds); httpClient.getParams().setParameter("http.socket.timeout", new Integer(0)); httpClient.getParams().setParameter("http.connection.stalecheck", new Boolean(true)); To establish connection, I use the following GetMethod getMethod = new GetMethod("http://"+httpClient.getHostConfiguration().getHost()+"/getData"); int statusCode = httpClient.executeMethod(getMethod); I want the httpclient instance to preserve the hostname and port and credentials. This is exact execption message that I get - "Connection reset". More info - I am executing the test from eclipse. If I run the test case in debug mode, I dont get this exception.
tagged with: httpclient
type: UnansweredQuestion

http://stackoverflow.com/q/22735543
type: Question
tagged with: jpa
has comment: http://stackoverflow.com/comment/132864988
answer count: 1
has answer: http://stackoverflow.com/a/22735604
score: 30
favorite count: 0
linked to: http://stackoverflow.com/q/73855108
has title: Column Annotation absolutly necessary in JPA?
type: UnansweredQuestion
has body: I have an another question concerning JPA. Is it necessary to annotate each member variable with @Column, if i want to store it in my database? Or is it possible to leave it out by some member variables (in these example the field "timestamp") and this field will be stored in database in each possible scenario: @Entity @Table(name = "usercontent") public class UserContentEntity implements Persistable&lt;Long&gt; { /** serialVersionUID */ private static final long serialVersionUID = 1L; @Id @GeneratedValue(strategy = GenerationType.AUTO) private Long id; @Column(name = "description") private String contentdescription; @Column(name = "name") private String contentname; @Column(name = "bytes") @Lob private byte[] contentbytes; @Column private String creator; private Date timestamp; // get- and set methods } And when it is absolutley necessary to use the annotation @Column? Thanks a lot Maik
downvote count: 0
tagged with: java
upvote count: 30

glassfish
tags question: http://stackoverflow.com/q/22695210
tags question: http://stackoverflow.com/q/22721311
tags question: http://stackoverflow.com/q/22655826
tags question: http://stackoverflow.com/q/22688139
tags question: http://stackoverflow.com/q/22775605
tags question: http://stackoverflow.com/q/22803661
tags question: http://stackoverflow.com/q/22701406
tags question: http://stackoverflow.com/q/22761176
tag name: glassfish
tags question: http://stackoverflow.com/q/22766056
tags question: http://stackoverflow.com/q/22666847
tags question: http://stackoverflow.com/q/22670196
tags question: http://stackoverflow.com/q/22807055
tags question: http://stackoverflow.com/q/22786424
tags question: http://stackoverflow.com/q/22749620
tags question: http://stackoverflow.com/q/22687115
type: Tag

http://stackoverflow.com/comment/34619652
comment on: http://stackoverflow.com/q/22717642
type: Comment
has text: @blueygh2, that was a typo in the sysout , I corrected that :)
score: 0
type: QuestionComment

http://stackoverflow.com/q/22663141
has title: Finding peak values from an array in a given range
has comment: http://stackoverflow.com/comment/34521403
tagged with: algorithm
has comment: http://stackoverflow.com/comment/34523127
has body: The method getPeakCount takes an int array and a range (int) as an input and returns the number of integers that are greater than all the elements to either side for the given range. For example, consider an array {1,4,2,6,4,5,10,8,7,11} and range 2. The result should be 3, as {..,4,2,6,4,5,..}, {..,4,5,10,8,7,..} and {..,8,7,11} satisfy this condition. These satisfy the condition because 6, 10 and 11 are all greater than the 2 elements to both their left and right. Note that for the the corner elements like 1 and 11, there's no need to check the left and right side respectively. My code is below, but it is not correct. static int getPeakCount(int[] arr, int R) { int result=0; for(int i=0;i&lt;arr.length;i++){ if(i==0){ if(arr[i]&gt;arr[i+1]&amp;&amp;arr[i]&gt;arr[i+2]){ result++; } } //-----&gt; closing if(i==0) condition else if(i==arr.length-1){ if(arr[i]&gt;arr[i-1]&amp;&amp;arr[i]&gt;arr[i-2]){ result++; } } else if(i+R&gt;arr.length){ if(arr[i]&gt;arr[i-R] &amp;&amp; arr[i]&gt;arr[i-R+1]){ System.out.println(arr[i]); result++; } } else{ if(arr[i]&gt;arr[i+1] &amp;&amp; arr[i]&gt;arr[i+2] &amp;&amp; arr[i]&gt;arr[i-R] &amp;&amp; arr[i]&gt;arr[i-R+1]){ System.out.println(arr[i]); result++; } } } return result; } I don't know whether I'm going in the right direction or not, and for last if condition it's throwing an java.lang.ArrayIndexOutOfBoundsException. P.S. Don't consider this code as solution to remove errors from this. This is just the attempt I tried.
has comment: http://stackoverflow.com/comment/34521508
has comment: http://stackoverflow.com/comment/34521559
has answer: http://stackoverflow.com/a/22663736
answer count: 3
has comment: http://stackoverflow.com/comment/34523270
tagged with: arrays
downvote count: 0
has comment: http://stackoverflow.com/comment/34521168
favorite count: 0
has answer: http://stackoverflow.com/a/22663667
accepted answer: http://stackoverflow.com/a/22663736
has comment: http://stackoverflow.com/comment/34521311
score: 2
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/34521285
possible better answer: http://stackoverflow.com/a/22663643
has comment: http://stackoverflow.com/comment/34521197
upvote count: 2
tagged with: java
has answer: http://stackoverflow.com/a/22663643
has comment: http://stackoverflow.com/comment/34521659
has comment: http://stackoverflow.com/comment/34521063
has comment: http://stackoverflow.com/comment/34521133
type: Question
has comment: http://stackoverflow.com/comment/34521369

http://stackoverflow.com/q/22758851
score: 5
has comment: http://stackoverflow.com/comment/34693450
tagged with: inheritance
has comment: http://stackoverflow.com/comment/34693515
answer count: 1
has body: I was working on a part of an in-house library today and wanted to improve some things by adding basic generics to our "Game" class. Here is the stripped down version of the, now changed, game class: public abstract class Game&lt;G extends GamePlayer&gt; { private final List&lt;G&gt; players; public Game() { this.players = new LinkedList&lt;&gt;(); } public Collection&lt;G&gt; getPlayers() { return players; } } Pretty standard, I know. But when I wanted to use the getPlayers() method in a game module like this: for (GamePlayer player : game.getPlayers()) All it gave me was an error that the return type equals "Collection&lt;Object&gt;" instead of "Collection&lt;G&gt;". All other functions I have (like G getPlayer(String name)) return the correct type, but not the getPlayers function. I really want to avoid implementations of this library cast their players to things like MyGamePlayer player = (MyGamePlayer) myGame.getPlayer("dummy"). What did I do wrong with the generics? Edit: Here is the class that contains the for loop: public class GiftTask implements Runnable { private final Game game; private final Item[] items; public GiftTask(Game game, List&lt;Item&gt; itemList) { this.game = game; this.items = itemList.toArray(new Item[itemList.size()]); } @Override public void run() { for (GamePlayer player : game.getPlayers()) { // This line has the error player.getInventory().addItem(items); } } }
tagged with: generics
accepted answer: http://stackoverflow.com/a/22759067
favorite count: 0
has comment: http://stackoverflow.com/comment/34693662
linked to: http://stackoverflow.com/q/22744197
upvote count: 5
has title: List<T> returns an object collection
has comment: http://stackoverflow.com/comment/34693616
has comment: http://stackoverflow.com/comment/34693609
has answer: http://stackoverflow.com/a/22759067
type: AnsweredQuestion
downvote count: 0
tagged with: java
has comment: http://stackoverflow.com/comment/34693429
has comment: http://stackoverflow.com/comment/34693583
type: Question

http://stackoverflow.com/a/22711170
score: 0
has body: Change the GWT SDK linked in your application. Go To -> Project properties -> Google -> Web Toolkit Click on Configure SDK Now add or change the installed GWT SDK with version 1.9.1 as mentioned by you remove last added version 1.8.9 If still you are getting error then clean the project by removing all gwt-cache, compiled JavaScript files, deploy folder from war etc.
answers question: http://stackoverflow.com/q/22708214
type: Answer

http://stackoverflow.com/a/22753109
has body: You need to get a copy of the source code or class file for the Frame class and add it to your project. The source code should be in a file called Frame.java.
has comment: http://stackoverflow.com/comment/34683275
type: Answer
score: 0
answers question: http://stackoverflow.com/q/22753101
has comment: http://stackoverflow.com/comment/34683288

http://stackoverflow.com/a/22734566
type: Answer
downvote count: 0
score: 1
answers question: http://stackoverflow.com/q/22734490
upvote count: 1
has body: If you want to include . in result after split you can try splitting on each whitespaces (\\s) which has full stop [.] before it. yourString.split("(?&lt;=[.])\\s+"); DEMO for (String s:"ab. cd 1.3 ef. gh".split("(?&lt;=[.])\\s+")) System.out.println(s); Output: ab. cd 1.3 ef. gh If you don't want to include . in result then skip look-behind mechanism and use [.]\\s+

http://stackoverflow.com/comment/34687162
score: 0
type: Comment
type: QuestionComment
has text: Closure is not a functional interface but now that I look closer it does implement Runnable! I suppose that could be the issue.
comment on: http://stackoverflow.com/q/22754660

http://stackoverflow.com/q/22727994
has answer: http://stackoverflow.com/a/22728023
downvote count: 4
tagged with: for-loop
linked to: http://stackoverflow.com/q/85190
upvote count: 0
favorite count: 0
type: UnansweredQuestion
has title: How does this java for-loop work?
score: -4
tagged with: dictionary
answer count: 4
tagged with: java
duplicate of: http://stackoverflow.com/q/85190
has answer: http://stackoverflow.com/a/22728007
type: Question
has comment: http://stackoverflow.com/comment/34638334
has body: I am very sorry for this basic thing could any one please explain about how this for will work. for (Map.Entry&lt;Object, Object&gt; en : m.entrySet()) { Object object = en.getKey(); Object object1 = en.getValue(); }
has answer: http://stackoverflow.com/a/22728104
has comment: http://stackoverflow.com/comment/34638349
has comment: http://stackoverflow.com/comment/34638316
has answer: http://stackoverflow.com/a/22728025

nine-patch
tags question: http://stackoverflow.com/q/22690490
tag name: nine-patch
type: Tag

http://stackoverflow.com/q/22732175
tagged with: handler
has body: It's my first experience in using ProgressDialog and Threads. When I try to use ProgressDialog app crash. ProgressDialog and Thread code: pd = ProgressDialog.show(MainScreen.this, "Backup", "Please, wait...", true, true); final Handler handler = new Handler() { @Override public void handleMessage(Message msg) { pd.dismiss(); } }; new Thread (new Runnable() { public void run() { Looper.prepare(); DB = new DataBase(MainScreen.this); Cursor r = DB.fetchAllNames(); if (r.getCount() == 0){ File sdPath = Environment.getExternalStorageDirectory(); File sdPathDr = new File(sdPath.getAbsolutePath() + "/Pass_backup/" + DIR_SD); if(!sdPathDr.exists()){ } else { File[] files = sdPathDr.listFiles(); if (files.length == 0){ } else { try { restoring(); } catch (IOException e2) { e2.printStackTrace(); } } } } else { try { backupAdapter(); } catch (IOException e1) { e1.printStackTrace(); } try { restoring(); } catch (IOException e) { e.printStackTrace(); } } handler.sendEmptyMessage(0); }}).start(); The code inside thread work, but then app crash. LogCat: 03-29 15:49:06.754: E/AndroidRuntime(12608): FATAL EXCEPTION: Thread-8781 03-29 15:49:06.754: E/AndroidRuntime(12608): Process: com.ssd.passwordbook, PID: 12608 03-29 15:49:06.754: E/AndroidRuntime(12608):android.view.ViewRootImpl$CalledFromWrongThreadException: Only the original thread that created a view hierarchy can touch its views. 03-29 15:49:06.754: E/AndroidRuntime(12608): at android.view.ViewRootImpl.checkThread(ViewRootImpl.java:6094) 03-29 15:49:06.754: E/AndroidRuntime(12608): at android.view.ViewRootImpl.invalidateChildInParent(ViewRootImpl.java:857) 03-29 15:49:06.754: E/AndroidRuntime(12608): at android.view.ViewGroup.invalidateChild(ViewGroup.java:4320) 03-29 15:49:06.754: E/AndroidRuntime(12608): at android.view.View.invalidate(View.java:10942) 03-29 15:49:06.754: E/AndroidRuntime(12608): at android.view.View.invalidate(View.java:10897) 03-29 15:49:06.754: E/AndroidRuntime(12608): at android.widget.ImageView.invali…
has answer: http://stackoverflow.com/a/22732242
has answer: http://stackoverflow.com/a/22732221
tagged with: android
has answer: http://stackoverflow.com/a/22732255
possible better answer: http://stackoverflow.com/a/22732221
type: AnsweredQuestion
tagged with: java
tagged with: multithreading
has title: App crash when using ProgressDialog and Threads
type: Question
accepted answer: http://stackoverflow.com/a/22732255
tagged with: progressdialog
score: 0
answer count: 3

http://stackoverflow.com/comment/34669227
type: Comment
has text: If you wanna do it OO way .. Create your own interface clearly stating the meaning of the method and let second class implement it. and u do operations inside it.
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/22745443

http://stackoverflow.com/comment/39066825
type: AnswerComment
has text: Thanks for your answer, however, I'm looking to do this in Java only. The challenge being implementing a proper thread pool that works against a queue such as the one you described. Also, while I feel I know how the general framework should look like, I'm more interested in the implementation specifics - i.e. which threading tools to use etc.
comment on: http://stackoverflow.com/a/25101622
type: Comment
score: 0

http://stackoverflow.com/comment/34577670
type: Comment
comment on: http://stackoverflow.com/a/22672298
has text: What class are you using for `DateField`? I am using `com.sencha.gxt.widget.core.client.form.DateField`.
score: 0
type: AnswerComment

http://stackoverflow.com/q/22700579
tagged with: java
has title: Axis Custom Handler not being run for wsdl
has body: We have a legacy web service using Axis 1.4 to receive SOAP calls. Currently the servlet-mapping in the web.xml is using the url-pattern /services/* so that anything under services will map to the AxisServlet. Our wsdd file looks something like this: <parameter name="allowedMethods" value="*"/> <parameter name="className" value="com.foo.MyService"/> path/to/wsdl.wsdl <handler type="java:org.apache.axis.handlers.http.URLMapper"/> <handler type="java:org.apache.axis.handlers.http.HTTPAuthHandler"/> <handler type="java:com.foo.AxisRequestHandler"/> <handler type="java:com.foo.AxisResponseHandler"/> We now no longer want everything under services to go to Axis, only services/MyService so that we can use other technologies for other requests under services. So, I changed the web.xml url-pattern for thew AxisServlet to services/MyService. Then, I wanted to remove the URLMapper from the wsdd and have my AxisRequestHandler send all requests to MyService. So, the wsdd now looks like this: <parameter name="allowedMethods" value="*"/> <parameter name="className" value="com.foo.MyService"/> path/to/wsdl.wsdl <handler type="java:org.apache.axis.handlers.http.HTTPAuthHandler"/> <handler type="java:com.foo.AxisRequestHandler"/> <handler type="java:com.foo.AxisResponseHandler"/> And in the AxisRequestHandler I have this: public void invoke(MessageContext context) throws AxisFault { context.setTargetService("MyService"); } This all works great when actually making the SOAP calls. However, when I go to /services/MyService?wsdl to server up the WSDL file, I get the following error: I've put debug logs in the AxisRequestHandler, and whenever I hit the wsdl, it never hits my handler. Is there something I'm missing here?
type: Question
tagged with: axis
answer count: 1
tagged with: wsdl
downvote count: 0
favorite count: 0
tagged with: soap
score: 2
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/22723819
upvote count: 2
accepted answer: http://stackoverflow.com/a/22723819

http://stackoverflow.com/q/22723727
has title: I have trouble with JPA
type: UnansweredQuestion
tagged with: transactions
tagged with: java
has body: I have two tables Agenda @Entity @Table (name = "agenda") public class Agenda { @Id @GeneratedValue private int idAgenda; @OneToMany(orphanRemoval=true,cascade = CascadeType.REMOVE) private List&lt;Consulta&gt; consultas; } and @Entity(name = "Consulta") public class Consulta { @Id @GeneratedValue private int idConsulta; @Column private Calendar dataConsultas; @Column private Time hora; @ManyToOne private Paciente paciente; @OneToOne private Colaborador colaborador; } when i run java its create third table called: agenda consulta. When i tried remove a consulta on table 'consulta' i do this: em.getTransaction().begin(); em.remove(consulta); em.getTransaction().commit(); but have error cause foreign. How do this ?
type: Question
answer count: 1
tagged with: jpa
has answer: http://stackoverflow.com/a/22723964
tagged with: persistence
score: 0

http://stackoverflow.com/comment/34663645
type: Comment
has text: Sorry, I don't think you can do what you want to do. And honestly I'm not sure the investment of your time to make it work (even it could be made to work) will be worth it. You will see so few clicks on ads that are displayed for that short a period unless you have 10 of millions of users regularly changing their settings you are likely to see extremely little revenue.
score: 1
type: AnswerComment
comment on: http://stackoverflow.com/a/22726738

http://stackoverflow.com/q/22752845
possible better answer: http://stackoverflow.com/a/22752964
has answer: http://stackoverflow.com/a/22752964
has comment: http://stackoverflow.com/comment/34682955
tagged with: android
has body: So this program I am trying to write is acting weird, what it does is, it downloads a JSON file from a site, parses it, then puts all the items into a ListView. The weird thing about it is that when I run the debugger I see that it successfully populates the list on the screen but when I try to run it normally it immediately crashes. This is the statements I am getting from logcat: 03-30 22:34:28.115: E/AndroidRuntime(17758): FATAL EXCEPTION: main 03-30 22:34:28.115: E/AndroidRuntime(17758): Process: com.example.listview, PID: 17758 03-30 22:34:28.115: E/AndroidRuntime(17758): java.lang.RuntimeException: Unable to start activity ComponentInfo{com.example.listview/com.example.listview.Activity_ListView}: java.lang.NullPointerException 03-30 22:34:28.115: E/AndroidRuntime(17758): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2195) 03-30 22:34:28.115: E/AndroidRuntime(17758): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2245) 03-30 22:34:28.115: E/AndroidRuntime(17758): at android.app.ActivityThread.access$800(ActivityThread.java:135) 03-30 22:34:28.115: E/AndroidRuntime(17758): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1196) 03-30 22:34:28.115: E/AndroidRuntime(17758): at android.os.Handler.dispatchMessage(Handler.java:102) 03-30 22:34:28.115: E/AndroidRuntime(17758): at android.os.Looper.loop(Looper.java:136) 03-30 22:34:28.115: E/AndroidRuntime(17758): at android.app.ActivityThread.main(ActivityThread.java:5017) 03-30 22:34:28.115: E/AndroidRuntime(17758): at java.lang.reflect.Method.invokeNative(Native Method) 03-30 22:34:28.115: E/AndroidRuntime(17758): at java.lang.reflect.Method.invoke(Method.java:515) 03-30 22:34:28.115: E/AndroidRuntime(17758): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:779) 03-30 22:34:28.115: E/AndroidRuntime(17758): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:595) 03-30 22:34:28.115: E/AndroidRuntime(17758): at dalvi…
type: AnsweredQuestion
downvote count: 0
accepted answer: http://stackoverflow.com/a/22753410
has comment: http://stackoverflow.com/comment/34682902
score: 1
tagged with: java
type: Question
has comment: http://stackoverflow.com/comment/34682962
has answer: http://stackoverflow.com/a/22753410
tagged with: listview
answer count: 2
has comment: http://stackoverflow.com/comment/34682859
has title: I need help deciphering this error, I am trying to populate a list view
upvote count: 1
has comment: http://stackoverflow.com/comment/34682753
has comment: http://stackoverflow.com/comment/34682927
favorite count: 0

http://stackoverflow.com/q/22685351
possible better answer: http://stackoverflow.com/a/22685504
has comment: http://stackoverflow.com/comment/34560472
type: AnsweredQuestion
has title: Java / Returning a dynamic Object type
score: 1
tagged with: java
upvote count: 1
has body: Two methods currently return identical objects, differing only in object name. Animal getEntity(e) { ... return Animal } Person getEntity(e) { ... return Person } Ideally, I could construct a method which would return a type dynamically, based on how it's called. Does this make any sense? When I was looking for examples of &lt;T&gt; T, it wasn't clear how I could return a specified type. Elsewhere, a gremlin called "type erasure" seems to be bandied about. Am I barking up the wrong tree? What should I be looking for?
type: Question
accepted answer: http://stackoverflow.com/a/22685699
downvote count: 0
answer count: 3
linked to: http://stackoverflow.com/q/450807
linked to: http://stackoverflow.com/q/16149285
tagged with: polymorphism
has answer: http://stackoverflow.com/a/22685450
has answer: http://stackoverflow.com/a/22685504
favorite count: 0
has answer: http://stackoverflow.com/a/22685699
has comment: http://stackoverflow.com/comment/34560321

http://stackoverflow.com/a/22651102
type: Answer
has comment: http://stackoverflow.com/comment/34500512
has comment: http://stackoverflow.com/comment/34500596
has body: Issue multiple queries, one for each batch of 500 rows. In your query, you can use LIMIT offset, count to limit how many rows are returned and the offset of the first row to return. The offset of the initial row is 0.
answers question: http://stackoverflow.com/q/22651068
has comment: http://stackoverflow.com/comment/34500794
score: 1
upvote count: 1
downvote count: 0
has comment: http://stackoverflow.com/comment/34501020

http://stackoverflow.com/a/22785371
downvote count: 0
type: Answer
score: 2
upvote count: 2
has body: I think, you only need to cast to java.net.HttpURLConnection because your HttpsURLConnection and HttpURLConnection both extend this abstract class.
accepted answer of: http://stackoverflow.com/q/22785096
answers question: http://stackoverflow.com/q/22785096
type: AcceptedAnswer

http://stackoverflow.com/comment/34778589
score: 1
comment on: http://stackoverflow.com/q/22806150
type: Comment
type: QuestionComment
has text: There is no "shortcut" syntax for creating such, although initialization blocks may be useful. (Also, you really don't want `...` like that.)

game-engine
tags question: http://stackoverflow.com/q/22671507
type: Tag
tag name: game-engine
tags question: http://stackoverflow.com/q/22769428
tags question: http://stackoverflow.com/q/22787286
tags question: http://stackoverflow.com/q/22662095

http://stackoverflow.com/q/22657100
score: 1
linked to: http://stackoverflow.com/q/13731710
tagged with: java
has title: Adding a simple Enter key functionality to my program in Java
has answer: http://stackoverflow.com/a/22666205
has comment: http://stackoverflow.com/comment/34511110
tagged with: eclipse
has comment: http://stackoverflow.com/comment/34511310
has comment: http://stackoverflow.com/comment/34511259
type: Question
has answer: http://stackoverflow.com/a/22657595
downvote count: 0
has answer: http://stackoverflow.com/a/22657564
tagged with: keyboard
accepted answer: http://stackoverflow.com/a/22657595
has comment: http://stackoverflow.com/comment/34510772
has comment: http://stackoverflow.com/comment/34517772
possible better answer: http://stackoverflow.com/a/22657564
has comment: http://stackoverflow.com/comment/34510716
has comment: http://stackoverflow.com/comment/34511011
has comment: http://stackoverflow.com/comment/34512153
tagged with: enter
favorite count: 0
has body: I have a little Java program fully working. And I would like to make the "Enter" key working when I enter a pin Code. As I am writing this post, I can only click on the button to make it work, so I'd like to add this simple functionality without changing all the code. This is the reason of my post, because I have found several links for it, but none of them corresponds to my situation, knowing that I already have a code working. I need to adapt what I have found there : Allowing the "Enter" key to press the submit button, as opposed to only using MouseClick http://tips4java.wordpress.com/2008/10/10/key-bindings/ http://docs.oracle.com/javase/tutorial/uiswing/misc/keybinding.html http://www.javaprogrammingforums.com/java-swing-tutorials/3171-jbutton-enter-key-keyboard-action.html http://www.rgagnon.com/javadetails/java-0253.html The fact that they're all showing solution from nohting does not help me because I can not use what they did in my own program. As you can see, this is the "OK" button I need to be clicked or pressed by "Enter" Here's my code, what do you suggest to have the Enter key working? import java.io.*; import java.util.*; import java.util.concurrent.atomic.AtomicInteger; import javax.swing.*; import javax.swing.text.AttributeSet; import javax.swing.text.BadLocationException; import javax.swing.text.DocumentFilter; import javax.swing.text.PlainDocument; import java.awt.*; import java.awt.event.*; public class Main extends JFrame { private static final long serialVersionUID = 1L; private JPanel container = new JPanel(); private JPasswordField p1 = new JPasswordField(4); private JLabel label = new JLabel("Enter Pin: "); private JButton b = new JButton("OK"); public Main() { this.setTitle("NEEDS"); this.setSize(300, 500); this.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); this.setLocationRelativeTo(null); container.setBackground(Color.white); container.setLayout(new BorderLayout()); container.add(p1); JPanel top = new JPanel(); PlainDocument document =…
has comment: http://stackoverflow.com/comment/34511100
has comment: http://stackoverflow.com/comment/34524585
answer count: 5
has comment: http://stackoverflow.com/comment/34511529
has answer: http://stackoverflow.com/a/22657408
has comment: http://stackoverflow.com/comment/34511209
has comment: http://stackoverflow.com/comment/34512555
upvote count: 1
has comment: http://stackoverflow.com/comment/34522811
tagged with: swing
has comment: http://stackoverflow.com/comment/34512040
has comment: http://stackoverflow.com/comment/34512524
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/34518349
has answer: http://stackoverflow.com/a/22661010
has comment: http://stackoverflow.com/comment/34520570

http://stackoverflow.com/comment/34513778
type: AnswerComment
score: 0
type: Comment
comment on: http://stackoverflow.com/a/22658659
has text: yes...i have to throw it manually...so how to check whether the element is found or not?

multicast
tags question: http://stackoverflow.com/q/22711571
tag name: multicast
type: Tag
tags question: http://stackoverflow.com/q/22749272

http://stackoverflow.com/a/22650797
has comment: http://stackoverflow.com/comment/34499947
score: 1
type: AcceptedAnswer
upvote count: 1
has comment: http://stackoverflow.com/comment/34499796
accepted answer of: http://stackoverflow.com/q/22650690
has comment: http://stackoverflow.com/comment/34499843
type: Answer
has body: Scanner does have a next method, which reads a token regardless of type and returns it as a String, as well as a nextLine method, which does what you expect. In general, I would suggest using next or nextLine over nextInt and other type-specific methods, just because you may run into some unexpected behaviour if the input isn't exactly right. Also, you shouldn't compare two strings with the == operator. In Java, == is a reference (or shallow) comparison, which essentially checks if two objects are stored in the same place on your computer; this works for primitive types (ints, doubles, etc.), because of how they're represented in the language. It will NOT work for Strings, because Strings are complex objects in Java. Instead you should use the equals method, which will do a deep comparison - checking if all of the data is identical.
answers question: http://stackoverflow.com/q/22650690
has comment: http://stackoverflow.com/comment/34500057
downvote count: 0
has comment: http://stackoverflow.com/comment/34500282

http://stackoverflow.com/q/22671174
has answer: http://stackoverflow.com/a/22671289
type: Question
has comment: http://stackoverflow.com/comment/34535886
has body: I have a problem: I'm using an input (string) that I want to save into an int. I want to use that int in another class, but the int is still 0 after my user input. The code is below. I want to use the int fsize in another class. I want to use it with getFsize() but if I use it in the other class it says fsize = 0. public class MineSweeper { private boolean gameOn = true; int fsize; int bpercent; ConsoleIO io = new ConsoleIO(); // start getters and setters public int getFsize() { return fsize; } public void setFsize(int fsize) { this.fsize = fsize; } public int getBpercent() { return bpercent; } public void setBpercent(int bpercent) { this.bpercent = bpercent; } // end getters and setters // while (gameOn = true) { public void startGame() { io.writeOutput("Welkom bij het spelletje Mijnenveger!"); io.writeOutput("Probeer alle mijnen te vinden in het mijnen veld."); } public void fieldSize() { io.writeOutput("Geef de grootte van het veld (5-20):"); // read the input from the console String input1 = io.readInput(); if (input1.matches("[0-9]+")) { this.fsize = Integer.parseInt(input1); if (this.fsize &gt; 20 || this.fsize &lt; 5) { System.out .println("*** De grootte moet tussen 5 en 20 liggen! ***"); fieldSize(); } else { System.out.println(this.fsize); } } else { System.out.println("Vul wel een enkel getal in tussen 5 en 20!"); fieldSize(); } }
has comment: http://stackoverflow.com/comment/34535785
score: 0
has answer: http://stackoverflow.com/a/22671423
answer count: 3
has comment: http://stackoverflow.com/comment/34537509
has answer: http://stackoverflow.com/a/22671409
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/34535821
has title: why isn't my int saving correctly? (java)
has comment: http://stackoverflow.com/comment/34535878
tagged with: java

http://stackoverflow.com/a/22763564
upvote count: 1
has body: you need just create a collection of pairs ; each pair will contain two objects - Restaurant and Spot. List&lt;Pair&lt;Restaurant, Spot&gt;&gt; objects = new ArrayList&lt;Pair&lt;Restaurant, Spot&gt;&gt;(); In getView method you will be able to get a pair on special position Pair&lt;Restaurant, Spot&gt; pair = objects.get(position); Restaurant myRestaurant = pair.first; Spot mySpot = pair.second; This is not the only solution, but it will work.
answers question: http://stackoverflow.com/q/22763328
type: Answer
downvote count: 0
score: 1

http://stackoverflow.com/q/22651424
downvote count: 1
has comment: http://stackoverflow.com/comment/34500965
tagged with: java
type: Question
has comment: http://stackoverflow.com/comment/34500984
tagged with: for-loop
has comment: http://stackoverflow.com/comment/34501013
has title: What does three semicolons (;) in Java mean?
favorite count: 0
score: 0
has comment: http://stackoverflow.com/comment/34501015
has answer: http://stackoverflow.com/a/22651643
has answer: http://stackoverflow.com/a/22651467
has answer: http://stackoverflow.com/a/22651463
answer count: 4
has comment: http://stackoverflow.com/comment/34501005
has body: I was solving a few objective question in Java where I came across a statement like for(i=0; i&amp;lt ;l;i++) Is it some kind of printing error or extra characters or does it have some meaning I don't understand exactly? Can anyone give a clear picture on this?
type: UnansweredQuestion
upvote count: 1
has answer: http://stackoverflow.com/a/22651654

http://stackoverflow.com/a/22728604
has body: paint the image in a panel protected void paintComponent(Grapchics g) { super.paintComponent(g); g.drawImage(image, 0, 0, this); } Then based on the the number of cells you want, say 10x10, just draw 100 cells (drawRect()) over the image. Something like protected void paintComponent(Grapchics g) { super.paintComponent(g); g.drawImage(image, 0, 0, this); int cellHeight = (int)(getHeight() / 10); int cellWidth = (int)(getWidth() / 10); for (int y = 0; y &lt; getWidth(); y += cellHeight) { for (int x = 0; x &lt; getHeight(); x += cellWidth){ g.drawRect(x, y, cellWidth, cellHeight); } } } I haven't test it, but the basic concept is there. You may also want to use variables (a constant probably) for the 10. UPDATE 1 You can see the precision's a little off because I used int, but you can use doubles and draw by using Grapchics2D Rectangle2D.Double. I'm too lazy to change it import java.awt.Dimension; import java.awt.Graphics; import java.awt.GridBagLayout; import java.awt.image.BufferedImage; import java.io.IOException; import java.util.logging.Level; import java.util.logging.Logger; import javax.imageio.ImageIO; import javax.swing.JFrame; import javax.swing.JPanel; import javax.swing.SwingUtilities; public class ImageGrid extends JPanel { private static final int CELLS = 10; BufferedImage img; public ImageGrid() { try { img = ImageIO.read(getClass().getResource("/resources/stackoverflow5.png")); } catch (IOException ex) { Logger.getLogger(ImageGrid.class.getName()).log(Level.SEVERE, null, ex); } } @Override protected void paintComponent(Graphics g) { super.paintComponent(g); if (img != null) { g.drawImage(img, 0, 0, this); int cellHeight = (int) (getHeight() / CELLS); int cellWidth = (int) (getWidth() / CELLS); for (int y = 0; y &lt; getHeight(); y += cellHeight) { for (int x = 0; x &lt; getWidth(); x += cellWidth) { g.drawRect(x, y, cellWidth, cellHeight); } } } } @Override public Dimension getPreferredSize() { return img == null ? new Dimension(300, 300) : new Dimensi…
type: Answer
has comment: http://stackoverflow.com/comment/34639785
score: 3
downvote count: 0
has comment: http://stackoverflow.com/comment/34639502
has comment: http://stackoverflow.com/comment/34639619
accepted answer of: http://stackoverflow.com/q/22728431
answers question: http://stackoverflow.com/q/22728431
upvote count: 3
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/34639439
has comment: http://stackoverflow.com/comment/34639714

http://stackoverflow.com/q/22750449
has comment: http://stackoverflow.com/comment/34900311
has title: Spring Webapp with Hibernate, Annotation Driven, Issue after Issue, Source Code Link
type: Question
possible better answer: http://stackoverflow.com/a/22751112
has comment: http://stackoverflow.com/comment/34891694
has comment: http://stackoverflow.com/comment/34900841
has body: I am working on a Spring webapp using annotations and Hibernate. One of the goals here is that the application be annotation driven (instead of XML) for all elements of the stack, which right now is just spring and hibernate. Every solution from this and other questions I asked here about this code leads to a whack a mole style conflagration of issues, but this cant be that hard. Please try this code! It's much easier than us all going through a point by point exposition of stack traces. A Github link is included, just git clone, maven clean package, and deploy to a suitable server such as Jetty, you can see all these traces in action. Here is how this started: when firing up a webapp I got the following no class def found error: java.lang.noclassdeffounderror L[org.hibernate.engine.FilterDefinition I am using Hibernate 4.3.4 <hibernate.version>4.3.4.Final</hibernate.version> and am using the core jar org.hibernate hibernate-core ${hibernate.version} Here was the trace org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'userService': Injection of autowired dependencies failed; nested exception is org.springframework.beans.factory.BeanCreationException: Could not autowire field: private com.mobiusinversion.web.repositories.UserRepository com.mobiusinversion.web.services.UserService.userRepository; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'userRepository': Injection of autowired dependencies failed; nested exception is org.springframework.beans.factory.BeanCreationException: Could not autowire field: private org.hibernate.SessionFactory com.mobiusinversion.web.repositories.UserRepository.sessionFactory; nested exception is java.lang.NoClassDefFoundError: [Lorg/hibernate/engine/FilterDefinition; at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor.postProcessPropertyValues(AutowiredAnnotationBeanPostProcessor.java:292) at org.springframe…
has answer: http://stackoverflow.com/a/22751112
score: 0
answer count: 3
has comment: http://stackoverflow.com/comment/34900864
tagged with: annotations
tagged with: spring
tagged with: spring-mvc
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/22869008
tagged with: java
tagged with: hibernate
has answer: http://stackoverflow.com/a/22872120
accepted answer: http://stackoverflow.com/a/22872120
has comment: http://stackoverflow.com/comment/34900809

http://stackoverflow.com/comment/34609968
score: 0
type: QuestionComment
comment on: http://stackoverflow.com/q/22712080
type: Comment
has text: @Paul - Nice of you to offer an alternative

http://stackoverflow.com/a/22664353
downvote count: 0
type: Answer
upvote count: 3
answers question: http://stackoverflow.com/q/22664284
accepted answer of: http://stackoverflow.com/q/22664284
score: 3
has body: Instead of ResultSet rs = preparedStatement.executeQuery(query); do ResultSet rs = preparedStatement.executeQuery();
has comment: http://stackoverflow.com/comment/34523164
type: AcceptedAnswer

http://stackoverflow.com/a/22777474
upvote count: 1
score: 1
answers question: http://stackoverflow.com/q/22777319
has body: Your method returns a String. You are trying to store that returned string in an int. Java does not convert strings to integers automatically like this. You will have to do the conversion explicitly. You can use Integer.parseInt for this: int number = Integer.parseInt(decode(c)); Note that a NumberFormatException will be thrown if the returned string isn't actually a valid integer.
downvote count: 0
type: Answer

http://stackoverflow.com/comment/34563728
type: AnswerComment
type: Comment
has text: While creating funcion, do I need to use the code as below: ============================ CREATE OR REPLACE FUNCTION DBTEST_FUNC (P_IN VARCHAR2) RETURN VARCHAR2 AS LANGUAGE JAVA NAME 'emrsn/com/DBTEST.callMe (java.lang.String) return java.lang.String'; If I am doing so , its giving error atr runtime : ============================== *Cause: An attempt was made to execute a non-existent method in a Java class. Or here also I need to use double quotes. Appreciate your prompt response.
comment on: http://stackoverflow.com/a/22683590
score: 0

http://stackoverflow.com/comment/34587012
type: Comment
score: 1
type: AnswerComment
has text: For the bloom filter to be useful in any way, each insertion will have to set at least 1 bit. The bloom filter will fill up long before you have read a significant fraction of the numbers.
comment on: http://stackoverflow.com/a/22699415

http://stackoverflow.com/a/22667452
downvote count: 0
type: Answer
score: 2
has comment: http://stackoverflow.com/comment/34530605
accepted answer of: http://stackoverflow.com/q/22666804
upvote count: 2
has comment: http://stackoverflow.com/comment/34619304
has body: Could it be that the scala runner isn't looking in . for the classpath? See scala -help and scalac -help. Try scala -classpath . MathML2LaTeX.scala Also, can you confirm that MathMLParser has already been compiled to a .class file (in ./de/...) ? I don't think the scala-runner will do that on the fly.
answers question: http://stackoverflow.com/q/22666804
type: AcceptedAnswer

http://stackoverflow.com/comment/34652022
type: AnswerComment
score: 0
type: Comment
has text: @salbeira Run the examples from [this post](http://stackoverflow.com/a/22712062/2587435), using your own paths, and let me know what happens.
comment on: http://stackoverflow.com/a/22735727

http://stackoverflow.com/comment/34515430
type: Comment
comment on: http://stackoverflow.com/a/22659746
has text: Thanks Peter. I tried both the approaches, but still the file is not de-compiled. I have also updated my post with the details.
type: AnswerComment
score: 0

http://stackoverflow.com/a/22694872
has comment: http://stackoverflow.com/comment/34578940
answers question: http://stackoverflow.com/q/22694558
upvote count: 0
has comment: http://stackoverflow.com/comment/34578155
score: -3
type: Answer
has comment: http://stackoverflow.com/comment/88799600
downvote count: 3
has body: This will work - public static int CountWords(String sen) { if("".equals(sen)){ return 0; } int count = 0; int i = sen.indexOf(" "); String substr = sen.substring(0,i+1) ; if (i != -1) { count++; }else{ if(sen.length()&gt;0){ count++; } sen=""; } //sen.substring(0,sen.indexOf(" ")-1); return count + CountWords(sen.substring(substr.length())); }

http://stackoverflow.com/q/22650289
type: Question
duplicate of: http://stackoverflow.com/q/9968687
has body: Hi Stack Overflow community ^_^ Basically, I am working with Stacks and converting from Infix to Postfix equations. This is the error message showing on screen when I am trying to compile the Stack class: Stack.java:5: error: type argument T#1 is not within bounds of type-variable T#2 private LinkedList&lt;T&gt; list; ^ where T#1,T#2 are type-variables: T#1 extends Object declared in class Stack T#2 extends Comparable&lt;T#2&gt; declared in class LinkedList I am having real troubles trying to figure out this error but sadly I don't have a clue of what might be the problem. If I knew a little better I could have provided you with more info. Thanks in advance for any comments and help! Update: Here is my class... package ListPkg; public class Stack&lt;T&gt; // implements Comparable&lt;Stack&gt;&gt; { private LinkedList&lt;T&gt; list; public Stack() { this("list"); } public Stack(String name) { list = new LinkedList(name); } public void push(T item) { list.insertAtFront(item); } public T pop() { list.removeFromFront(); } public int lenghtIs() { return list.lengthIs(); } public T peek() { return list.returnFirstNode(); } public void print() { list.print(); } public boolean isEmpty() { return list.isEmpty(); } }
tagged with: stack
tagged with: java
upvote count: 7
answer count: 1
has answer: http://stackoverflow.com/a/22650343
type: UnansweredQuestion
downvote count: 0
score: 7
favorite count: 0
linked to: http://stackoverflow.com/q/9968687
has title: type argument is not within bounds of type-variable

http://stackoverflow.com/a/22706245
score: 7
has comment: http://stackoverflow.com/comment/34599976
answers question: http://stackoverflow.com/q/22706173
upvote count: 7
type: Answer
downvote count: 0
has comment: http://stackoverflow.com/comment/34599999
has body: download the jar, and install it manually into your maven local cache mvn install:install-file -Dfile={/path/to/ojdbc.jar} -DgroupId=com.oracle -DartifactId=ojdbc6 -Dversion=11.2.0 -Dpackaging=jar if you have your nexus for your organization it would be better to place it there so it is shared across local developers

http://stackoverflow.com/a/22682376
has comment: http://stackoverflow.com/comment/34557785
has comment: http://stackoverflow.com/comment/34556626
type: Answer
has comment: http://stackoverflow.com/comment/34589250
downvote count: 0
score: 1
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/34568677
accepted answer of: http://stackoverflow.com/q/22673190
has body: My first reaction would be that manipulating XML node trees is much better done in XSLT than in Java, so calling extension functions in order to do node manipulation seems very strange. In particular, "adding an additional text node as a child" is what XSLT was designed to do, so it seems very odd to call Java to do it. Any code you do write in Java to manipulate nodes is going to be dependent on the tree model used. From the error message, it sounds as if you're probably building the tree initially using Saxon's TinyTree model, and then wrapping the TinyTree nodes in a DOM wrapper for the benefit of your Java code. The DOM wrapper will give you a DOM interface for retrieval/navigation, but not for update, because the TinyTree is immutable.
answers question: http://stackoverflow.com/q/22673190
upvote count: 1

http://stackoverflow.com/q/22766888
has body: I have an array list of usernames and an array list of passwords. Two or more users could have the same password. ArrayList&lt;String&gt; u = new ArrayList&lt;String&gt;(); ArrayList&lt;String&gt; p = new ArrayList&lt;String&gt;(); These arrays are populated from a file of the following format: username password Like so; String line = null; String split[] = null; while ((line = reader.readLine()) != null){ split = line.split("\\s+"); u.add(split[0]); p.add(split[1]); } I have a brute force algorithm that generates passwords and I want to find if the passwords generated have a match. String password = bruteForce() if (passwords.contains(password)){ int index = passwords.indexOf(password); System.out.println("Username: " + usernames.get(index)); System.out.println("Password: " + password); } This works well if none of the users have the same password. If two users have the same password; it will just grab the first occurrence and print that, skipping the second user. I need a way to determine if there are multiple occurrences of the same password, get each occurrences index and then their matching username.
downvote count: 1
score: 1
tagged with: java
has comment: http://stackoverflow.com/comment/34708319
type: Question
has answer: http://stackoverflow.com/a/22766932
has title: Find out if an ArrayList contains more than one of an element
answer count: 1
has comment: http://stackoverflow.com/comment/34709483
favorite count: 0
upvote count: 2
type: UnansweredQuestion

http://stackoverflow.com/q/22790515
tagged with: wicket
type: AnsweredQuestion
score: 1
tagged with: java
upvote count: 1
type: Question
tagged with: javascript
has body: I find it confusing to incorporate javascript from Wicket using target.appendJavaScript() What is the structure for doing this: document.write("Celsius is: " + celsius + ""); in target.appendJavaScript() ? Lets say celsius is an integer from Java.. how do I include the java variable into the javascript code?
has answer: http://stackoverflow.com/a/22790636
accepted answer: http://stackoverflow.com/a/22790636
downvote count: 0
answer count: 1
has title: Using Javascript in Wicket
favorite count: 0
has comment: http://stackoverflow.com/comment/34750331

http://stackoverflow.com/q/22742308
has body: I have a spray app but the spray aspect is not important. My web app has the directory : src/main/scala in which there is the package models. In a code I have this statement: lazy val xml = ElémentXML("models.exemple_bon.xml") The object ElémentXML has for argument a string which is the local name of a file that should be in the models directory, but the call fails. The code in ElémentXML is as here: try { val xml_chargé = xml.XML.loadFile(fichier) Some(new ElémentXML(xml_chargé, fichier)) } catch { case e: Throwable =&gt; None } The error is as here: java.io.FileNotFoundException: models.exemple_bon.xml (No such file or directory) can you help me?
upvote count: 1
downvote count: 0
tagged with: directory
favorite count: 0
tagged with: scala
type: UnansweredQuestion
tagged with: path
tagged with: spray
has title: eclipse scala project : how to access to a file inside the project
has comment: http://stackoverflow.com/comment/34667500
answer count: 0
score: 1
tagged with: java
type: Question
has comment: http://stackoverflow.com/comment/34666921
has comment: http://stackoverflow.com/comment/34681708

http://stackoverflow.com/comment/35268073
has text: Yes, that's correct. Jersey is just saying it doesn't know how to write application/json. Will amend the answer
comment on: http://stackoverflow.com/a/23032093
type: Comment
type: AnswerComment
score: 0

http://stackoverflow.com/a/22705770
upvote count: 15
downvote count: 0
type: Answer
has body: As @Sid notes in the comments, the error says LibGDX requires OpenGL ES 2.0 support. The emulator's software renderer does not support OpenGL ES 2.0. You may be able to get your emulator to support by enabling graphics acceleration in the emulator. See http://developer.android.com/tools/devices/emulator.html#accel-graphics and Android OpenGL ES 2.0 emulator Here is the Android Virtual Device Manager dialog with the setting highlighted. Enabling this definitely solves the problem on a Macbook Air, and likely many other computers.
answers question: http://stackoverflow.com/q/22703940
score: 15

http://stackoverflow.com/comment/34633643
comment on: http://stackoverflow.com/a/22724653
type: Comment
has text: Ok, I guess I'll go with that.
score: 0
type: AnswerComment

http://stackoverflow.com/comment/34653192
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/22736170
has text: because its not working mate!

http://stackoverflow.com/q/22699452
score: 0
accepted answer: http://stackoverflow.com/a/22724911
answer count: 1
has title: NameNotFoundException when using JBoss 7.1.1
has body: I'm creating an EJB application and I'm using below to get the context Context context = new InitialContext(); StudentEJBRemote remoteHandle; remoteHandle = (StudentEJBRemote) context.lookup("java:global/stadikon_hw2/swe645a1/StudentEJB!masonsurveyejb.businesslogic.StudentEJBRemote"); I get below error when I try to do this. javax.naming.NameNotFoundException: stadikon_hw2/swe645a1/StudentEJB!masonsurveyejb.businesslogic.StudentEJBRemote -- service jboss.naming.context.java.global.stadikon_hw2.swe645a1."StudentEJB!masonsurveyejb.businesslogic.StudentEJBRemote" org.jboss.as.naming.ServiceBasedNamingStore.lookup(ServiceBasedNamingStore.java:97) org.jboss.as.naming.NamingContext.lookup(NamingContext.java:178) org.jboss.as.naming.InitialContext.lookup(InitialContext.java:123) org.jboss.as.naming.NamingContext.lookup(NamingContext.java:214) javax.naming.InitialContext.lookup(InitialContext.java:411) masonsurvey.SurveyAction.execute(SurveyAction.java:37) I've deployed the client application and EJB in a .ear file in JBoss. The client application .war file contains the jar of the remote interface class. From the logs, I can see that binding happened. 17:01:18,821 INFO [org.jboss.as.ejb3.deployment.processors.EjbJndiBindingsDeploymentUnitProcessor] (MSC service thread 1-7) JNDI bindings for session bean named StudentEJB in deployment unit subdeployment "stadikon_session_hw2.jar" of deployment "stadikon_hw2.ear" are as follows: java:global/stadikon_hw2/stadikon_session_hw2/StudentEJB!masonsurveyejb.businesslogic.StudentEJBRemote java:app/stadikon_session_hw2/StudentEJB!masonsurveyejb.businesslogic.StudentEJBRemote java:module/StudentEJB!masonsurveyejb.businesslogic.StudentEJBRemote java:jboss/exported/stadikon_hw2/stadikon_session_hw2/StudentEJB!masonsurveyejb.businesslogic.StudentEJBRemote java:global/stadikon_hw2/stadikon_session_hw2/StudentEJB java:app/stadikon_session_hw2/StudentEJB java:module/StudentEJB
type: AnsweredQuestion
tagged with: java
type: Question
tagged with: ejb
has answer: http://stackoverflow.com/a/22724911
tagged with: jboss

http://stackoverflow.com/comment/35224525
type: Comment
has text: used suggestions by programmerdan. thanks working now
score: 0
comment on: http://stackoverflow.com/q/22705273
type: QuestionComment

http://stackoverflow.com/q/22789293
has title: How to get the string between double quotes in a string in Java
answer count: 4
accepted answer: http://stackoverflow.com/a/22790200
has comment: http://stackoverflow.com/comment/34747974
has comment: http://stackoverflow.com/comment/34747972
linked to: http://stackoverflow.com/q/2498635
has comment: http://stackoverflow.com/comment/34749046
has comment: http://stackoverflow.com/comment/34748116
tagged with: quotes
type: AnsweredQuestion
duplicate of: http://stackoverflow.com/q/2498635
linked to: http://stackoverflow.com/q/7804335
tagged with: java
duplicate of: http://stackoverflow.com/q/7804335
has comment: http://stackoverflow.com/comment/34759877
type: Question
score: 0
has answer: http://stackoverflow.com/a/22790200
has answer: http://stackoverflow.com/a/22789525
has comment: http://stackoverflow.com/comment/34748059
has answer: http://stackoverflow.com/a/22789788
has comment: http://stackoverflow.com/comment/34748426
tagged with: string
has comment: http://stackoverflow.com/comment/34748029
has comment: http://stackoverflow.com/comment/34747935
has answer: http://stackoverflow.com/a/22789557
has comment: http://stackoverflow.com/comment/34748241
has comment: http://stackoverflow.com/comment/34749067
has body: For example, input will be like: AddItem rt456 4 12 BOOK “File Structures” “Addison-Wesley” “Michael Folk” and I want to read all by using scanner and put it in a array. like: info[0] = rt456 info[1] = 4 .. .. info[4] = File Structures info[5] = Addison-Wesley So how can I get the string between quotes? EDIT: a part of my code-> public static void main(String[] args) { String command; String[] line = new String[6]; Scanner read = new Scanner(System.in); Library library = new Library(); command = read.next(); if(command.matches("AddItem")) { line[0] = read.next(); // Serial Number line[1] = read.next(); // Shelf Number line[2] = read.next(); // Shelf Index command = read.next(); // Type of the item. "Book" - "CD" - "Magazine" if(command.matches("BOOK")) { line[3] = read.next(); // Name line[4] = read.next(); // Publisher line[5] = read.next(); // Author Book yeni = new Book(line[0],Integer.parseInt(line[1]),Integer.parseInt(line[2]),line[3],line[4],line[5]); } } } so I use read.next to read String without quotes. SOLVED BY USING REGEX AS read.next("([^\"]\\S*|\".+?\")\\s*");
possible better answer: http://stackoverflow.com/a/22789788
has comment: http://stackoverflow.com/comment/34749626

jprogressbar
tags question: http://stackoverflow.com/q/22726565
type: Tag
tag name: jprogressbar

http://stackoverflow.com/a/22788585
type: Answer
upvote count: 4
downvote count: 0
accepted answer of: http://stackoverflow.com/q/22788439
answers question: http://stackoverflow.com/q/22788439
has body: private Preferences pref; private String prefString, hold; You have declared pref, but you have not initialized it. That is why pref.set(prefString, hold); throws a NullPointerException, because null has no function called set. Null has nothing. Null is nothing. Normally, I'd say you need to initialize pref with something like pref = new Preferences(); However, according to the codenameone API for Preferences, all it's functions are static, and should be called in this way: Preferences.set(prefString, hold); Therefore, its declaration line should not be there to begin with. If Preferences.set(prefString, hold); still throws a NullPointerException, it is likely because 'prefString' is also null.
has comment: http://stackoverflow.com/comment/34748314
has comment: http://stackoverflow.com/comment/34784824
has comment: http://stackoverflow.com/comment/34747334
score: 4
has comment: http://stackoverflow.com/comment/34786581
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/34770424
has comment: http://stackoverflow.com/comment/34746760

http://stackoverflow.com/a/22718189
downvote count: 0
accepted answer of: http://stackoverflow.com/q/22718123
type: Answer
score: 4
has body: The Java garbage collection is smart enough not to be fooled by circular references. As soon as there are no Strong References to the tree then the entire tree complete with circular references will all be garbage collected. All you need to do is ensure that there are no references from outside the Tree to anywhere inside the Tree. If an event was accessing the parent field then that suggests something still had a reference. You will need to clean that up (whether you remove the circular references or not).
answers question: http://stackoverflow.com/q/22718123
upvote count: 4
type: AcceptedAnswer

http://stackoverflow.com/a/22806153
type: Answer
has body: Do you really need a custom implementation for the location manager / location service's onLocationChanged() callback ? Otherwise, you could take a look at OSMDroid's MyLocationNewOverlay class https://code.google.com/p/osmdroid/source/browse/trunk/osmdroid-android/src/main/java/org/osmdroid/views/overlay/mylocation/MyLocationNewOverlay.java?r=1220 There is also another implementation, (deprecated unfortunatelly) called MyLocationOverlay https://code.google.com/p/osmdroid/source/browse/trunk/osmdroid-android/src/org/osmdroid/views/overlay/MyLocationOverlay.java?r=902 In my implementation, I use it like this: //declare variable; global - because I need reference elsewhere private MyLocationOverlay self; //somewhere in code //'this' - is the context //mapMainView - my mapView self = new MyLocationOverlay(this, mapMainView); self.enableMyLocation(); self.enableFollowLocation(); //add the overlay to the map and refresh the view mapMainView.getOverlays().add(COUNT+1, self);//COUNT is the size of the List&lt;Overlay&gt; returned by mapMainView.getOverlays(); this is just because I want my 'self' to be always the last overlay added mapMainView.invalidate();//refresh the view This puts a default icon at my location on the map, and it updates constantly as I move.
score: 0
answers question: http://stackoverflow.com/q/22768537

http://stackoverflow.com/comment/34533241
score: 0
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/22669573
has text: When a question completely changes like this, after many answers are posted, despite asking the OP many questions in an effort to make sure we're doing what they wanted, I think it should be an unspoken policy for all answer-ers to up-vote all other answers, down-vote the question, *and* vote to close it.

http://stackoverflow.com/q/22755953
has title: Multithreaded real time camera processing in Android
linked to: http://stackoverflow.com/q/15799487
favorite count: 0
has comment: http://stackoverflow.com/comment/34958969
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/25101622
tagged with: android
linked to: http://stackoverflow.com/q/8620560
downvote count: 0
tagged with: video-processing
linked to: http://stackoverflow.com/q/18449162
linked to: http://stackoverflow.com/q/14364144
tagged with: multithreading
has comment: http://stackoverflow.com/comment/40805023
has comment: http://stackoverflow.com/comment/40798022
linked to: http://stackoverflow.com/q/14894023
type: Question
linked to: http://stackoverflow.com/q/5634053
linked to: http://stackoverflow.com/q/6814572
has body: The goal is to get real-time image processing working on the live preview of an Android device. This has been tackled here on SO many times, and has some mentions on the web (see references at the end of the question), however, I haven't found a single suggestion on a proper multithreaded framework to accomplish this. To my understanding, to make proper use of multithreading (and devices with more than one physical core) one would implement the following: The frame handler is called on the UI thread (onCameraPreview) and enqueues the frame data to a shared queue Q. A thread pool of n threads awaits on Q. Each thread dequeus a frame whenever available, does the "heavy" image processing and posts a message to the UI thread with the result. My main question is whether the above is the right direction, and how exactly to accomplish it on Android. Also, what would be the required modifications if the image processing had to be done in serial - i.e. no more than 1 frame being processed at any given time but still have the processing done on a thread separate than the main one. Update 1: I ended up implementing this as an AsyncTask that recieves the raw frame data as input and uses the onPostExecute callback to update the UI. However, this happens about 10 times per second which makes me wonder whether it is not generating too much overhead. This is why, as far as I'm concerned, this question is still open to get a validation this is indeed the most efficient method. Also, it is still unclear to me how one would expand this approach to multiple worker threads on multiple cores. Related questions: - Video processing in Android - Android Camera Frame processing with MultiThreading - Android: How to record video and process its frames in real time? - Processing Android camera frames in real time - Ways of getting high FPS for real time computer vision processing - Multithreading in openCV4Android - Android: Real Time Image Processing - Android video frame processing - Simulta…
score: 1
tagged with: java
linked to: http://stackoverflow.com/q/9721306
linked to: http://stackoverflow.com/q/8649751
linked to: http://stackoverflow.com/q/7621178
linked to: http://stackoverflow.com/q/18183016
linked to: http://stackoverflow.com/q/17846467
has comment: http://stackoverflow.com/comment/39326720
upvote count: 1
linked to: http://stackoverflow.com/q/12352615
answer count: 1

http://stackoverflow.com/a/22662878
has comment: http://stackoverflow.com/comment/34522358
downvote count: 0
has body: Here's what you should do. Get rid of the main method in the JDialog class. Your application should only have one main method, and that should be in your JFrame class. Don't create a new JFrame to pass it to your dialog. To open it on a button click just create a new questionDialog() passing the current frame to it. Something like this public class MyFrame extends JFrame { public MyFrame() { JButton but = new JButton("but"); but.addActionListener(new ActionListener(){ public void actionPerformed(ActionEvent e) { QuestionDialog dialog = new QuestionDialog(MyFrame.this); dialog.setVisible(true); } }); } public static void main(String[] args) { SwingUtilities.invokeLater(new Runnable(){ public void run() { new MyFrame(); } }); } } public class QuestionDialog extends JDialog { public QuestionDialog(Frame parent) { super(parent); } } Bonus You are getting the error doing questionDialog.setVisible(true) because setVisible is an instance method and you are trying to call it in a static way. You need to create a new instance of your dialog class to call it. Use Java naming convention. Class names begin with capital letters. questionDialog &rarr; QuestionDialog
has comment: http://stackoverflow.com/comment/34522744
has comment: http://stackoverflow.com/comment/34521963
has comment: http://stackoverflow.com/comment/34522015
score: 3
has comment: http://stackoverflow.com/comment/34522454
has comment: http://stackoverflow.com/comment/34523880
upvote count: 3
has comment: http://stackoverflow.com/comment/34523407
has comment: http://stackoverflow.com/comment/34523194
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/34523747
accepted answer of: http://stackoverflow.com/q/22662285
has comment: http://stackoverflow.com/comment/34523817
answers question: http://stackoverflow.com/q/22662285
type: Answer
has comment: http://stackoverflow.com/comment/34522820

touchpad
tags question: http://stackoverflow.com/q/22681226
tag name: touchpad
type: Tag

http://stackoverflow.com/comment/57958920
comment on: http://stackoverflow.com/q/22659088
has text: I think this old question is rather broad - it would require some debugging. I doubt you still need this, but is there a point where those prefixes can be printed out? I assume that the autocomplete generates an event when it wants to query the index?
score: 0
type: QuestionComment
type: Comment

http://stackoverflow.com/comment/34766734
type: Comment
type: QuestionComment
has text: is this all in the same input? or can you just append the input string with each input?
comment on: http://stackoverflow.com/q/22799265
score: 0

http://stackoverflow.com/comment/34671113
comment on: http://stackoverflow.com/a/22745616
type: AnswerComment
score: 5
has text: If you're really worried about the cost of a StoreLoad memory barrier, you're either writing extremely high-performance code where you allocate millions of such objects or you're microoptimizing. "Apparently, final variables are way to expensive compared to volatile variables and atomic data types" - huh? Volatiles (which is what atomic data types use internally anyhow) need the same barriers after every single write! Any benchmarks/programs where the addition of "final" really "significantly" impacts performance?
type: Comment

http://stackoverflow.com/comment/34514321
has text: Did you take the call to bowBack into account?
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/22659193

http://stackoverflow.com/q/22686011
has title: Create List<?> of a variable parameter
score: 0
answer count: 1
tagged with: generics
type: AnsweredQuestion
tagged with: list
tagged with: java
has body: My problem is that I'm trying to instantiate a list with a parameter that have the same class as my function's argument : public &lt;A extends CommunicationObject&gt; List&lt;A&gt; Myfunction(A myObject){ List&lt;A&gt; firstList; //do something } When I call the function : List&lt;person&gt; persons = Myfunction(person myObject); The first list take A as CommunicationObject and this is not what I want. I also tried to do this : public &lt;A extends CommunicationObject&gt; List&lt;A&gt; Myfunction(A myObject){ List&lt;myObject.getClass()&gt; firstList; //do something } but it is not allowed. Is there any chance that I can fix this ? Update : "person" is a subClass of "CumminicationObject". There is some attributes that exists in person and not in CommunicationObject. Actually this is just an example. What I'm trying to do is to convert a JSON to List"&lt;"A">", and A can be "person" or other class that extends CommunicationObject. The JSON contain the same attributes as the "A" class in List"&lt;"A">". In order to do the convertion, the parameter "A" in List"&lt;"A">" have to be the same as my object Class in myfunction(A myObject).
type: Question
has comment: http://stackoverflow.com/comment/34562233
has answer: http://stackoverflow.com/a/22686157
accepted answer: http://stackoverflow.com/a/22686157

http://stackoverflow.com/q/22771005
has comment: http://stackoverflow.com/comment/34715678
has comment: http://stackoverflow.com/comment/34715836
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/34715688
has answer: http://stackoverflow.com/a/22771083
upvote count: 1
has comment: http://stackoverflow.com/comment/34715602
downvote count: 1
has comment: http://stackoverflow.com/comment/34716427
has comment: http://stackoverflow.com/comment/34715672
has comment: http://stackoverflow.com/comment/34717004
score: 0
has body: In my code below im am tring to add a thread.sleep for when someone chooses the option to exit the lift, i am not sure whats wrong with the code i entered to make it sleep.I already included the Interrupted exception so can someone tell me where i went wrong. import java.util.Arrays; import java.util.Scanner; public class username{ public static void main(String... args) throws InterruptedException { String[] verifiedNames = { "barry", "matty", "olly", "joey" }; System.out.println("choose an option"); System.out.println("Uselift(1)"); System.out.println("see audit report(2)"); System.out.println("Exit Lift(3)"); Scanner scanner = new Scanner(System.in); int choice = scanner.nextInt(); switch (choice) { case 1: scanner.nextLine(); // get '\n' symbol from previous input int nameAttemptsLeft = 3; while (nameAttemptsLeft-- &gt; 0) { System.out.println(" Enter your name "); String name = scanner.nextLine(); if (Arrays.asList(verifiedNames).contains(name)) { System.out.println("dear " + name + " you are verified " + "you may use the lift, calling lift "); break; // break out of loop } } if (nameAttemptsLeft &lt; 0) { System.out.println("Username Invalid"); } break; case 2: System.out.println("option 2"); break; case 3: System.out.println(" Please Exit Lift "); Thread.sleep(5000); System.exit(0); break; }
tagged with: java
has comment: http://stackoverflow.com/comment/34717329
has title: How to get thread.sleep to work
type: Question
answer count: 2
favorite count: 0
has answer: http://stackoverflow.com/a/22771749

http://stackoverflow.com/q/22688127
answer count: 2
has body: I'm trying to run my web app tests using selenium on iE on a remorte machine. My tests run successfully locally but when I try to run them on a remorte XP OS using IE8, I get this log error : org.openqa.selenium.remote.UnreachableBrowserException: Could not start a new session. Possible causes are invalid address of the remote server or browser start-up failure. Help please ! Thanks !
has answer: http://stackoverflow.com/a/22691504
possible better answer: http://stackoverflow.com/a/22689349
has answer: http://stackoverflow.com/a/22689349
score: 0
tagged with: selenium
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/22691504
tagged with: java
has title: Selenium webdriver error when trying to lunch tests on a remote machine
type: Question

http://stackoverflow.com/q/22730227
tagged with: java
tagged with: javafx
type: Question
has answer: http://stackoverflow.com/a/23444861
upvote count: 4
has comment: http://stackoverflow.com/comment/74748039
linked to: http://stackoverflow.com/q/20370888
downvote count: 0
accepted answer: http://stackoverflow.com/a/23444861
score: 4
has comment: http://stackoverflow.com/comment/74524490
linked to: http://stackoverflow.com/q/17940329
linked to: http://stackoverflow.com/q/12194436
answer count: 1
tagged with: embedded-browser
favorite count: 0
linked to: http://stackoverflow.com/q/20279336
tagged with: screenshot
has comment: http://stackoverflow.com/comment/74579073
type: AnsweredQuestion
has body: Hi i'm using JavaFx WebView to create Screenshot of HTML pages and it works fine but i wanted to know is it possible to do this without launching the application in Graphical Windows!! I mean aren't there any more lightweight method to get the screenshot then this: public class WebViewSample extends Application { private Scene scene; @Override public void start(Stage stage) { // create scene scene = new Scene(new Browser(snapshot), 750, 500, Color.web("#666970")); stage.setScene(scene); // show stage stage.show(); } WritableImage snapshot; public static void main(String[] args) { launch(args); System.err.println("launched!"); } } class Browser extends Region { final ImageView selectedImage = new ImageView(); final WebView browser = new WebView(); final WebEngine webEngine = browser.getEngine(); private final WritableImage snapshotImage; public Browser(WritableImage snapshot) { this.snapshotImage= snapshot; // process page loading webEngine.getLoadWorker().stateProperty().addListener( new ChangeListener&lt;State&gt;() { @Override public void changed(ObservableValue&lt;? extends State&gt; ov, State oldState, State newState) { if (newState == State.SUCCEEDED) { WritableImage newSnapshot = browser.snapshot(null, snapshotImage); File file = new File("test2.png"); RenderedImage renderedImage = SwingFXUtils.fromFXImage(newSnapshot, null); try { ImageIO.write(renderedImage, "png", file); } catch (IOException e1) { e1.printStackTrace(); } System.exit(0); } } } ); // load the home page webEngine.load("http://localhost/"); //add components getChildren().add(browser); } }
has title: javafx snapshot without showing application or Scene

glassfish-4
tags question: http://stackoverflow.com/q/22665776
type: Tag
tags question: http://stackoverflow.com/q/22794772
tags question: http://stackoverflow.com/q/22678588
tags question: http://stackoverflow.com/q/22719496
tags question: http://stackoverflow.com/q/22662769
tag name: glassfish-4
tags question: http://stackoverflow.com/q/22780959
tags question: http://stackoverflow.com/q/22765590

http://stackoverflow.com/a/22655891
has comment: http://stackoverflow.com/comment/34509488
has comment: http://stackoverflow.com/comment/34510512
score: 0
has body: Use a Boolean flag. For Thread safety, use AtomicBoolean. AtomicBoolean running = new AtomicBoolean(Boolean.TRUE); In your run() method check this flag in a while condition: public void run(){ while(running){ ... } } When you want to stop this Thread, change the running to false
answers question: http://stackoverflow.com/q/22655734
has comment: http://stackoverflow.com/comment/34508546
type: Answer
has comment: http://stackoverflow.com/comment/34532731
has comment: http://stackoverflow.com/comment/34510292
has comment: http://stackoverflow.com/comment/34509825
has comment: http://stackoverflow.com/comment/34508617
has comment: http://stackoverflow.com/comment/34508437
has comment: http://stackoverflow.com/comment/34509005
downvote count: 1
has comment: http://stackoverflow.com/comment/34508751
has comment: http://stackoverflow.com/comment/34510401
upvote count: 1
has comment: http://stackoverflow.com/comment/34509699

http://stackoverflow.com/q/22704580
type: Question
accepted answer: http://stackoverflow.com/a/22704602
has title: exception in thread main java.util.nosuchelementexception with new Scanner(file)
has comment: http://stackoverflow.com/comment/34596206
answer count: 1
downvote count: 0
favorite count: 0
tagged with: java.util.scanner
upvote count: 2
score: 2
type: AnsweredQuestion
tagged with: nosuchelementexception
tagged with: java
linked to: http://stackoverflow.com/q/3402735
has body: I have a problem with my code,I get this error all the time: Exception in thread "main" java.util.NoSuchElementException at java.util.Scanner.throwFor(Scanner.java:907) at java.util.Scanner.next(Scanner.java:1416) at audio.AudioSecrets.main(AudioSecrets.java:32) Java Result: 1 my problem is this ligne: contents = new Scanner(file).useDelimiter("\\Z").next().toCharArray(); // The \\Z delimiter in combination with .next() will read input until there isn't any left. how can I input the file to my program,thanks for help
has answer: http://stackoverflow.com/a/22704602

http://stackoverflow.com/q/22675918
answer count: 1
favorite count: 0
tagged with: android
tagged with: drawing
tagged with: http://stackoverflow.com/tag/xml
downvote count: 0
tagged with: invalidation
type: Question
type: AnsweredQuestion
score: 1
tagged with: java
has title: Invalidate not calling onDraw()
has body: I am trying to call onDraw() whenever drawCircle() is pressed. I know that it is being called (by onClick in xml) because I get the message: "drawCircle pressed". The problem however, is that invalidate is not calling onDraw() which would draw a circle at a random place on the canvas, with a random color. I have tried placing the invalidate in DrawView and having drawCircle in my activity call that method but it also does not work. Any ideas why invalidate is not calling onDraw? Thanks In my XML I have defined my View: &lt;View android:layout_width="fill_parent" android:layout_height="1dp" android:background="#cccccc" android:paddingBottom="100dp" android:paddingTop="20dp" /&gt; &lt;com.example.genraterandomcircle.DrawView android:id="@+id/drawView1" android:layout_width="fill_parent" android:layout_height="wrap_content" android:layout_above="@+id/generateBtnId" android:background="#000000" /&gt; &lt;Button android:id="@+id/generateBtnId" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_alignLeft="@+id/drawView1" android:layout_alignParentBottom="true" android:layout_marginLeft="25dp" android:onClick="drawCircle" android:text="@string/generateBtnStr" /&gt; &lt;Button android:id="@+id/clearBtnId" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_alignBaseline="@+id/generateBtnId" android:layout_alignBottom="@+id/generateBtnId" android:layout_alignRight="@+id/drawView1" android:layout_marginRight="50dp" android:onClick="clearCircles" android:text="@string/clearBtnStr" /&gt; GenerateCircles.java: package com.example.genraterandomcircle; import android.os.Bundle; import android.app.Activity; import android.view.Menu; import android.view.View; public class GenerateCircles extends Activity { DrawView dv; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.layout_generate_circles); dv = new DrawView(this); } public void drawCir…
has answer: http://stackoverflow.com/a/22675992
accepted answer: http://stackoverflow.com/a/22675992
upvote count: 1

http://stackoverflow.com/q/22747368
has comment: http://stackoverflow.com/comment/34672598
has comment: http://stackoverflow.com/comment/34673332
accepted answer: http://stackoverflow.com/a/22747871
type: AnsweredQuestion
has title: Doubly linked list, Node cannot be resolved to a type
tagged with: linked-list
has comment: http://stackoverflow.com/comment/34672655
tagged with: java
downvote count: 1
tagged with: nodes
type: Question
has comment: http://stackoverflow.com/comment/34673244
tagged with: algorithm
has comment: http://stackoverflow.com/comment/34672634
score: -1
tagged with: data-structures
has comment: http://stackoverflow.com/comment/34672661
has comment: http://stackoverflow.com/comment/34676940
has body: I'm trying to make a doubly linked list class. When I try to compile I get the error "Node cannot be resolved to a type". Also I'm not sure on where I would start to make a displayAllBackward method. Would I make a node follow down the list until the last node, then use a loop to have it go back up the list? public class DoublyLL { private StudentListings l; private Node h; public DoublyLL() { h = new Node(); h.1 = null; h.next = null; } public boolean insert(StudentListings newStudentListings) { Node n = new Node(); n.l = newStudentListings.deepCopy(); Node p = h.next; Node q = h; while(p != null &amp;&amp; (p.l.compareTo(n.l.getKey()) &gt; 0)) { q = p; p = p.next; } if(n == null)//out of memory return false; else { n.next = p; q.next = n; n.back = q; if(p == null) return true; else { p.back=n; return true; } } }//end insert public StudentListings fetch(String targetKey) { Node p = h.next; while(p != null &amp;&amp; !(p.l.compareTo(targetKey) &lt; 0) &amp;&amp; !(p.l.compareTo(targetKey) == 0) ) { p = p.next; } if( p !=null) return null; else if (p.l.compareTo(targetKey)== 0) return p.l.deepCopy(); else return null; }//end fetch public boolean delete(String targetKey) { Node q = h; Node p = h.next; while(p != null &amp;&amp;!(p.l.compareTo(targetKey) &lt; 0) &amp;&amp; !(p.l.compareTo(targetKey)== 0)) { q = p; p = p.next; } if( p == null) return false; else if(p.next == null) { if(p.l.compareTo(targetKey)== 0) { q.next = null; return true; } else { return false; } } else if(p.l.compareTo(targetKey)== 0 &amp;&amp; p.next != null) { Node s = p.next; q.next = s; s.back = q; return true; } else return false; }//end delete public boolean update(String targetKey, StudentListings newStudentListings) { { if(delete(targetKey) == false) return false; else if (insert(newStudentListings) == false) return false; return true; } }//end update public void showAll() { Node p = h.next; while(p != null) { System.out.println(p.1.toString()); p = p.next; } } } Edit: Here's my student l…
has answer: http://stackoverflow.com/a/22747871
upvote count: 0
answer count: 1
favorite count: 0

http://stackoverflow.com/a/22705225
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/34597827
has body: The best thing you need to do is debug your code, you have hard coded the phone number in a format that may or may not occur, make sure in what format your receiver phone number appears? When I was working over it I was sending message over 0333xxx-xxxx number and I was receiving as +92xxx. But it's not sure for all, different telecommunication companies may use different format, for that you should use if(number.equals("+92333xxx-xxxxx")) or better use a contains, that would actually make it more appropriate to match the number and remove the possibility of format error if(number.contains("333xxx-xxxxx")){ // Your code to abort message } Hope this helps
type: Answer
has comment: http://stackoverflow.com/comment/34598776
has comment: http://stackoverflow.com/comment/34597447
has comment: http://stackoverflow.com/comment/34598638
upvote count: 3
has comment: http://stackoverflow.com/comment/34597676
score: 3
accepted answer of: http://stackoverflow.com/q/22705143
answers question: http://stackoverflow.com/q/22705143
has comment: http://stackoverflow.com/comment/34598896

http://stackoverflow.com/comment/34737458
type: QuestionComment
has text: @ArtemBilan As I know it involve further client request and HTTP response (not modified), but if new client wants download files (visits page), then read from disk happens.
comment on: http://stackoverflow.com/q/22780186
score: 0
type: Comment

http://stackoverflow.com/q/22773116
downvote count: 0
has body: I have an integration test class annotated as follows @WebAppConfiguration @ContextConfiguration(classes = {AppConfiguration.class}) @RunWith(SpringJUnit4ClassRunner.class) public class CacheConsumerTest { } Here's my AppConfiguration @Configuration @ComponentScan(basePackages = {"com.etc.etc.etc."}) @EnableWebMvc public class AppConfiguration { } For some reason, none of my @Component beans' @PreDestroy is getting called at the end of all tests in CacheConsumerTest. @PostConstruct is however being called at the start, before any tests are run. Anyone know what the problem may be? Some of my @Component are background threads that I would like to have shut off (by having its @Predestroy called), otherwise the work they do in the background will cause subsequent tests in other test classes to fail. I've tried adding @DirtiesContext(classMode=ClassMode.AFTER_CLASS) but it didn't help. EDIT: Figured out the problem, I had to do an additional step to make DirtiesContext work: Does Spring @DirtiesContext reload Spring context?
favorite count: 0
type: Question
tagged with: spring
has title: Spring: Why is @PreDestroy not called at end of each test class?
answer count: 1
upvote count: 6
tagged with: spring-mvc
has answer: http://stackoverflow.com/a/22773278
tagged with: java
tagged with: spring-junit
tagged with: component-scan
type: UnansweredQuestion
score: 6
linked to: http://stackoverflow.com/q/21239875

http://stackoverflow.com/q/22775286
tagged with: tags
tagged with: custom-tags
has answer: http://stackoverflow.com/a/22775354
score: 0
answer count: 1
tagged with: jsp
has title: Custom Tag Librarys JSP
accepted answer: http://stackoverflow.com/a/22775354
type: AnsweredQuestion
tagged with: java
type: Question
tagged with: taglib
has body: So I have a custom tag that currently works, but I would like to change it from the current date to show the date and the current time. this is what I have as an output Current Date/Time: Monday, March 31, 2014 This is my tag &lt;%@ tag language="java" pageEncoding="ISO-8859-1"%&gt; &lt;%@ tag import="java.util.Date" import="java.text.DateFormat"%&gt; &lt;% DateFormat dateFormat = DateFormat.getDateInstance(DateFormat.FULL); Date now = new Date(System.currentTimeMillis()); out.println(dateFormat.format(now)); %&gt;

http://stackoverflow.com/a/23944050
answers question: http://stackoverflow.com/q/22747409
score: 0
type: Answer
has body: As noted by Oli Charlesworth I was using an old version of Gradle (1.6) and there was no gradle init command, then I moved to the latest version and now works like a charm.

http://stackoverflow.com/comment/34547471
score: 0
has text: Also there is no data into the C:\Java\Homework\CH8 folder either. I searched the registry for Eclipse and haven't found anything either.
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/22677644

http://stackoverflow.com/q/22789142
has title: How to create jar for the java files created by JAXB?
has answer: http://stackoverflow.com/a/22789238
type: Question
answer count: 1
downvote count: 0
tagged with: jar
favorite count: 0
type: UnansweredQuestion
tagged with: maven
upvote count: 1
has body: In my project some java files are created by JAXB and then Maven creates a jar file including these java files created by JAXB. Now, i need these java files(created by JAXB) to be in another jar file that we will import later to be used in our project. Will really appreciate kind help? Thanks,
score: 1
tagged with: java
tagged with: jaxb

http://stackoverflow.com/tag/xml
tags question: http://stackoverflow.com/q/22673308
tags question: http://stackoverflow.com/q/22663101
tags question: http://stackoverflow.com/q/22715523
tags question: http://stackoverflow.com/q/22741752
tags question: http://stackoverflow.com/q/22788081
tags question: http://stackoverflow.com/q/22704806
tags question: http://stackoverflow.com/q/22772494
tags question: http://stackoverflow.com/q/22790146
tags question: http://stackoverflow.com/q/22701467
tags question: http://stackoverflow.com/q/22738161
tags question: http://stackoverflow.com/q/22779861
tags question: http://stackoverflow.com/q/22703192
type: Tag
tags question: http://stackoverflow.com/q/22743919
tags question: http://stackoverflow.com/q/22805512
tags question: http://stackoverflow.com/q/22722093
tags question: http://stackoverflow.com/q/22781659
tags question: http://stackoverflow.com/q/22658818
tags question: http://stackoverflow.com/q/22669452
tags question: http://stackoverflow.com/q/22655331
tags question: http://stackoverflow.com/q/22788599
tags question: http://stackoverflow.com/q/22793812
tags question: http://stackoverflow.com/q/22742238
tags question: http://stackoverflow.com/q/22678056
tags question: http://stackoverflow.com/q/22705663
tags question: http://stackoverflow.com/q/22750741
tags question: http://stackoverflow.com/q/22659635
tags question: http://stackoverflow.com/q/22714874
tags question: http://stackoverflow.com/q/22664592
tags question: http://stackoverflow.com/q/22765090
tags question: http://stackoverflow.com/q/22696012
tags question: http://stackoverflow.com/q/22789966
tags question: http://stackoverflow.com/q/22753969
tags question: http://stackoverflow.com/q/22679862
tags question: http://stackoverflow.com/q/22684770
tags question: http://stackoverflow.com/q/22782578
tags question: http://stackoverflow.com/q/22791098
tags question: http://stackoverflow.com/q/22784138
tags question: http://stackoverflow.com/q/22673386
tags question: http://stackoverflow.com/q/22741606
tags question: http://stackoverflow.com/q/22648833
tags question: http://stackoverflow.com/q/22794168
tags question: http://stackoverflow.com/q/22720675
tags question: http://stackoverflow.com/q/22792607
tags question: http://stackoverflow.com/q/22690301
tags question: http://stackoverflow.com/q/22662696
tags question: http://stackoverflow.com/q/22804811
tags question: http://stackoverflow.com/q/22726061
tags question: http://stackoverflow.com/q/22727804
tags question: http://stackoverflow.com/q/22749205
tags question: http://stackoverflow.com/q/22696950
tags question: http://stackoverflow.com/q/22650682
tags question: http://stackoverflow.com/q/22729330
tags question: http://stackoverflow.com/q/22794043
tags question: http://stackoverflow.com/q/22661406
tags question: http://stackoverflow.com/q/22659843
tags question: http://stackoverflow.com/q/22671110
tags question: http://stackoverflow.com/q/22665571
tags question: http://stackoverflow.com/q/22654907
tags question: http://stackoverflow.com/q/22668443
tags question: http://stackoverflow.com/q/22756803
tags question: http://stackoverflow.com/q/22776126
tags question: http://stackoverflow.com/q/22708894
tags question: http://stackoverflow.com/q/22745064
tags question: http://stackoverflow.com/q/22654309
tags question: http://stackoverflow.com/q/22798757
tags question: http://stackoverflow.com/q/22721471
tags question: http://stackoverflow.com/q/22804076
tags question: http://stackoverflow.com/q/22723778
tags question: http://stackoverflow.com/q/22693582
tags question: http://stackoverflow.com/q/22692073
tags question: http://stackoverflow.com/q/22701308
tags question: http://stackoverflow.com/q/22717078
tag name: xml
tags question: http://stackoverflow.com/q/22724330
tags question: http://stackoverflow.com/q/22772020
tags question: http://stackoverflow.com/q/22733089
tags question: http://stackoverflow.com/q/22658040
tags question: http://stackoverflow.com/q/22708339
tags question: http://stackoverflow.com/q/22738150

http://stackoverflow.com/comment/34641477
has text: If you use eclipse, you can click run as applet. Else you can write a simple html file to run it
comment on: http://stackoverflow.com/a/22729705
type: AnswerComment
score: 0
type: Comment

http://stackoverflow.com/a/22798270
downvote count: 2
has comment: http://stackoverflow.com/comment/102443523
score: 0
has comment: http://stackoverflow.com/comment/69619412
has body: Why am I not able to create stub in new Java 1.8? You are. Then what should I have to do for lookup of remote object without stub? With or without a stub, the lookup code is the same. See the documentation for java.rmi.server.UnicastRemoteObject. Good idea. Do that. error: Class serverside.Serverside not found. This error message has nothing to do with stubs. In short your question doesn't make any sense.
type: Answer
answers question: http://stackoverflow.com/q/22782363
upvote count: 2

kryonet
tags question: http://stackoverflow.com/q/22787693
tags question: http://stackoverflow.com/q/22732121
type: Tag
tag name: kryonet

http://stackoverflow.com/a/22778892
answers question: http://stackoverflow.com/q/22778732
type: AcceptedAnswer
downvote count: 0
accepted answer of: http://stackoverflow.com/q/22778732
type: Answer
score: 1
upvote count: 1
has body: To find expressions inside and which contain alphanumeric characters, spaces and exactly one pipe you can use the following regex \[\[[\w ]+[\|]{1}[\w ]+\]\] This however accounts only for those cases in which pipe isn't the first or the last character, but assuming from your question, this situation shouldn't occur.
has comment: http://stackoverflow.com/comment/34729494

http://stackoverflow.com/a/22749650
type: Answer
has body: you can looping through the string and check the operators and insert a space after each operator and before and parentheses too looks like. for( int i=0; i &lt; infix.Length; i++){ if(infix[i] == '*' || infix[i] == '-' ... ){ infix.insert(" ", i -1 ); infix.insert(" ", i +1 ); } } or you can remover all spaces and split the string using regex with all operators and handle the parentheses in a special case.
answers question: http://stackoverflow.com/q/22749350
score: 0

http://stackoverflow.com/a/22838735
answers question: http://stackoverflow.com/q/22763914
type: Answer
score: 2
downvote count: 0
upvote count: 2
has body: I was able to fix the my problem. I was not adding multipart. This link helped me Following is what i did to replace the body-part definition FormDataBodyPart f = new FormDataBodyPart(FormDataContentDisposition .name("fileUpload").fileName(file).build(), new ByteArrayInputStream(img), MediaType.APPLICATION_OCTET_STREAM_TYPE); MultiPart multiPart = new FormDataMultiPart().bodyPart(f); ClientResponse rs = wr.type(MediaType.MULTIPART_FORM_DATA).put( ClientResponse.class, multiPart);

http://stackoverflow.com/q/22756523
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/34689334
tagged with: java
possible better answer: http://stackoverflow.com/a/22756757
has answer: http://stackoverflow.com/a/22756757
type: Question
answer count: 2
has title: Strange behavior of double data type
has comment: http://stackoverflow.com/comment/34690018
score: 0
has answer: http://stackoverflow.com/a/22757934
accepted answer: http://stackoverflow.com/a/22757934
tagged with: integer
tagged with: double
has body: My code is as follows: Number inputAmount = NumberFormat.getNumberInstance(Locale.FRANCE).parse("7,10"); double doubleValue = inputAmount.doubleValue(); int intValue = (int) (doubleValue * 100); System.out.println("Input: " + inputAmount); System.out.println("Double: " + doubleValue); System.out.println("Integer: " + intValue); which outputs: Input: 7.1 Double: 7.1 Integer: 710 But, when the inputValue is 5,10 the output is: Input: 5.1 Double: 5.1 Integer: 509 This happens only with 5,10 and 4,10. I know that it happens due to the double precision but I cannot figure out exactly how. Any ideas?

http://stackoverflow.com/comment/34749146
type: AnswerComment
type: Comment
has text: Giovanni, you are on the wrong track. "to save" and "to cache" are two different concepts. Nothing is ever saved in the cache. The cache just holds data that is likely to be needed or modified again, very near in the future. This is not only data, but also CPU instruction code as well. See: http://en.wikipedia.org/wiki/CPU_cache
comment on: http://stackoverflow.com/a/22781049
score: 0

http://stackoverflow.com/a/22668157
has body: Okay, I've solved it, thanks to the previous answer pointing me towards 'around' and also to this tutorial which was really useful (http://www.compiletimeerror.com/2013/05/spring-aop-around-advice-example.html#.UzMAJvkRAmM). Here is the main method: public static void main( String[] args ){ ApplicationContext context = new ClassPathXmlApplicationContext("context.xml"); List&lt;String&gt; names = new ArrayList&lt;String&gt;(); List&lt;User&gt; users = new ArrayList&lt;User&gt;(); names.add("Chris"); names.add("Dave"); names.add(";DROP table"); names.add("Bob"); User user = null; for(String name : names){ user = context.getBean("user", User.class); user.setUsername(name); if(user.getUsername()!=null){ users.add(user); } } for(User u : users){ System.out.println(u.getUsername()); } } Here is the check method in Security: public void check(ProceedingJoinPoint pjp) throws Throwable { boolean match = false; Object o[] = pjp.getArgs(); for(String word: words){ if(o[0].toString().toLowerCase().contains(word)){ System.err.println("Unsafe word " + word + " found!!!!!"); match = true; } } if(!match){ pjp.proceed(); return; } } And here is the context.xml: &lt;bean id="user" class="com.company.springAOPExample.User" scope="prototype" /&gt; &lt;bean id="security" class="com.company.springAOPExample.Security" /&gt; &lt;aop:config&gt; &lt;aop:aspect ref="security"&gt; &lt;aop:pointcut id="setUsername" expression="execution(* com.company.springAOPExample.User.setUsername(java.lang.String))" /&gt; &lt;aop:around pointcut-ref="setUsername" method="check" /&gt; &lt;/aop:aspect&gt; &lt;/aop:config&gt;
score: 0
answers question: http://stackoverflow.com/q/22660260
type: Answer

http://stackoverflow.com/comment/34631059
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/22723683
has text: It is better why it seems not to work, because it surely works if well configured. Can you explain how is your jar file structured? Is your Maps folder placed directly in the jar or in a sub-folder?
score: 0

http://stackoverflow.com/comment/34759323
type: Comment
type: QuestionComment
score: 2
has text: Not directly related to your problem, but I'd recommend changing the end of your regex to `{2,6}`, given the newer, longer TLDs (`.museum`, `.berlin`, etc).
comment on: http://stackoverflow.com/q/22795237

http://stackoverflow.com/a/22733691
upvote count: 2
type: Answer
has comment: http://stackoverflow.com/comment/34649135
has comment: http://stackoverflow.com/comment/34649472
has comment: http://stackoverflow.com/comment/34649163
has comment: http://stackoverflow.com/comment/34648709
has comment: http://stackoverflow.com/comment/34649967
has comment: http://stackoverflow.com/comment/34649821
score: 2
has body: Have a look at this Java code: public class Person { Integer wallet = new Integer(100); } and run the Thief class: public class Thief { Person victim = new Person(); public static void main (String[] args) { Thief thief = new Thief(); System.out.println("I take $"+ thief.victim.wallet + " from your wallet!"); } } The result is: I take $100 from your wallet! It does not even have to be an instance of the same class. In case you declare a Java variable as private, instances of the same class could still access each other's instance variables. If you adapt the above example, a thief could still steal from another thief: public class Thief { private Integer wallet = new Integer(100); public Thief victim() { Thief victim = new Thief(); return victim; } public static void main (String[] args) { Thief thief = new Thief(); System.out.println("I take $"+ thief.victim().wallet + " from your wallet!"); } } This is not possible in Smalltalk.
answers question: http://stackoverflow.com/q/22733171
downvote count: 0
has comment: http://stackoverflow.com/comment/34648964

http://stackoverflow.com/comment/34582442
score: 0
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/22664361
has text: I am still not quite sure though what i did wrong in my initial approach. Even if the viewport handles projecting/unprojecting, this should only mess around with my coordinates, right? since i did set the hit() method so that it would always trigger, i don't understand why the viewport could prevent my touchevents from firing.

http://stackoverflow.com/comment/34725684
score: 0
type: Comment
type: QuestionComment
has text: Ok now I changed my code , a socket with a while true loop, with this it will stay right ? as long as the service is running I am able to telnet that port am I right. But currently I am unable to start that services.Error : wrapper | Launching a JVM... jvm 1 | server started wrapper | Startup failed: Timed out waiting for a signal from the JVM.
comment on: http://stackoverflow.com/q/22776382

http://stackoverflow.com/comment/34822771
has text: See the first item at https://www.iforce2d.net/b2dtut/gotchas Box2D is supposed to clamp the velocity to a maximum value, not make it zero like in your output log, I wonder if that is a problem with libGDX...?
comment on: http://stackoverflow.com/q/22799601
score: 0
type: QuestionComment
type: Comment

http://stackoverflow.com/comment/34769370
comment on: http://stackoverflow.com/q/22775408
has text: I just touched the problem now. I think my ConcurrentMap is not putting reliably.
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/a/22760824
upvote count: 2
answers question: http://stackoverflow.com/q/22760722
type: AcceptedAnswer
downvote count: 0
accepted answer of: http://stackoverflow.com/q/22760722
type: Answer
has body: Check out the FileChannel#tryLock(...) function. That should do what you need.
score: 2

http://stackoverflow.com/a/35127777
has body: I had same problem and way to resolve was next: remove all unused dependencies from POM.xml for example if u use only FirefoxDriver and in POM.xml there are anothers one (Chrome, Common, remote) delete them
type: Answer
answers question: http://stackoverflow.com/q/22763752
upvote count: 1
downvote count: 0
score: 1

http://stackoverflow.com/comment/34534802
comment on: http://stackoverflow.com/q/22669770
has text: You still need it on your build path so that the program can compile and run. Do you see the jar in your java build path through Eclipse? It has to be missing. If it is in your build path, can you expand that jar and see this class present in exactly the same package as you have mentioned. It has to be this.
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/q/22808223
has answer: http://stackoverflow.com/a/31664842
downvote count: 0
has comment: http://stackoverflow.com/comment/36483337
has comment: http://stackoverflow.com/comment/61115317
has answer: http://stackoverflow.com/a/29942660
tagged with: javafx-8
answer count: 3
accepted answer: http://stackoverflow.com/a/31664842
favorite count: 0
has answer: http://stackoverflow.com/a/23681208
has title: JavaFX 8 swing compatibility
linked to: http://stackoverflow.com/q/10312796
possible better answer: http://stackoverflow.com/a/23681208
score: 14
type: AnsweredQuestion
upvote count: 14
tagged with: java
tagged with: javafx
has comment: http://stackoverflow.com/comment/35291261
has body: I am currently evaluating whether it would be feasible to convert my current Swing Application to JavaFX 8 using SwingNode and then slowly change everything to JavaFX components. I have stumbled over two problems, which may be lingering bugs in JavaFX 8, but I can't be sure. After adding content to the SwingNode the Javafx menu isn't painted properly (most of the time), resulting in a black bar Making JScrollBars non-opaque doesn't seem to work import java.awt.Color; import java.awt.GridLayout; import javafx.application.Application; import javafx.embed.swing.SwingNode; import javafx.scene.Scene; import javafx.scene.control.Menu; import javafx.scene.control.MenuBar; import javafx.scene.layout.StackPane; import javafx.scene.layout.VBox; import javafx.stage.Stage; import javax.swing.JPanel; import javax.swing.JScrollPane; public class Test extends Application { @Override public void start(Stage stage) throws Exception { stage.setMaximized(true); VBox vbox = new VBox(); MenuBar menuBar = new MenuBar(); menuBar.getMenus().add(new Menu("bla")); vbox.getChildren().add(menuBar); StackPane mainPane = new StackPane(); mainPane.setPrefSize(9999, 9999); //Better way to ensure all space used? vbox.getChildren().add(mainPane); vbox.setVisible(true); Scene scene = new Scene(vbox, 9999, 9999); //Better way to ensure all space used? stage.setScene(scene); SwingNode swingNode = new SwingNode(); mainPane.getChildren().add(swingNode); JPanel jPanel = new JPanel(); swingNode.setContent(jPanel); //Seems to interfere with painting of menu jPanel.setBackground(Color.WHITE); jPanel.setLayout(new GridLayout(2, 1)); jPanel.add(new JPanel()); JPanel nonOpaquePanel = new JPanel(); nonOpaquePanel.setOpaque(false); JScrollPane scrollPane = new JScrollPane(nonOpaquePanel); scrollPane.setOpaque(false); scrollPane.getViewport().setOpaque(false); //Black background -&gt; Bug? jPanel.add(scrollPane); stage.show(); } /** * Main method launching the application. */ public static void main(String[] args)…
type: Question

http://stackoverflow.com/q/22690418
type: AnsweredQuestion
tagged with: java
type: Question
answer count: 2
has body: I have a String called s I have four JButtons b1 b2 b3 b4 By default String s is Hello World b1 Makes String s toUpperCase b2 Makes String s toLowerCase b3 Allows user to change String b4 Resets String to Hello World When I run the program I have s set to Hello World but when I click my buttons the String is not changing to its new attribute. import java.awt.EventQueue; import java.awt.event.*; import javax.swing.*; public class Driver { String s = "Hell World"; String up; String low; private JFrame f; private JPanel p; JFrame frame = new JFrame("Add Some Text"); JButton b1 = new JButton("Uppercase"); JButton b2 = new JButton("Lowercase"); JButton b3 = new JButton("New"); JButton b4 = new JButton("Reset"); JLabel jl = new JLabel(s); public Driver () { gui(); } public void gui() { f = new JFrame("Hello World"); p = new JPanel(); f.add(p); p.setLayout(null); p.add(b1); p.add(b2); p.add(b3); p.add(b4); p.add(jl); b1.setLocation(27, 80); b2.setLocation(300, 80); b3.setLocation(27, 180); b4.setLocation(300, 180); jl.setLocation(240, 20); b1.setSize(230, 80); b2.setSize(230, 80); b3.setSize(230, 80); b4.setSize(230, 80); jl.setSize(230, 20); // pack the frame for better cross platform support f.pack(); // Make it visible f.setVisible(true); f.setSize(560,300); // default size is 0,0 f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); b1.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e){ up = s.toUpperCase(); } }); b2.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e){ low = s.toLowerCase(); } }); b3.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e){ s = JOptionPane.showInputDialog(frame, ""); } }); b4.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e){ s = "Hello World"; } }); } public static void main(String[] args) { EventQueue.invokeLater(new Runnable() { public void run() { new Driver(); } }); } // End main Method } // End class Driver
score: 0
possible better answer: http://stackoverflow.com/a/22690526
tagged with: string
accepted answer: http://stackoverflow.com/a/22690542
has answer: http://stackoverflow.com/a/22690526
has answer: http://stackoverflow.com/a/22690542
has title: Changing a String data with Jbuttons in Java

http://stackoverflow.com/q/22761673
tagged with: java
type: Question
possible better answer: http://stackoverflow.com/a/22761845
has title: Injection of arbitrary object into Spring bean
has answer: http://stackoverflow.com/a/22761845
has answer: http://stackoverflow.com/a/22761874
tagged with: spring-el
answer count: 3
downvote count: 0
favorite count: 0
accepted answer: http://stackoverflow.com/a/22761874
has comment: http://stackoverflow.com/comment/34699361
tagged with: spring
has comment: http://stackoverflow.com/comment/34708215
has body: My class contains several methods those return some Java objects, i.e. InputStream and OutputStream: public class Provider { public InputStream getInputStream() { ... } public OutputStream getOutputStream() { ... } } From the other hand I have a third-party class whose constructor can accept InputStream and OutputStream: public class Consumer { public Consumer(InputStream is, OutputStream os) { ... } } The issue is: how to inject dependency on Provider's streams into Consumer bean? Here is my XML file for Spring: &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" xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.0.xsd"&gt; &lt;bean id="provider" class="org.example.Provider" /&gt; &lt;bean id="consumer" class="org.example.Consumer"&gt; &lt;constructor-arg value="#{provider.inputStream}" /&gt; &lt;constructor-arg value="#{provider.outputStream}" /&gt; &lt;/bean&gt; &lt;/beans&gt; Unforunatelly, the solution above leads to the following error: Apr 01, 2014 10:54:59 AM org.springframework.context.support.AbstractApplicationContext prepareRefresh INFO: Refreshing org.springframework.context.support.FileSystemXmlApplicationContext@5f18cd5: display name [org.springframework.context.support.FileSystemXmlApplicationContext@5f18cd5]; startup date [Tue Apr 01 10:54:59 MSK 2014]; root of context hierarchy Apr 01, 2014 10:54:59 AM org.springframework.beans.factory.xml.XmlBeanDefinitionReader loadBeanDefinitions INFO: Loading XML bean definitions from file [C:\Test\context.xml] Apr 01, 2014 10:54:59 AM org.springframework.context.support.AbstractApplicationContext obtainFreshBeanFactory INFO: Bean factory for application context [org.springframework.context.support.FileSystemXmlApplicationContext@5f18cd5]: org.springframework.beans.factory.support.DefaultListableBeanFactory@2d30be8c Apr 01, 2014 10:5…
has answer: http://stackoverflow.com/a/22779592
score: 2
type: AnsweredQuestion
upvote count: 2

http://stackoverflow.com/comment/34599892
type: AnswerComment
has text: It doesn't slow the process... can you please explain in detail.
type: Comment
comment on: http://stackoverflow.com/a/22686669
score: 0

http://stackoverflow.com/comment/34716720
type: Comment
has text: @Vishrant No. It's not returning a string at all. It's returning a reference to a `StringBuilder`. The reference returned is the same one that `return` specified. Modifying the object that reference points to has no impact on the actual reference value that is returned; it's still the same `StringBuilder`.
score: 1
comment on: http://stackoverflow.com/a/22771521
type: AnswerComment

http://stackoverflow.com/q/22729920
has answer: http://stackoverflow.com/a/22730053
possible better answer: http://stackoverflow.com/a/22730320
accepted answer: http://stackoverflow.com/a/22730053
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/34641685
type: Question
has answer: http://stackoverflow.com/a/22730177
tagged with: java
score: 0
answer count: 3
tagged with: keyboard
has body: I want to take input from keyboard in my java program until the user type abc Here is the code which i have written but it doesn't work. the program continues to take input from keyboard even after i have typed abc and lastly I have to close the program by myself. It takes in input from keyboard and write it on a file named file1.txt import java.io.*; import java.util.*; public class io { public static void main(String args[]) { try { BufferedWriter writer = new BufferedWriter(new FileWriter("file1.txt", true)); Scanner keyboard = new Scanner(System.in); do { writer.write(keyboard.next()); writer.newLine(); } while (keyboard.next() != "abc"); writer.close(); } catch (IOException e) { e.printStackTrace(); } } }
has answer: http://stackoverflow.com/a/22730320
linked to: http://stackoverflow.com/q/513832
has title: how to take input from keyboard in java till some words
tagged with: input

http://stackoverflow.com/comment/34594683
type: QuestionComment
has text: You can try SQL Trace.
score: 0
comment on: http://stackoverflow.com/q/22703621
type: Comment

http://stackoverflow.com/q/22772523
tagged with: java
score: -1
type: Question
upvote count: 0
answer count: 1
favorite count: 0
has comment: http://stackoverflow.com/comment/34718795
tagged with: user-input
tagged with: listener
has answer: http://stackoverflow.com/a/22774940
has comment: http://stackoverflow.com/comment/34810709
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/34719834
tagged with: jcomponent
tagged with: swing
has comment: http://stackoverflow.com/comment/34718962
downvote count: 1
has comment: http://stackoverflow.com/comment/34718715
has body: Right now, I'm overriding JFrame.addKeyListener(KeyListener), checking the components in it's content pane, then adding listeners to all those components (after using super to invoke the original method) JFrame frame = new JFrame() { public void addKeyListener(KeyListener l) { super.addKeyListener(l); for(Component c : getContentPane().getComponents()) { c.addKeyListener(l); } } }; I'm not sure if this is the normally practiced way of adding listeners to a hierarchy of components, but it's the only one I can think of. Is there something already built into the standard JDK that is meant for this?
has title: Is there a more dynamic way of adding listener to all components in parent?

http://stackoverflow.com/comment/34790836
type: Comment
type: QuestionComment
has text: In fact, I have changed a lot of things and now, this case does not exist and there is no error. Finally, I would like to focus on my second question. What should be (considering the **"good taste of Spring")** in `myproject-servlet.xml` and what in `web.xml`?
comment on: http://stackoverflow.com/q/22805512
score: 0

http://stackoverflow.com/comment/34510338
comment on: http://stackoverflow.com/a/22656958
score: 0
type: AnswerComment
type: Comment
has text: actually i can insert update delete reord and my mapping is done correctly but the problem is my supllier table has filed with column name "name" and item table also has field with column name "name" so how can it works if 2 parent table has same name of column

http://stackoverflow.com/comment/34675525
score: 0
has text: Dude, I dont know what are you talking about with that question (Ant or Maven?), I just build it by NetBeans (http://oi59.tinypic.com/259baf4.jpg). My resources are in packages, it's project tree: http://oi61.tinypic.com/168bi20.jpg
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/22748822

http://stackoverflow.com/comment/34591350
comment on: http://stackoverflow.com/q/22697517
score: 0
type: QuestionComment
type: Comment
has text: Done. Also added a note about TextureView.

http://stackoverflow.com/comment/34604270
type: Comment
comment on: http://stackoverflow.com/a/22708849
type: AnswerComment
has text: Well, I like think I was sort of close. Makes so much more sense that way. Thank you!
score: 0

http://stackoverflow.com/q/22796350
has body: OK I have a simple task, I just want to use Google's search engine, more specifically, the autocorrect part. Let's say I Google this: https://www.google.com/search?q=matew+mccaonaghey As you can see, Google showed results for "matthew mcconaughey", thus autocorrected the input. So, I did a bit of research and found that http://suggestqueries.google.com can be used to query such inputs. While it worked OK most of the time, the funniest thing: when I tried to get the result for "matew mccaonaghey", I got back an empty JSON. If I changed search string to "mathew mccoanaghey", the results are OK. What am I missing? Doesn't suggestqueries.google.com work the same as www.google.com? Why do I get empty json in case of suggestqueries and an actual result when using google.com? Thank you for your answers. The code is as follows: URL url = new URL("http://suggestqueries.google.com/complete/search?output=firefox&amp;client=firefox&amp;hl=en-US&amp;q=matew+mccaonaghey"); URLConnection conn = (URLConnection) url.openConnection(); conn.setRequestProperty("User-Agent", "Mozilla/5.0 (Windows NT 6.2; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/32.0.1667.0 Safari/537.36"); conn.connect(); BufferedReader serverResponse = new BufferedReader( new InputStreamReader(conn.getInputStream())); System.out.println(serverResponse.readLine()); serverResponse.close();
answer count: 1
favorite count: 0
upvote count: 5
has title: Implementing Google suggestions
tagged with: search-engine
type: AnsweredQuestion
tagged with: java
has answer: http://stackoverflow.com/a/22870408
accepted answer: http://stackoverflow.com/a/22870408
type: Question
score: 5
downvote count: 0

http://stackoverflow.com/comment/34733786
comment on: http://stackoverflow.com/q/22777952
has text: 1) For many components in one space, use a [`CardLayout`](http://docs.oracle.com/javase/7/docs/api/java/awt/CardLayout.html) as seen in this [short example](http://stackoverflow.com/a/5786005/418556). 2) For better help sooner, post an [MCVE](http://stackoverflow.com/help/mcve) (Minimal Complete and Verifiable Example).
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/a/22724881
type: Answer
answers question: http://stackoverflow.com/q/22724760
accepted answer of: http://stackoverflow.com/q/22724760
upvote count: 1
has body: JLabel is a Swing GUI component. It represents a text label in a GUI. It is not what you want to use here (although I can understand your attraction to the "Label" in its name -- but, you don't make ham with a hammer). Your requirement is simply "print all the values in the array with labels to indicate the location of each element, such as [0] = xx". That is, "labels" in the dictionary sense, not "labels" as in some explicit special "label" class. It's simpler than you think, you may be over-complicating this! For example: for (int i = 0; i &lt; x.length; i ++) { // 'i' is the index // 'x[i]' is the value System.out.println( /* fill this in */ ); } I'll leave the details as an exercise to you. Hint: If i==1 and x[i]==42 then the output should be [1] = 42.
has comment: http://stackoverflow.com/comment/34633294
type: AcceptedAnswer
downvote count: 0
score: 1
has comment: http://stackoverflow.com/comment/34633314
has comment: http://stackoverflow.com/comment/34633347

http://stackoverflow.com/comment/34654181
comment on: http://stackoverflow.com/q/22736724
type: Comment
type: QuestionComment
has text: @JasonC I know how this works but I was just a little confused at this late hour...
score: 0

http://stackoverflow.com/comment/34577141
type: Comment
score: 0
comment on: http://stackoverflow.com/q/22693967
type: QuestionComment
has text: Well, if there's no information available, it's all crystal ball.

http://stackoverflow.com/a/22769052
has comment: http://stackoverflow.com/comment/34745790
answers question: http://stackoverflow.com/q/22761851
type: Answer
score: 1
has comment: http://stackoverflow.com/comment/34749020
upvote count: 1
has body: Since you tagged the question with Groovy, its native JsonBuilder seems to work as expected: import groovy.json.* a = new JsonBuilder(mything: "[1, 2, 3]") assert a.toString() == '{"mything":"[1, 2, 3]"}' b = new JsonBuilder(params: a.getContent()) assert b.toString() == '{"params":{"mything":"[1, 2, 3]"}}'
has comment: http://stackoverflow.com/comment/34752457
downvote count: 0
has comment: http://stackoverflow.com/comment/34748866

http://stackoverflow.com/comment/34559371
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/22682176
has text: Maby I explain badly myself. postimg.org/image/xzsdixh77 (I cant upload images) I need to change from content A to content C clicking the button but it needs to happen in the TabContent
type: Comment

http://stackoverflow.com/q/22731320
answer count: 1
has body: I have this method where i am trying to read in from a text file and then add whats in it to my array ,my method seems to be okay , but when i rum my program i am getting null on the screen please help here is my code. File text = new File("C:\\Users\\Stephen\\Desktop\\CA2\\src\\Management_System_Package\\GAMES.txt"); Scanner scnr = new Scanner(text); String GameLine; GameLine = scnr.nextLine(); while (scnr.hasNextLine()) { Management_System Game = new Management_System("", "", 0, 0, 0); int Comma1 = GameLine.indexOf(", "); String Title = GameLine.substring(0, Comma1).trim(); Game.setTitle(Title); System.out.print(Title); int Comma2 = GameLine.indexOf(", ", Comma1 + 1 ); String Genre = GameLine.substring(Comma1 + 1, Comma2); Game.setGenre(Genre); int Comma3 = GameLine.indexOf(", ", Comma2 + 1 ); String ID = GameLine.substring(Comma2 + 1, Comma3); Game.setID(Double.parseDouble(ID)); int Comma4 = GameLine.indexOf(", ", Comma3 + 1 ); String Rating = GameLine.substring(Comma3 + 1, Comma4); Game.setRating(Integer.parseInt(Rating)); String Quantity = GameLine.substring(Comma4 + 1).trim(); Game.setQuantity(Integer.parseInt(Quantity)); add(Game); GameLine = in.nextLine();
has comment: http://stackoverflow.com/comment/34644126
type: AnsweredQuestion
tagged with: java
type: Question
has comment: http://stackoverflow.com/comment/34644132
accepted answer: http://stackoverflow.com/a/22731352
tagged with: arrays
has title: Java Reading from a text file (Strings and integers)
score: 0
tagged with: while-loop
has answer: http://stackoverflow.com/a/22731352

http://stackoverflow.com/comment/73182586
has text: fun main(args: Array<String>) { val sources = listOf( Observable.just(1, 2, 3, 4, 5), Observable.just(10, 20, 30, 40, 50), Observable.just(100, 200, 300, 400, 500) ) var cartesianProduct: Observable<List<Int>>? = null for (obs in sources) { if (cartesianProduct == null) { cartesianProduct = obs.map { listOf(it) } } else { cartesianProduct = cartesianProduct.flatMap { list -> obs.map { list.plus(it) }} } } cartesianProduct!!.subscribe(::println) }
type: Comment
comment on: http://stackoverflow.com/a/26588822
score: 0
type: AnswerComment

http://stackoverflow.com/q/22773090
has comment: http://stackoverflow.com/comment/34719775
type: Question
downvote count: 0
has answer: http://stackoverflow.com/a/22773290
has body: I am looking to find the path to a specific folder in Java as part of a bigger program. What I have is a recursive function that checks every file that is contained within a starting directory and if it finds the folder I am looking for it assigns the path as a string to a variable. The following code works: //root is the starting directory and name is the folder I am looking for private void findDir(File root, String name) { if (root.getName().equals(name)) { toFind = root.getAbsolutePath(); } File[] files = root.listFiles(); if(files != null) { for (File f : files) { if(f.isDirectory()) { findDir(f, name); } } } } This works but I do not like the fact that I have to use the 'toFind' variable. My question is is there a way to make the method return a String instead of void? This will also save the program from checking all the other files in the system after finding the one it is looking for. I was thinking of something like this but the following code will return null even if it finds the folder. private String findDir(File root, String name) { if (root.getName().equals(name)) { return root.getAbsolutePath(); } File[] files = root.listFiles(); if(files != null) { for (File f : files) { if(f.isDirectory()) { return findDir(f, name); } } } return null; //??? }
has title: Find specific folder in Java
tagged with: io
answer count: 1
has comment: http://stackoverflow.com/comment/34719602
favorite count: 0
upvote count: 2
accepted answer: http://stackoverflow.com/a/22773290
tagged with: recursion
score: 2
type: AnsweredQuestion
tagged with: java
tagged with: file

http://stackoverflow.com/a/22733170
type: Answer
has body: The JVM is by definition a virtual machine, that is a software machine that simulates what a real machine does. Like real machines it has an instruction set (the bytecodes), a virtual computer architecture and an execution model. It is capable of running code written with this virtual instruction set, pretty much like a real machine can run machine code. So, the class files contain the instructions in the virtual instruction set, and it is capable of running them. For that matter, a virtual machine can either interpret the code itself or compile it for the hardware architecture it is currently running. Some do both, some do just one of them (e.g. .net runtime compiles once the first time the method is called). For instance, the Java HotSpot initially interprets bytecodes, and progressively compiles the code into machine code. This is called adaptive optimization. Some virtual machines always compile to machine code directly. So, you can see there are two different "compiling concepts". One consists in the transformation of Java code to JVM bytecodes (From .java to .class). And a second compilation phase happens when the program runs, where the bytecodes may either be interpreted or compiled to actual machine code. This is done by the just-in-time compiler, within the JVM. So, as you can see, a computer cannot run a Java program directly because the program is not written in a language that the computer understands. It is written in lingua-franca that all JVM implementations can understand. And there are implementations of that JVM for many operating systems and hardware architectures. These JVMs translate the programs in this lingua-franca (bytecodes) for any particular hardware (machine code). That's the beauty of the virtual machine.
score: 8
accepted answer of: http://stackoverflow.com/q/22733132
answers question: http://stackoverflow.com/q/22733132
type: AcceptedAnswer
downvote count: 0
upvote count: 8

http://stackoverflow.com/a/22763907
upvote count: 1
downvote count: 0
score: 1
has comment: http://stackoverflow.com/comment/34703519
has body: Starting from solr 4.7 you can read all configuration files using http requests. For example: http://yourhost:8983/solr/yourcore/admin/file?file=stopwords.txt
type: Answer
answers question: http://stackoverflow.com/q/22758119

http://stackoverflow.com/comment/34727189
type: QuestionComment
has text: Well, here http://docs.oracle.com/javase/tutorial/java/nutsandbolts/datatypes.html they say, that "int data type is a 32-bit signed two's complement integer". So, it's about how should I imagine it? Or what?
comment on: http://stackoverflow.com/q/22769014
score: 0
type: Comment

http://stackoverflow.com/q/22797382
tagged with: android
has answer: http://stackoverflow.com/a/71017463
downvote count: 2
type: Question
score: -2
tagged with: java
has title: convert string to double (java/android)
answer count: 2
upvote count: 0
has comment: http://stackoverflow.com/comment/34763031
tagged with: string
favorite count: 0
has body: I have string like "122.32,20.543". I tried to use DecimalFormatSymbols, but I had some problems. How to convert it to double like double1 = 122.32 and double = 20.543 in Java /android.
type: UnansweredQuestion
tagged with: double
has answer: http://stackoverflow.com/a/22797434

http://stackoverflow.com/comment/34695141
type: QuestionComment
has text: I am trying to get msg through queue.take() when condition match with data that is also getting from take() method. means wanna execute blocks of code in one thread on condition matched of take() method. Thanks
score: 0
type: Comment
comment on: http://stackoverflow.com/q/22756577

http://stackoverflow.com/a/22754100
type: Answer
has comment: http://stackoverflow.com/comment/34685955
has comment: http://stackoverflow.com/comment/34685984
has body: Not sure what you mean here, but if the "value to retrieve" is done using regexes, I have just completed a project allowing to use regexes on large text files (max 2 GiB approximately, due to the int limit of a CharSequence): private static final LargeTextFactory FACTORY = LargeTextFactory.defaultFactory(); public List&lt;String&gt; getMatchesForPattern(final Path file, final String re) throws IOException { final Pattern p = Pattern.compile(re); final List&lt;String&gt; ret = new ArrayList&lt;&gt;(); try ( final LargeText text = FACTORY.fromPath(file); ) { final Matcher m = p.matcher(text); while (m.find()) ret.add(m.group()); return ret; } } No need to use perl anymore ;) Except if you use perl-specific regex features, of course Final note: if your input is structured, ie an HTML input etc, you are better off using a dedicated library; for HTML, that would be jsoup for instance.
has comment: http://stackoverflow.com/comment/34686003
has comment: http://stackoverflow.com/comment/34685669
has comment: http://stackoverflow.com/comment/34685876
score: 0
has comment: http://stackoverflow.com/comment/34685079
answers question: http://stackoverflow.com/q/22753979
has comment: http://stackoverflow.com/comment/34685043
has comment: http://stackoverflow.com/comment/34685284
has comment: http://stackoverflow.com/comment/34686849

http://stackoverflow.com/comment/34499146
comment on: http://stackoverflow.com/q/22650404
type: Comment
type: QuestionComment
score: 1
has text: If the speed is constant, the location after 1 second should be the distance between the two points divided by 2.4 (in other words `1/2.4` times the total distance). This is a basic example of using ratios or proportions.

http://stackoverflow.com/a/22689413
downvote count: 0
score: 1
answers question: http://stackoverflow.com/q/22689299
type: Answer
upvote count: 1
has comment: http://stackoverflow.com/comment/34568907
has body: Try changing it to new FileInputStream("com.infosys.gidl2.shiplabel.mybatis.config."+ propsDB);

http://stackoverflow.com/q/22698013
tagged with: model-view-controller
linked to: http://stackoverflow.com/q/3066590
has comment: http://stackoverflow.com/comment/34597123
has comment: http://stackoverflow.com/comment/34584086
score: 0
tagged with: java
has body: I am trying to create desktop Java Swing application according to MVC pattern. Where should I put my application settings logic? Is it a part of view or model or controller? For example: I want to save application window size and position to hard drive. I will use DataOutputStream to save them into external file.
answer count: 0
type: UnansweredQuestion
has title: Model-View-Controller and application settings
type: Question
tagged with: swing
tagged with: settings

http://stackoverflow.com/comment/34713663
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/22768502
type: Comment
has text: Close! When I put in -12345, I got -15 instead of 13. Thanks so much for your help, though! I'm learning a little more from all of the programs posted.

http://stackoverflow.com/a/22803234
type: Answer
has comment: http://stackoverflow.com/comment/34886452
upvote count: 5
accepted answer of: http://stackoverflow.com/q/22775758
answers question: http://stackoverflow.com/q/22775758
has comment: http://stackoverflow.com/comment/34773942
downvote count: 0
has comment: http://stackoverflow.com/comment/34774394
has comment: http://stackoverflow.com/comment/34774947
has body: The solution is to use the new API and file.encoding. Demonstration: fge@alustriel:~/tmp/filenameenc$ echo $LC_ALL en_US.UTF-8 fge@alustriel:~/tmp/filenameenc$ cat Test.java import java.io.File; import java.nio.file.Files; import java.nio.file.Path; import java.nio.file.Paths; public class Test { public static void main(String[] args) { final String testString = "a/üöä"; final Path path = Paths.get(testString); final File file = new File(testString); System.out.println("Files.exists(): " + Files.exists(path)); System.out.println("File exists: " + file.exists()); } } fge@alustriel:~/tmp/filenameenc$ install -D /dev/null a/üöä fge@alustriel:~/tmp/filenameenc$ java Test Files.exists(): true File exists: true fge@alustriel:~/tmp/filenameenc$ java -Dfile.encoding=iso-8859-1 Test Files.exists(): false File exists: true fge@alustriel:~/tmp/filenameenc$ One less reason to use File!
score: 5
has comment: http://stackoverflow.com/comment/34776338
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/123299404
has comment: http://stackoverflow.com/comment/34887306

http://stackoverflow.com/comment/34724009
type: QuestionComment
score: 1
has text: @njzk2 is right about `keys`. I'm working on a project now where this happens; we don't always know the keys coming back to us. To solve this, we turn the JSON into a Map, and get the keys.
comment on: http://stackoverflow.com/q/22773232
type: Comment

http://stackoverflow.com/comment/34721126
type: QuestionComment
comment on: http://stackoverflow.com/q/22773809
score: 0
has text: possible duplicate of [What is a Null Pointer Exception?](http://stackoverflow.com/questions/218384/what-is-a-null-pointer-exception)
type: Comment

http://stackoverflow.com/q/22712745
has body: im new to regexes , I have email validation program with the given conditions for a valid email @ and . should be present only once there should be five characters between @ and . there should be at least 3 characters before @ @ should always precede the . I cannot figure out the last part. Any help with a little explanation would be great :)
tagged with: regex
has title: Regex for email id validation
has comment: http://stackoverflow.com/comment/34611360
tagged with: java
downvote count: 3
has comment: http://stackoverflow.com/comment/34610742
upvote count: 1
type: Question
has comment: http://stackoverflow.com/comment/34610470
has comment: http://stackoverflow.com/comment/34610498
score: -2
has comment: http://stackoverflow.com/comment/34610479
answer count: 2
has answer: http://stackoverflow.com/a/22713301
has comment: http://stackoverflow.com/comment/34610682
favorite count: 0
has comment: http://stackoverflow.com/comment/34611131
has answer: http://stackoverflow.com/a/22712794
type: UnansweredQuestion

http://stackoverflow.com/a/22794285
has body: Take for instance i have this Oranges com.OrangesServlet oranges /oranges To call the oranges page, i will do http://localhost:8888/oranges So in your case, replace oranges with what ever your authorization url is
has comment: http://stackoverflow.com/comment/34852517
has comment: http://stackoverflow.com/comment/34806689
has comment: http://stackoverflow.com/comment/34852923
answers question: http://stackoverflow.com/q/22791863
has comment: http://stackoverflow.com/comment/34852973
has comment: http://stackoverflow.com/comment/34838137
has comment: http://stackoverflow.com/comment/34852706
score: 0
type: Answer
has comment: http://stackoverflow.com/comment/34806962

http://stackoverflow.com/comment/34541357
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/22672764
type: Comment
has text: Hibernate XML configuration file “hibernate.cfg.xml” is always put at the root of your project classpath, outside of any package. If you place this configuration file into a different directory, you may encounter the following error :"/hibernate.cfg.xml not found"

http://stackoverflow.com/comment/34770306
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/22785971
has text: @Nitish assume that i dont have permission to open and see layout xml file . .so i will not be able to see any id or event i cant guess which elements are there .

http://stackoverflow.com/comment/34651094
comment on: http://stackoverflow.com/a/22733549
type: AnswerComment
type: Comment
score: 1
has text: `ballArr[0]=...; ballArr[1]=...; ballArr[2]=...;`

http://stackoverflow.com/comment/34512851
type: QuestionComment
type: Comment
has text: @VinayakPingale `a JSON sent from a POST request` ;)
comment on: http://stackoverflow.com/q/22658330
score: 0

http://stackoverflow.com/comment/34743227
type: QuestionComment
score: 2
comment on: http://stackoverflow.com/q/22786359
has text: looool I like the title.. You are not even assuming that you might be wrong???????:)))))))))))))))
type: Comment

http://stackoverflow.com/a/22735604
type: Answer
has comment: http://stackoverflow.com/comment/34695248
has comment: http://stackoverflow.com/comment/104619623
downvote count: 0
has comment: http://stackoverflow.com/comment/34660745
has body: No. it's not "necessary", unless you want to override default column naming, or default datastore column type etc. And just putting @Column does nothing as such anyway
upvote count: 41
has comment: http://stackoverflow.com/comment/109984586
has comment: http://stackoverflow.com/comment/34652245
answers question: http://stackoverflow.com/q/22735543
has comment: http://stackoverflow.com/comment/34687989
score: 41

http://stackoverflow.com/comment/34589291
type: Comment
type: QuestionComment
has text: Do you know about regular expression aka `regex`? Might be worth looking into
comment on: http://stackoverflow.com/q/22700748
score: 1

http://stackoverflow.com/a/22743393
accepted answer of: http://stackoverflow.com/q/22743000
type: AcceptedAnswer
downvote count: 0
answers question: http://stackoverflow.com/q/22743000
type: Answer
has body: Use Integer.valueOf() as shown below return (o2 != null) ? Integer.valueOf(o1[0]).compareTo(Integer.valueOf(o2[0])) : 1; instead of return (o2 != null) ? Integer.parseInt(o1[0]).compareTo(Integer.parseInt(o2[0]) : 1; Integer.parseInt() returns primitive int not wrapper Integer class. Cannot invoke compareTo(int) on the primitive type int There are lots of ways to convert Stringinto Integer wrapper class. Try any one: Integer.valueOf(String) new Integer(String) Integer.getInteger(String)
score: 2
upvote count: 2

http://stackoverflow.com/q/22749950
type: Question
upvote count: 2
duplicate of: http://stackoverflow.com/q/10782876
has comment: http://stackoverflow.com/comment/34677497
tagged with: javac
tagged with: generics
duplicate of: http://stackoverflow.com/q/15681444
favorite count: 0
answer count: 0
linked to: http://stackoverflow.com/q/10782876
has title: eclipse compiles generic private access, javac not
type: UnansweredQuestion
score: 2
downvote count: 0
has comment: http://stackoverflow.com/comment/34677557
tagged with: java
has body: Consider the following simple class: public class Bean { private int i; public static &lt;T extends Bean&gt; void o(T t) { System.out.println(t.i); } } In Eclipse, this just compiles fine. But with javac, i got the following error: Bean.java:8: error: i has private access in Bean System.out.println(t.i); ^ Is this a bug in Eclipse compiler? And why i cannot access i in this way? If i remove generics, this compiles fine with javac, too. EDIT: It seems the problem is with m2e (maven eclipse integration). A simple eclipse project does not reproduce this problem. I use m2e 1.4
linked to: http://stackoverflow.com/q/15681444
tagged with: eclipse
has comment: http://stackoverflow.com/comment/34677672

out-of-memory
tags question: http://stackoverflow.com/q/22657144
tags question: http://stackoverflow.com/q/22806272
tags question: http://stackoverflow.com/q/22655126
tags question: http://stackoverflow.com/q/22752297
type: Tag
tags question: http://stackoverflow.com/q/22756442
tag name: out-of-memory
tags question: http://stackoverflow.com/q/22664830
tags question: http://stackoverflow.com/q/22775471
tags question: http://stackoverflow.com/q/22730078

http://stackoverflow.com/comment/34557624
type: AnswerComment
comment on: http://stackoverflow.com/a/22683340
type: Comment
score: 1
has text: You might create a Date object from a given time in milliseconds. I.e: Date date = new Date(millis); this way you'll have a date object representing Jan:01:1970 and the given hour. Using the SimpleDateFormatter you can pick up just the hour. To get it in a 24 hours format, you have just to construct the formatter using "kk" instead of "hh": H Hour in day (0-23) Number 0 k Hour in day (1-24) Number 24 K Hour in am/pm (0-11) Number 0 h Hour in am/pm (1-12) Number 12

http://stackoverflow.com/comment/34537057
has text: I think your professor is right when she says to close the ResultSet yourself. Relying on other code to do it is dangerous. How do you know that in future versions they don't change it so ResultSets are not closed automatically? Also, I would catch Throwable instead of SqlException. It will cover all possible scenarios.
type: QuestionComment
comment on: http://stackoverflow.com/q/22671697
type: Comment
score: 2

http://stackoverflow.com/q/22724412
has body: I am parsing XML and I have a question, here is my code: XMLParser parser = new XMLParser(); String xml = parser.getXmlFromUrl(URL); // getting XML from URL Document doc = parser.getDomElement(xml); // getting DOM element NodeList nl = doc.getElementsByTagName(KEY_SONG); // looping through all song nodes &lt;song&gt; for (int i = 0; i &lt; nl.getLength(); i++) { // creating new HashMap HashMap&lt;String, String&gt; map = new HashMap&lt;String, String&gt;(); Element e = (Element) nl.item(i); // adding each child node to HashMap key =&gt; value map.put(KEY_ID, parser.getValue(e, KEY_ONE)); map.put(KEY_TITLE, parser.getValue(e, KEY_TWOO)); map.put(KEY_CARATULA, parser.getValue(e, KEY_THREE)); map.put(KEY_DURACION, parser.getValue(e, KEY_FOUR)); ****====&gt; if (variable.equalsIgnoreCase(e.get){ songsList.add(map); } How can I compare variable with the value of KEY_ONE for example? Thank you
has answer: http://stackoverflow.com/a/22724494
type: UnansweredQuestion
tagged with: android
has title: Xml parsing value node with java
tagged with: java
type: Question
score: 0
tagged with: xml-parsing
answer count: 1

http://stackoverflow.com/a/22732287
has body: Ok,here's what you gotta do. Go to the bin folder where you have java installed. If you havent changed the path during installation, it should be this path: C:\Program Files\Java\jdk1.7.0_51\bin Do confirm anyway, as the version may differ &amp; so will the folder name. Copy this path, including bin.Now, -&gt;right click on My computer, go to Properties. -&gt;Select Advanced System Settings -&gt;Click on Environment Variables -&gt;Under System Variables,select path, &amp; then click on edit. -&gt;keep the previous path as it is,add a semicolon after that &amp; paste the path you copied earlier. Click ok/apply &amp; you're done.Now you can run all java commands from any directory on your computer.Once again, dont remove the existing path, you gotta add this new one to the existing one,seperate using semi-colon.
type: Answer
score: 2
upvote count: 2
downvote count: 0
answers question: http://stackoverflow.com/q/22732106

http://stackoverflow.com/q/22780355
type: UnansweredQuestion
tagged with: java
tagged with: import
type: Question
has comment: http://stackoverflow.com/comment/34732786
has comment: http://stackoverflow.com/comment/34732234
answer count: 1
score: 0
has answer: http://stackoverflow.com/a/24501279
has comment: http://stackoverflow.com/comment/34733610
has comment: http://stackoverflow.com/comment/34732333
tagged with: android
has comment: http://stackoverflow.com/comment/34734850
has title: In android app making packages are not importing
has body: when I pasted the import statements in android studio, they are not importing. I mean when I pasted just like a flash they are disappearing.

http://stackoverflow.com/comment/39800221
type: AnswerComment
type: Comment
score: 2
comment on: http://stackoverflow.com/a/22960073
has text: Unfortunately, if the background changes, the glass effect won't redraw. Otherwise, looks great.

http://stackoverflow.com/q/22687963
has answer: http://stackoverflow.com/a/22688113
favorite count: 0
has comment: http://stackoverflow.com/comment/34564897
has answer: http://stackoverflow.com/a/22688470
tagged with: static
has answer: http://stackoverflow.com/a/22688234
linked to: http://stackoverflow.com/q/2223386
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/22688165
downvote count: 0
has answer: http://stackoverflow.com/a/22688174
tagged with: java
has title: Java static function
has comment: http://stackoverflow.com/comment/34565116
type: Question
has comment: http://stackoverflow.com/comment/34565198
score: 3
answer count: 6
has body: I have some classes. class A{ static void v(){ System.out.println("A"); } } class A1 extends A{ static void v(){ System.out.println("A1"); } } class B &lt;T extends A&gt;{ void v(){ T.v(); } } Why following code outputs "A"? B b = new B&lt;A1&gt;(); b.v(); I thought that the code should output "A1" because B&lt;A1&gt;().
has answer: http://stackoverflow.com/a/22688119
has comment: http://stackoverflow.com/comment/34564940
upvote count: 3
tagged with: function

http://stackoverflow.com/comment/35682084
comment on: http://stackoverflow.com/q/22696040
score: 0
type: QuestionComment
type: Comment
has text: JDK *used* to be bundled with the Java plugin, because installing the JDK also installs a JRE. Its right there in the installation options "Public JRE".

http://stackoverflow.com/q/22768507
tagged with: java
upvote count: 1
has body: I am writing a program that reads through a .txt file of weather data, and among other things, keep count of various weather patterns for each day of the year. The .txt file has 365 lines of various values (one line of values for each day of the year). Each line houses the high temp, low temp, and Weather status (formatted as a String of six 1's and 0's, with a 1 indicating that Fog/Rain/Snow/Hail/Thunder/Tornado occurred on that day). For example, the String 011000, would indicate that both rain and snow occurred. Sample weather file looks like (line breaks for spacing): High, Low, Weather String: 45, 32.4, 100000 43.2, 35, 100001 50.2, 32.1 101101 I have completed the vast majority of the program that traces through the weather.txt file and keeps track of the yearly high and yearly low, yet am having trouble tallying the weather status for each type (6 types). I realize I don't do the best in explaining, but my goal is to keep count, for all 365 formatted String values, how many 1's for each index of the String. So in looking at the sample weather file above, my end result would be [3, 0, 1, 1, 0, 2]. In the pasted method below, I pass in a String array (I created a String array previously in the program, which houses all 365 String formatted values... [100001, 100000, 101101, ...]). In this method, I created a new tally array with 6 values. I am trying to write a loop that traces through the passed in weather array (365 values), and increases the tally array index if a 1 occurs at the said index. The final tally array would look something like [101, 31, 3, 218, 42, 101]...made up numbers for sample output. The logic is giving me a lot of trouble. Assuming I have done my bit in explaining this, can anyone offer me advice. Note - the class constant of NUMBER_OF_WEATHER_TYPES is set to 6. public static int[] getWeatherCounts(String[] weather) { int[] tally = new int[6]; for (int i = 0; i &lt; weather.length; i++) { for (int j = 0; j &lt; NUMBER_OF_WEATHER_TYPES; j++…
type: Question
has answer: http://stackoverflow.com/a/22768699
tagged with: arrays
has comment: http://stackoverflow.com/comment/34710993
has title: Using a tally array to keep counts of another array
answer count: 1
downvote count: 0
favorite count: 0
accepted answer: http://stackoverflow.com/a/22768699
type: AnsweredQuestion
score: 1

http://stackoverflow.com/q/22665316
score: 0
answer count: 1
accepted answer: http://stackoverflow.com/a/22665634
has title: How to use a generic method in Java to CRUD any table in MySQL, using Hibernate with Criteria, passing Table name and/or fields as a parameter?
has answer: http://stackoverflow.com/a/22665634
type: AnsweredQuestion
tagged with: java
tagged with: hibernate
has body: I'm using Hibernate in a Struts2 and Hibernate project and I would like to perform all the operations in the database using the criteria. The problem is I have several tables and when I want to INSERT, UPDATE, DELETE a row for example I have to create a method for every table. Is there any way to make it more generic passing the name of the table or class and/or the object I want to modify? Thanks in advance!
type: Question

http://stackoverflow.com/comment/34539507
score: 0
type: Comment
type: QuestionComment
has text: right, but you don't have quotes around your strings and so I am wondering if the whitespace is considered part of the string or not.
comment on: http://stackoverflow.com/q/22673211

http://stackoverflow.com/a/22685699
downvote count: 0
score: 1
upvote count: 1
accepted answer of: http://stackoverflow.com/q/22685351
type: AcceptedAnswer
answers question: http://stackoverflow.com/q/22685351
has body: You can not have two methods with the same signature, and the return is not part of the signature. You could accomplish what you want using an interface as parent of Animal and Person. This will return an appropiate Person or Animal depending on what you pass as arguments. The return type of the method will be the Interface. public interface Living {} And: public class Animal implements Living {} For person: public class Person implements Living {} So your method will be: public Living getEntity(Something e) { // you can return Animal or Person } You will need to cast the return of getEntity Animal myAnimal = (Animal)myClass.getEntity(...); Another alternative will be to use generics (and you will avoid the casting), and have different instances of the class returning different types. One example (you could follow different strategies): class Dynamic &lt;T extends Object&gt; { T t; T getEntity(Object e) { return t; } void setEntity(T e) { this.t = e; } } And to use it: Dynamic&lt;Animal&gt; animalStore = new Dynamic&lt;&gt;(); Dynamic&lt;Person&gt; personStore = new Dynamic&lt;&gt;(); So animalStore will return an Animal and personStore a Person.
type: Answer

http://stackoverflow.com/comment/34569193
comment on: http://stackoverflow.com/a/22668951
type: AnswerComment
score: 0
type: Comment
has text: I understand your point but if you look at the updated code above, I have placed the persist outside the for loop as you suggest and I'm still getting the same issue, with only the last value of the iteration being persisted. thanks

http://stackoverflow.com/a/22668223
answers question: http://stackoverflow.com/q/22666833
accepted answer of: http://stackoverflow.com/q/22666833
has body: I assume that parse is throwing the IllegalArgumentException. If that is the case, neither assertEquals nor verify will get executed because the exception was throw above them. The way to do verification after an exception is thrown is to put the verification in a catch block. @Test(expected = IllegalArgumentException.class) public void testRunWithLessThanTwoParameters_IllegalArgumentException() throws Exception { final String[] args = { "Less Number of parameters" }; command = spy(new GenerateSummaryReportCommand()); try{ commandLine = new PosixParser().parse(new Options(),Arrays.copyOfRange(args, 0, args.length)); }catch (Exception e){ assertEquals(0, command.run(commandLine)); verify(command, times(1)).usage(); throw e; } } Notice that I rethrow the exception to allow for the expected check.
score: 0
type: AcceptedAnswer
type: Answer

http://stackoverflow.com/q/22733881
possible better answer: http://stackoverflow.com/a/22734028
favorite count: 0
tagged with: jlabel
has answer: http://stackoverflow.com/a/22734007
has answer: http://stackoverflow.com/a/22734028
tagged with: embedded-resource
tagged with: getresource
type: AnsweredQuestion
has title: Java Swing: unable to load image using getResource
score: 1
has body: I'm trying to isolate where the problem could be when trying to add an image to the class directory. (Doing this so when I export as a runnable JAR, the image is included in the package). So I've got the strawberry.jpg file sitting in 'C:\Users\sean\workspace\myApps\src\testing' Could you advise what I'm missing? Thanks! package testing; import java.awt.*; import javax.swing.*; public class IconTest { public static void main(String[] arguments) { JFrame frame1 = new JFrame(); frame1.setTitle("Frame1"); frame1.setSize(500, 500); frame1.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); FlowLayout flo = new FlowLayout(); frame1.setLayout(flo); JLabel label1 = new JLabel(new ImageIcon( IconTest.class.getResource("strawberry.jpg"))); frame1.add(label1); frame1.setVisible(true); } }
tagged with: java
upvote count: 1
tagged with: swing
accepted answer: http://stackoverflow.com/a/22734007
type: Question
answer count: 2
downvote count: 0

http://stackoverflow.com/comment/34519154
type: AnswerComment
score: 0
type: Comment
has text: @user3291784 Actually, by the code you have posted, you are incorrect and that's exactly why your error is occurring, as this answer states. And don't be rude.
comment on: http://stackoverflow.com/a/22661288

http://stackoverflow.com/comment/34705430
has text: Multithreading is broken to only one sentence the ability to run multiple jobs at the same time. For example running a search for a file while you can still do something withing the application like renaming a file.
score: 0
comment on: http://stackoverflow.com/q/22765265
type: QuestionComment
type: Comment

identifier
tag name: identifier
type: Tag
tags question: http://stackoverflow.com/q/22691634
tags question: http://stackoverflow.com/q/22725428

http://stackoverflow.com/q/22780835
has title: What is the difference for run or main function in java class
downvote count: 0
has answer: http://stackoverflow.com/a/22781159
favorite count: 0
answer count: 5
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/34733019
has answer: http://stackoverflow.com/a/22780943
has answer: http://stackoverflow.com/a/22781276
score: 2
has answer: http://stackoverflow.com/a/22781118
upvote count: 2
tagged with: java
type: Question
has body: It is my first day to learn java, when we write a class (the very first one). Someone defines a main function someone defines a run function. Are they the same?
has answer: http://stackoverflow.com/a/22781099
has comment: http://stackoverflow.com/comment/34733102

http://stackoverflow.com/comment/34529582
comment on: http://stackoverflow.com/a/22667715
type: Comment
has text: Might as well pass a.length into the ArrayList constructor to guarantee the array will not copy.
type: AnswerComment
score: 0

http://stackoverflow.com/q/22776107
has body: I need to get at the baseUri, I'm familliar with this @Context UriInfo uriInfo; my problem is I need the baseUri in a piece of code I can't Inject into, (a sub object of an entity). I could pass uriInfo or the builder down but that doesn't seem ideal, as most of the objects have no business knowing about it. The end goal is HATEOAS URI's in my JSON responses, but I don't need it to be a JAX-RS specific solution, I figure if I can just get at the Base URI either in my jackson converters, or entities, I can create the URIBuilder from there.
type: UnansweredQuestion
tagged with: wildfly
has answer: http://stackoverflow.com/a/26661939
tagged with: java
type: Question
tagged with: jakarta-ee
has title: Is there a global base Uri factory?
score: 0
answer count: 2
has answer: http://stackoverflow.com/a/22780648
tagged with: hateoas
tagged with: jax-rs

http://stackoverflow.com/q/22707284
has title: How to wait for a certain number of rows?
tagged with: webdriver
accepted answer: http://stackoverflow.com/a/22708103
type: AnsweredQuestion
downvote count: 0
type: Question
score: 1
favorite count: 0
has body: I'm testing a webpage and some of its content is loaded with XMLHttpRequest. I need to check if my &lt;table&gt; contains 2 rows (because the page already contains 1 row when loading) after the Ajax call. My test: @Before public void setUp() throws Exception { driver = new FirefoxDriver(); driver.get("http://localhost/index.html"); driver.manage().timeouts().implicitlyWait(3, TimeUnit.SECONDS); } @Test public void testIfPartnerListPageIsPresent() { driver.findElement(By.id("123")).click(); List&lt;WebElement&gt; rawList = driver.findElement(By.id("id-213")) .findElements(By.tagName("tr")); assertTrue("More than 1 raw", rawList.size() &gt; 1); } How can I ask to Selenium to wait for other rows in my table?
has answer: http://stackoverflow.com/a/34339776
has answer: http://stackoverflow.com/a/22708103
answer count: 3
upvote count: 1
tagged with: selenium-webdriver
possible better answer: http://stackoverflow.com/a/22708179
tagged with: java
tagged with: selenium
has answer: http://stackoverflow.com/a/22708179

http://stackoverflow.com/comment/34623382
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/22719396
has text: I put a debug message in actionPerfomed and it is printing. However, I still do not hear any music from the program.
score: 0

http://stackoverflow.com/q/22723778
has answer: http://stackoverflow.com/a/22724181
tagged with: http://stackoverflow.com/tag/xml
type: UnansweredQuestion
downvote count: 0
score: 1
tagged with: java
has comment: http://stackoverflow.com/comment/34632453
tagged with: jaxb
type: Question
upvote count: 1
answer count: 1
favorite count: 0
has title: Null Pointer Exception while unmarshalling XML to Java object having @XMLElementWrapper
has body: I am using JAXB for unmarshalling XML file to Java Object. This XML contains list. e.g ... ... and Java Class have @XMLElementWrapper for items @XMLElementWrapper(name="items") @XMLElement(name="item") private List items; And I am getting null pointer exception when i try to unmarshall. java.lang.NullPointerException at sun.reflect.UnsafeFieldAccessorImpl.ensureObj(UnsafeFieldAccessorImpl.java:54) at sun.reflect.UnsafeObjectFieldAccessorImpl.get(UnsafeObjectFieldAccessorImpl.java:36) at java.lang.reflect.Field.get(Field.java:379) at com.sun.xml.bind.v2.runtime.reflect.Accessor$FieldReflection.get(Accessor.java:185) at com.sun.xml.bind.v2.runtime.reflect.Lister$CollectionLister.startPacking(Lister.java:249) at com.sun.xml.bind.v2.runtime.reflect.Lister$CollectionLister.startPacking(Lister.java:224) at com.sun.xml.bind.v2.runtime.unmarshaller.Scope.add(Scope.java:78) at com.sun.xml.bind.v2.runtime.property.ArrayERProperty$ReceiverImpl.receive(ArrayERProperty.java:150) at com.sun.xml.bind.v2.runtime.unmarshaller.UnmarshallingContext.endElement(UnmarshallingContext.java:404) at com.sun.xml.bind.v2.runtime.unmarshaller.SAXConnector.endElement(SAXConnector.java:125) at org.apache.xerces.parsers.AbstractSAXParser.endElement(Unknown Source) at org.apache.xerces.impl.XMLNSDocumentScannerImpl.scanEndElement(Unknown Source) at org.apache.xerces.impl.XMLDocumentFragmentScannerImpl$FragmentContentDispatcher.dispatch(Unknown Source) at org.apache.xerces.impl.XMLDocumentFragmentScannerImpl.scanDocument(Unknown Source) at org.apache.xerces.parsers.XML11Configuration.parse(Unknown Source) at org.apache.xerces.parsers.XML11Configuration.parse(Unknown Source) at org.apache.xerces.parsers.XMLParser.parse(Unknown Source) at org.apache.xerces.parsers.AbstractSAXParser.parse(Unknown Source) at com.sun.xml.bind.v2.runtime.unmarshaller.UnmarshallerImpl.unmarshal0(UnmarshallerImpl.java:200) at com.sun.xml.bind.v2.runtime.unmarshaller.UnmarshallerImpl.unmarshal(UnmarshallerImpl.java:173) at j…

http://stackoverflow.com/comment/34656470
has text: Yeah I've meanwhile found this myself, thanks anyway.
type: AnswerComment
comment on: http://stackoverflow.com/a/22737199
score: 0
type: Comment

http://stackoverflow.com/q/22747346
has title: Classpath error on Mac OS
type: Question
tagged with: java
has comment: http://stackoverflow.com/comment/34672636
has body: I made a Java application which runs another Java code using the java -cp "xxx.jar;xxx.jar" net.minecraft.client.main.Maincommand. The ; (or :depending on the OS) between the two JAR of the classpath is provided by the System.getProperty("path.separator") function. On Windows it works fine, but not on Mac OS. Java says it cannot find or load main class net.minecraft.client.main.Main. I checked, the JARS of the classpath are correctly spelled and existing on the hard drive at the proper path. Here is the whole command (/Library/Internet Plug-Ins/JavaAppletPlugin.plugin/Contents/Home/bin/java is the path to the Java executable) : http://pastebin.com/8V3pg07q Could you help me ? I am NOT requiring help on how to play Minecraft, it is not the official launcher (it is one I've made, which obviously doesn't work on Mac OS), so don't tell me to ask help at Minecraft Forums :P Thanks !
score: 0
answer count: 1
has comment: http://stackoverflow.com/comment/34672609
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/22747395
tagged with: macos
tagged with: classpath

http://stackoverflow.com/comment/34703537
type: Comment
has text: @jasim: ?? i didn't say not to use the DriverManager. Make your Dao a spring-managed bean.
score: 0
comment on: http://stackoverflow.com/a/22763792
type: AnswerComment

http://stackoverflow.com/a/22763466
has comment: http://stackoverflow.com/comment/34702199
score: 0
has comment: http://stackoverflow.com/comment/34702460
has body: That's because you create new instance each time: new DbDao().getJdbctemplate(); and further: new ClassPathXmlApplicationContext("appContext.xml"); It isn't an issue of Spring. It's up to your design. And I don't know how to help you as it is just correct Java code: anyway in case of public static void main(String[] args) you have to instantiate objects to get deal with them. Please, provide more info where are your doubts
answers question: http://stackoverflow.com/q/22763243
type: Answer

http://stackoverflow.com/q/22752886
has answer: http://stackoverflow.com/a/22752973
has body: Ok, so I'm trying to make a method that takes as parameter an object, and removes the element before that one if it is found in the single linked list. My problem is when I am searching for the 2nd element. It follows the if (i == 0) but doesn't work and I'm not sure why. Can you please look at my code and tell me why it's not working? main: package SingleLinkedLists; public class TestList { public static void main(String[] args) { SingleLinkedList testList = new SingleLinkedList(); testList.insertLast(1); testList.insertLast(2); testList.insertLast(3); testList.insertLast(4); testList.insertLast(5); testList.print(); System.out.println("This is what I'm taking out: " + testList.removeBefore(2)); testList.print(); } } method: public Object removeBefore(Object o) { int i = 0; if (o == null) throw new NoSuchElementException("No such element"); Node crt = head; Node prev = crt; // trying to find the element right before the parameter while(crt.next != null &amp;&amp; !o.equals(crt.next.content)) { prev = crt; crt = crt.next; i++; } if (i == 0) { prev = crt.next; crt.next = null; return crt.content; } if (crt.next == null) throw new NoSuchElementException("No such element"); // remove crt node from list prev.next = crt.next; crt.next = null; // return the removed content return crt.content; } output: &gt; run SingleLinkedLists.TestList 1 2 3 4 5 This is what I'm taking out: 1 1 &gt; output when using third element as passed parameter (3): &gt; run SingleLinkedLists.TestList 1 2 3 4 5 This is what I'm taking out: 2 1 3 4 5 &gt; Thanks
type: AnsweredQuestion
tagged with: java
type: Question
score: 0
answer count: 1
accepted answer: http://stackoverflow.com/a/22752973
tagged with: singly-linked-list
has title: Single Linked Lists: Trying to remove element before a passed type Object paramater

http://stackoverflow.com/q/22752681
has body: (Note: There are some similar problems, but I could not find an exact duplicate) Question Consider flipping a coin an arbitrary number of times. What is the probability that you obtain 2 heads before 3 tails? Code To simulate this, I set up 10000000 trials, where 0's are heads, 1's are tails, etc. ArrayList&lt;Integer&gt; listOfTosses=new ArrayList&lt;Integer&gt;(); int numTrue=0; int numTrials=0; while(numTrials&lt;10000000) { boolean record=false; boolean twoHeads=false; int counter=2; listOfTosses.add((int) Math.random()*2); listOfTosses.add((int) Math.random()*2); if(listOfTosses.get(0)==0 &amp;&amp; listOfTosses.get(1)==0) { twoHeads=true; record=true; } listOfTosses.add((int) Math.random()*2); while(record=false) { if(listOfTosses.get(counter)==0 &amp;&amp; listOfTosses.get(counter-1)==0) { twoHeads=true; record=true; } if(listOfTosses.get(counter)==1 &amp;&amp; listOfTosses.get(counter-1)==1 &amp;&amp; listOfTosses.get(counter-2)==1) { twoHeads=false; record=true; } listOfTosses.add((int) Math.random()*2); counter++; } if(twoHeads==true) { numTrue++; } record=false; twoHeads=false; listOfTosses.clear(); numTrials++; } System.out.print(numTrue/10000000.0); Issue The code compiles properly, but always gives me an answer of 1.0 (one can prove mathematically that the exact answer is 0.7).
tagged with: java
type: Question
has title: Simulating Coin Tossing To Obtain 2 Heads Before 3 Tails (Java)
tagged with: coin-flipping
score: 0
has answer: http://stackoverflow.com/a/22752817
answer count: 1
accepted answer: http://stackoverflow.com/a/22752817
type: AnsweredQuestion

http://stackoverflow.com/a/22767598
answers question: http://stackoverflow.com/q/22767439
score: 1
has comment: http://stackoverflow.com/comment/34781428
accepted answer of: http://stackoverflow.com/q/22767439
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/34781388
has comment: http://stackoverflow.com/comment/34781285
type: Answer
has comment: http://stackoverflow.com/comment/34827701
has body: Change this TableLayout tl=(TableLayout) getActivity().findViewById(R.id.mainLayout); to TableLayout tl=(TableLayout) view.findViewById(R.id.mainLayout); This is one mistake which avoids NullPointerException. And use getActivity() to initialize views. To know why read When to call activity context OR application context?
has comment: http://stackoverflow.com/comment/34781533
upvote count: 1

http://stackoverflow.com/q/22726792
has comment: http://stackoverflow.com/comment/34636671
type: Question
linked to: http://stackoverflow.com/q/953598
has body: My current project involves playing music, and I found a useful working code to play .wav sound files, but how can I speed the sound up, raise or lower the volume, and mute the sound. Is there commands or methods I have to use? Here is what I'm currently using. import java.io.*; import javax.sound.sampled.*; try { AudioInputStream stream; AudioFormat format; DataLine.Info info; Clip clip; File file1 = new File("C:\\Users\\Bryce\\Desktop\\DM Galaxy.wav"); stream = AudioSystem.getAudioInputStream(file1); format = stream.getFormat(); info = new DataLine.Info(Clip.class, format); clip = (Clip) AudioSystem.getLine(info); clip.open(stream); clip.start(); } catch (Exception e) { e.printStackTrace(); } This works great, but the only problem is, it plays it at full blast, and sounds very slow comapaired to if I just play the audio file. Any sugestions?
has comment: http://stackoverflow.com/comment/34636720
tagged with: wav
has comment: http://stackoverflow.com/comment/34637344
score: 0
tagged with: io
has title: Java playing .wav sounds though a program
type: UnansweredQuestion
tagged with: audio
answer count: 0
tagged with: java
tagged with: inputstream

http://stackoverflow.com/comment/34748439
comment on: http://stackoverflow.com/q/22785447
score: 0
has text: Ok, you have right! ;-)
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/34753422
has text: @adneal Sorry, just forgot to update that part again :/
type: Comment
comment on: http://stackoverflow.com/a/22791349
type: AnswerComment
score: 0

http://stackoverflow.com/comment/34519502
comment on: http://stackoverflow.com/q/22661757
type: QuestionComment
has text: The only thing that I can think of is that the keys don't make a proper pair. Can you test the key-pair somehow?
type: Comment
score: 1

http://stackoverflow.com/q/22659866
score: 2
type: AnsweredQuestion
upvote count: 2
tagged with: java-8
type: Question
has comment: http://stackoverflow.com/comment/34515296
has comment: http://stackoverflow.com/comment/34515241
accepted answer: http://stackoverflow.com/a/22660163
tagged with: java
answer count: 1
downvote count: 0
has title: How does Spring use Java 8 classes, yet it runs on Java 7?
has body: I recently downloaded the source code for the Spring MVC (Version 4.0.2.RELEASE) module within the Spring Framework. My intention is to run against the actual source code for the module instead of the actual .jar file. (Long story, only for testing purposes). After downloading the source code, I removed the jar file from my project, compiled and deployed to the server. When I hit one of the URLs handled by the dispatcher servlet I was presented with the error: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter#0': Invocation of init method failed; nested exception is java.lang.Error: Unresolved compilation problems: The import java.time cannot be resolved The method toZoneId() is undefined for the type TimeZone ZoneId cannot be resolved After some research and digging into the source code I realized the class mentioned in the error is part of JDK/JRE 1.8. Before removing the .jar file my project ran without issue on JDK/JRE 1.7. My question is how does Spring include classes from JDK 1.8, yet still manage to run under JDK/JRE 1.7? Why is the exception not thrown when using Spring's .jar file, but it is thrown when I provide the source (and the jar file is missing)? Full Stack Trace Mar 26, 2014 7:27:18 AM org.apache.catalina.core.StandardWrapperValve invoke SEVERE: Allocate exception for servlet dispatcher java.lang.Error: Unresolved compilation problems: The import java.time cannot be resolved The method toZoneId() is undefined for the type TimeZone ZoneId cannot be resolved at org.springframework.web.servlet.mvc.method.annotation.ServletRequestMethodArgumentResolver.&lt;init&gt;(ServletRequestMethodArgumentResolver.java:23) at org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.getDefaultArgumentResolvers(RequestMappingHandlerAdapter.java:522) at org.springframework.web.servlet.mvc.method.annotation.RequestMappingHa…
favorite count: 0
has answer: http://stackoverflow.com/a/22660163
tagged with: spring

http://stackoverflow.com/comment/34768877
has text: @user3308082 there are two answers to your question on why the .nextLine() is being skipped.
score: 0
comment on: http://stackoverflow.com/q/22800422
type: Comment
type: QuestionComment

http://stackoverflow.com/q/22727925
has comment: http://stackoverflow.com/comment/34716745
has comment: http://stackoverflow.com/comment/34643724
has comment: http://stackoverflow.com/comment/34638273
downvote count: 4
upvote count: 0
answer count: 1
has answer: http://stackoverflow.com/a/22728420
has comment: http://stackoverflow.com/comment/34638488
favorite count: 0
has comment: http://stackoverflow.com/comment/34699056
type: UnansweredQuestion
has title: How can i use multithreading?
has comment: http://stackoverflow.com/comment/34643492
has comment: http://stackoverflow.com/comment/34638513
has comment: http://stackoverflow.com/comment/34698877
has comment: http://stackoverflow.com/comment/34643486
tagged with: java
has comment: http://stackoverflow.com/comment/34638480
score: -4
tagged with: multithreading
has comment: http://stackoverflow.com/comment/34638524
has comment: http://stackoverflow.com/comment/34698903
has comment: http://stackoverflow.com/comment/34638220
type: Question
has body: Can you help me in multithreading for example how can i make this method works in two threads. /** * returns 16 bytes */ private byte[] keyStream() { nextState(); final byte[] s = new byte[16]; /* unroll */ int x = X[6] ^ X[3] &gt;&gt;&gt; 16 ^ X[1] &lt;&lt; 16; s[0] = (byte) (x &gt;&gt;&gt; 24); s[1] = (byte) (x &gt;&gt; 16); s[2] = (byte) (x &gt;&gt; 8); s[3] = (byte) x; x = X[4] ^ X[1] &gt;&gt;&gt; 16 ^ X[7] &lt;&lt; 16; s[4] = (byte) (x &gt;&gt;&gt; 24); s[5] = (byte) (x &gt;&gt; 16); s[6] = (byte) (x &gt;&gt; 8); s[7] = (byte) x; x = X[2] ^ X[7] &gt;&gt;&gt; 16 ^ X[5] &lt;&lt; 16; s[8] = (byte) (x &gt;&gt;&gt; 24); s[9] = (byte) (x &gt;&gt; 16); s[10] = (byte) (x &gt;&gt; 8); s[11] = (byte) x; x = X[0] ^ X[5] &gt;&gt;&gt; 16 ^ X[3] &lt;&lt; 16; s[12] = (byte) (x &gt;&gt;&gt; 24); s[13] = (byte) (x &gt;&gt; 16); s[14] = (byte) (x &gt;&gt; 8); s[15] = (byte) x; return s; }
has comment: http://stackoverflow.com/comment/34748175
has comment: http://stackoverflow.com/comment/34698944
has comment: http://stackoverflow.com/comment/34638263

http://stackoverflow.com/comment/34781780
has text: Is it any slower than copying the same files manually using the operating system?
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/22807933

http://stackoverflow.com/comment/34513671
type: Comment
score: 0
type: AnswerComment
has text: Depends on whether the constructor of `UiElement` throws the exception. If not, you need to manually check whether an element is/could be found and if not throw the exception yourself (as shown my the example code).
comment on: http://stackoverflow.com/a/22658659

http://stackoverflow.com/a/22738959
has comment: http://stackoverflow.com/comment/34657737
accepted answer of: http://stackoverflow.com/q/22738820
answers question: http://stackoverflow.com/q/22738820
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/34657635
type: Answer
has comment: http://stackoverflow.com/comment/34657730
score: 1
has body: The reason your program does not output anything is because you call the method toString() but you never print the output of this method. However it looks as if your linked list structure is also way off. Essentially a linked list data structure consists of a piece of data and a link to the next node in the sequence. You however have multiple other nodes linked in your node. You should try to simplify your design because a linked list is a very simple data structure but I think you have overcomplicated it.
upvote count: 1

http://stackoverflow.com/comment/34770621
type: Comment
comment on: http://stackoverflow.com/q/22801701
type: QuestionComment
has text: so you want just the min. round up? I mean if it is 15:01 you want to 15:05
score: 0

http://stackoverflow.com/a/22667521
answers question: http://stackoverflow.com/q/22666848
score: 0
has body: Use org.apache.commons.lang.StringEscapeUtils String output = org.apache.commons.lang.StringEscapeUtils.escapeJava(input)
type: Answer

http://stackoverflow.com/a/22728558
type: Answer
has body: You have to press Ctrl+z (or Ctrl+d on UNIX) to indicate that there won't be more inputs.
downvote count: 1
score: 3
upvote count: 4
has comment: http://stackoverflow.com/comment/34639516
has comment: http://stackoverflow.com/comment/34639361
answers question: http://stackoverflow.com/q/22728540

http://stackoverflow.com/comment/34691951
has text: Threads are not a solution. Your code does not run in the wrong order. Your code *always* runs in the exact order you tell it to, unless you're using threads (which you're not). So post the rest of your code (using the edit link underneath your question) so other people can see it and figure out the problem.
type: Comment
comment on: http://stackoverflow.com/q/22757897
type: QuestionComment
score: 1

http://stackoverflow.com/q/22709375
score: 0
tagged with: datatable
has comment: http://stackoverflow.com/comment/34788567
type: UnansweredQuestion
has title: primefaces dataTable not rendered with tabChangeListener
has body: I have tabView,which includes two tab, and two data table.When first tab selected,first datatable will be shown,second tab selected then second datatable will be shown. But my datatable can not see the rendered changes. Here is my xhtml; &lt;p:tabView id="tabViewKullanici" dynamic="true"&gt; &lt;p:ajax event="tabChange" listener="#{userBean.onTabChange}" update=":userForm:userDataTable,:userForm:userDataTable2"/&gt; &lt;p:tab title="#{etiketler.userinfo1}" id="userinfoList1" &gt; &lt;/p:tab&gt; &lt;p:tab title="#{etiketler.userinfo2}" id="userInfoList2"&gt; &lt;/p:tab&gt; &lt;/p:tabView&gt; &lt;p:dataTable id="userDataTable" rendered="#{userBean.tabIndex eq 1}"/&gt; &lt;p:dataTable id="userDataTable2" rendered="#{userBean.tabIndex eq 2}"/&gt; And here part of userBean.java private int tabIndex; @PostConstruct public void init() { tabIndex = 1; } public void onTabChange(TabChangeEvent event) { FacesMessage msg = new FacesMessage("Tab Changed"); System.out.println("event.getTab().getId(): " + event.getTab().getId()); System.out.println("event.getTab().getTitle(): " + event.getTab().getTitle()); if((event.getTab().getId()).equals("userinfoList1") ){ tabIndex = 1; } if((event.getTab().getId()).equals("userinfoList2") ){ tabIndex = 2; } FacesContext.getCurrentInstance().addMessage(null, msg); } public int getTabIndex() { return tabIndex; } public void setTabIndex(int tabIndex) { this.tabIndex = tabIndex; }
has comment: http://stackoverflow.com/comment/34659188
answer count: 0
tagged with: jsf
tagged with: primefaces
tagged with: java
type: Question
tagged with: tabview

http://stackoverflow.com/q/22735379
has answer: http://stackoverflow.com/a/22735410
possible better answer: http://stackoverflow.com/a/22735415
type: AnsweredQuestion
tagged with: compareto
has body: When I do Collection.sort(List), it will sort based on String's compareTo() logic,where it compares both the strings char by char. List&lt;String&gt; file1 = new ArrayList&lt;String&gt;(); file1.add("1,7,zz"); file1.add("11,2,xx"); file1.add("331,5,yy"); Collections.sort(file1); My understanding is char means it specifies the unicode value, I want to know the unicode values of char like ,(comma) etc. How can I do it? Any url contains the numeric value of these?
tagged with: java
type: Question
answer count: 2
has title: java unicode value of char
tagged with: string
has answer: http://stackoverflow.com/a/22735415
score: 0
tagged with: compare
accepted answer: http://stackoverflow.com/a/22735410
has comment: http://stackoverflow.com/comment/34651356

http://stackoverflow.com/comment/79650568
type: Comment
comment on: http://stackoverflow.com/a/27124662
has text: First Link is broken, please add a working link
score: 1
type: AnswerComment

ubuntu
tags question: http://stackoverflow.com/q/22667237
tags question: http://stackoverflow.com/q/22754443
tags question: http://stackoverflow.com/q/22717508
tags question: http://stackoverflow.com/q/22747459
tags question: http://stackoverflow.com/q/22712080
tags question: http://stackoverflow.com/q/22710518
tags question: http://stackoverflow.com/q/22795183
tag name: ubuntu
tags question: http://stackoverflow.com/q/22716228
tags question: http://stackoverflow.com/q/22762025
tags question: http://stackoverflow.com/q/22769319
type: Tag

http://stackoverflow.com/q/22721197
has body: I am not sure if what I am asking is right, but originally i had this run 5 times in the main. however i felt that a do/while loop could do the same thing. But now I cannot get the array shotsMade to change from shotsMade[0] to shotsMade[1] etc, and the shotCount to store to it. It will only store the last run of the while loop. What can I change to make those 2 items increment so the methods still calculate the data correctly import java.util.*; public class Final { public static void main(String[] args) { int myGameCounter = 1; int [] shotsMade = new int [5]; System.out.print("Enter Player's Free Throw Percentage: "); Scanner input = new Scanner(System.in); int percent = input.nextInt(); //Game do{ System.out.println("Game " + myGameCounter + ":"); Random r = new Random(); myGameCounter++; int shotCount = 0; for (int i = 0; i &lt; 10; ++i){ boolean in = tryFreeThrow(percent); if (in) { shotCount++; System.out.print("In" + " "); } else { System.out.print("Out" + " "); } } System.out.println(""); System.out.println("Free throws made: " + shotCount + " out of 10"); System.out.println(""); shotsMade[0]= shotCount;// I need shotsMade[0] to change each loop, shotsMade[1], shotsMade[2], shotsMade[3], shotsMade[4] } while (myGameCounter &lt;=5); System.out.println(""); System.out.println("Summary:"); System.out.println("Best game free throws made: " + max(shotsMade)); System.out.println("Worst game free throws made: " + min(shotsMade)); System.out.println("Total Free Throws Made: " + sum(shotsMade) + " " + "out of 50"); System.out.println("Average Free Throw Percentage: " + average(shotsMade) +"%"); } public static boolean tryFreeThrow(int percent) { Random r = new Random(); int number = r.nextInt(100); if (number &gt; percent){ return false; } return true; } public static int average (int nums[]) { int total = 0; for (int i=0; i&lt;nums.length; i++) { total = total + nums[i]; } int average = total*10 / nums.length; return average; } public static int sum(int nums[]) { in…
has answer: http://stackoverflow.com/a/22721917
score: 0
has comment: http://stackoverflow.com/comment/34626261
has comment: http://stackoverflow.com/comment/34626655
answer count: 1
has comment: http://stackoverflow.com/comment/34626889
has comment: http://stackoverflow.com/comment/34626861
type: AnsweredQuestion
tagged with: java
accepted answer: http://stackoverflow.com/a/22721917
type: Question
has title: How can I increment the Array
has comment: http://stackoverflow.com/comment/34626290
has comment: http://stackoverflow.com/comment/34626950
has comment: http://stackoverflow.com/comment/34626331

http://stackoverflow.com/comment/34709985
comment on: http://stackoverflow.com/q/22767898
score: 0
has text: What is the question?
type: QuestionComment
type: Comment

http://stackoverflow.com/comment/34728121
type: Comment
comment on: http://stackoverflow.com/a/22778050
has text: result doesn't need to be final. It needs to be *effectively* final.
score: 4
type: AnswerComment

http://stackoverflow.com/comment/34702825
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/22762763
has text: Show your code. That's the only way we'll be able to see see why your content is not being copied correctly.
score: 0

variables
tags question: http://stackoverflow.com/q/22767512
tag name: variables
tags question: http://stackoverflow.com/q/22774655
tags question: http://stackoverflow.com/q/22725253
tags question: http://stackoverflow.com/q/22708634
tags question: http://stackoverflow.com/q/22770769
tags question: http://stackoverflow.com/q/22708281
type: Tag
tags question: http://stackoverflow.com/q/22754261
tags question: http://stackoverflow.com/q/22653228
tags question: http://stackoverflow.com/q/22660991
tags question: http://stackoverflow.com/q/22729624

http://stackoverflow.com/q/22671897
score: 5
downvote count: 0
answer count: 1
favorite count: 0
tagged with: apache-httpclient-4.x
has title: HttpClient , httppost and payload
type: AnsweredQuestion
tagged with: http
type: Question
has body: I'm trying to use apache httpclient. I have a httppost query. To build my object I use the info provided by chrome developer tool. When I connect do the server I see a http post request and info under payload: 7|0|10|http://sfe.corpe15.com:8980/etrading/etrading/|0A6AA27FE80C74E3200C24AA537362BD|com.gwtplatform.dispatch.shared.DispatchService|execute| How does that translate in Java? How do I send the payload in my httppost object? Thanks!
has answer: http://stackoverflow.com/a/22795051
upvote count: 5
tagged with: java
accepted answer: http://stackoverflow.com/a/22795051

http://stackoverflow.com/comment/34572477
has text: On a side note, a keyboard usually has far more than 36 keys.
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/22691424

http://stackoverflow.com/comment/34645459
has text: How do you read the list? It looks like the last word that you read has an extra character at the end that happens to be invisible, or perhaps the last character of `"the"` is different. That's why it sorts correctly, but it does not count as `equal()` to the other `"the"` from the list.
type: Comment
type: QuestionComment
score: 0
comment on: http://stackoverflow.com/q/22731971

http://stackoverflow.com/q/22709220
has body: I've ran into a weird JTA scenarion in jboss 5.1.0.GA. I've got a service class with two methods removeEntity() and findEntityByField() - the names reflect the action. When I call removeEntity() and immediately afterwards run findEntityByField() with a field argument matching the removed entity - it is still found in db. This only happens when removeEntity() use EntityManager.remove(), if I use a delete (named) query instead it works as expected (?!). Looking at the database it is removed no matter which implementation I've used. Implementation of "problematic" removeEntity(): public void removeEntity(long id) { EntityManager entityManager = entityManagerFactory.createEntityManager(); MyEntity myEntity = entityManager.find(MyEntity.class, id); entityManager.remove(myEntity); entityManager.close(); } Implementation of working removeEntity(): @NamedQuery(name = "deleteById", query = "delete MyEntity where id = :id") public void removeEntity(long id) { EntityManager entityManager = entityManagerFactory.createEntityManager(); Query query = entityManager.createNamedQuery("deleteById"); query.setParameter("id", id); query.executeUpdate(); entityManager.close(); } Implementation of findEntityByField(): @NamedQuery(name = "findByField", query = "from MyEntity where field = :field"), public MyEntity findEntityByField(String field) { EntityManager entityManager = entityManagerFactory.createEntityManager(); Query query = entityManager.createNamedQuery("findByField"); query.setParameter("field", field); MyEntity myEntity = query.getSingleResult(); entityManager.close(); return myEntity; } Could be worth to mention that I have a unit test for this scenarion which doesn't fail. But that's not identical to the JTA case as it's transaction-type="RESOURCE_LOCAL" transaction is manually/explicitly committed. I can accept working with named queries to delete entites but I would really like to understand why this happens.
type: Question
tagged with: jboss
tagged with: jta
score: 0
answer count: 1
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/22709416
has title: JTA in jboss 5 and persist race
tagged with: java

http://stackoverflow.com/comment/34651087
type: AnswerComment
score: 0
type: Comment
comment on: http://stackoverflow.com/a/22729998
has text: As far as I know you can map request body only to one object. So I'm not quite sure this is possible. Note, however, that if needed you can use `@JsonIgnore` only for either serialization/deserialization by putting it on getter/setter respectively. Also I still believe that creating object and its relation in one request is not so RESTful. I would create another REST endpoint for saving object relation and use it.

http://stackoverflow.com/comment/34678838
has text: check MyActivity.java line 104
type: AnswerComment
comment on: http://stackoverflow.com/a/22749948
type: Comment
score: 0

http://stackoverflow.com/q/22734052
tagged with: file
has comment: http://stackoverflow.com/comment/34649315
type: Question
has comment: http://stackoverflow.com/comment/34649408
has body: Below is my JAVA Code use for extract and delete file. The problem is when I successfully extract the zip file, then when I delete it. It just won't works. Note: local = my local folder zipFile = my zip file name The zip and txt file is download by java program from ftp server I can manually delete from my explorer, except my program public static void extract(File local, String zipFile) { try { // destination folder to extract the contents String destName = local + ""; byte[] buf = new byte[1024]; ZipInputStream zis = null; ZipEntry zipentry; zis = new ZipInputStream(new FileInputStream(local + "/" + zipFile)); zipentry = zis.getNextEntry(); while (zipentry != null) { // for each entry to be extracted String entryName = zipentry.getName(); int n; FileOutputStream fos3; File newFile = new File(entryName); String directory = "/tmp/"; // to creating the parent directories if (directory == null) { if (newFile.isDirectory()){ break; } } else { new File(destName+directory).mkdirs(); } if(!zipentry.isDirectory()){ System.out.println("File to be extracted....."+ entryName); fos3 = new FileOutputStream(destName + directory + entryName); while ((n = zis.read(buf, 0, 1024)) &gt; -1){ fos3.write(buf, 0, n); } fos3.close(); } zis.closeEntry(); zipentry = zis.getNextEntry(); }// while zis.close(); } catch (Exception e) { e.printStackTrace(); } } public static void delete(File file) { // Check if file is directory/folder if(file.isDirectory()) { // Get all files in the folder File[] files=file.listFiles(); for(int i=0;i&lt;files.length;i++) { // Delete each file in the folder delete(files[i]); System.out.println("Successfully delete file --&gt; " + files[i]); } // Delete the folder file.delete(); }else { // Delete the file if it is not a folder file.delete(); System.out.println("Successfully delete file --&gt; " + file); } } public static void main(String[] args) { //extract extract(local, zipFile); File ftpClientZip = new File(local + "/" + zipFile); File ftpClientMD5 = new File…
has comment: http://stackoverflow.com/comment/34649589
has answer: http://stackoverflow.com/a/22734320
score: 0
answer count: 3
tagged with: delete-file
has comment: http://stackoverflow.com/comment/34649185
has title: Can extract file but can't delete file
has answer: http://stackoverflow.com/a/22734205
has answer: http://stackoverflow.com/a/22734304
tagged with: http://stackoverflow.com/tag/zip
type: UnansweredQuestion
linked to: http://stackoverflow.com/q/15041971
tagged with: java

http://stackoverflow.com/comment/34733989
comment on: http://stackoverflow.com/q/22781275
score: 0
type: Comment
has text: Some dependencies missing in the pom.xml. You need add those dependencies. Or you have to build something else before so that if would create those dependencies.
type: QuestionComment

x509
tags question: http://stackoverflow.com/q/22713090
tag name: x509
type: Tag

http://stackoverflow.com/q/22783712
type: AnsweredQuestion
type: Question
has answer: http://stackoverflow.com/a/22783919
tagged with: java
tagged with: http://stackoverflow.com/tag/json
possible better answer: http://stackoverflow.com/a/22783924
has answer: http://stackoverflow.com/a/22783924
score: 0
answer count: 3
has comment: http://stackoverflow.com/comment/34737959
has answer: http://stackoverflow.com/a/22784015
accepted answer: http://stackoverflow.com/a/22783919
has title: Android and json parsing
has comment: http://stackoverflow.com/comment/34738136
tagged with: android-json
linked to: http://stackoverflow.com/q/12312102
tagged with: android
has comment: http://stackoverflow.com/comment/34738426
has body: I have an android application which gets a json string. [ { "apellidos": "seguro", "edad": 2, "idninos": 1, "nombre": "antonio", "padres": "n1" }, { "apellidos": "martinez", "edad": 2, "idninos": 2, "nombre": "sebastian", "padres": "n2" }, { "apellidos": "lopez", "edad": 2, "idninos": 3, "nombre": "francisaca", "padres": "n3" }, { "apellidos": "maroto", "edad": 2, "idninos": 4, "nombre": "gregoria", "padres": "n4" }, { "apellidos": "maroto", "edad": 2, "idninos": 5, "nombre": "javier", "padres": "n4" }, { "apellidos": "ramirez", "edad": 1, "idninos": 6, "nombre": "andrea", "padres": "n5" }, { "apellidos": "leal", "edad": 1, "idninos": 7, "nombre": "jorge", "padres": "n6" }, { "apellidos": "rodriguez", "edad": 2, "idninos": 8, "nombre": "antonio", "padres": "n7" }, { "apellidos": "gomez", "edad": 2, "idninos": 9, "nombre": "jaime", "padres": "n8" }, { "apellidos": "jimenez", "edad": 2, "idninos": 10, "nombre": "nerea", "padres": "n9" }, { "apellidos": "gutierrez", "edad": 2, "idninos": 11, "nombre": "paquito", "padres": "n12" }, { "apellidos": "esteso", "edad": 2, "idninos": 12, "nombre": "tomas", "padres": "n15" } ] And I show it in this way:I show in a listview; public class MainActivity extends ListActivity { private static final String LOGTAG = "LogsAndroid"; static String id; EditText eTetx1; //contexto private Context context; //url private static String url="http://192.168.1.33:8080/WSBaby1/webresources/com.gleegoo.ws.ninos/"; //variable de json private static final String TAG_NOMBRE="nombre"; private static final String TAG_APELLIDO="apellidos"; //lista arrays desplegables ArrayList&lt;HashMap&lt;String,String&gt;&gt; jsonlist= new ArrayList&lt;HashMap&lt;String,String&gt;&gt;(); @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); //llamando la actividad new GetJSONActivity(MainActivity.this).execute(); eTetx1 = (EditText) findViewById(R.id.editText1); } @Override public bo…

http://stackoverflow.com/comment/34502263
has text: thanks that makes much more sense.... if i want to print this in the main method then its just System.out.println(mappedImage); correct?
type: Comment
comment on: http://stackoverflow.com/a/22652131
score: 0
type: AnswerComment

http://stackoverflow.com/comment/34719261
comment on: http://stackoverflow.com/a/22772829
type: Comment
has text: @user3443890 If the entries come from a map, you probably want to sort them by key. The comparasion method depends on the type of the key, but you probably want something like array2[j].getKey().compareTo(values.getKey()) > 0
score: 0
type: AnswerComment

http://stackoverflow.com/comment/34512268
type: QuestionComment
comment on: http://stackoverflow.com/q/22658111
type: Comment
score: 0
has text: You tell me...What's the whole point of generics..?

http://stackoverflow.com/comment/34584468
has text: You do realize if two groups are equal your if-else structure can fail? For example, what if group A is 5 , B is 5, and C is 3? None of those conditions will be true.
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/22698102
score: 0

http://stackoverflow.com/comment/34533539
has text: Oracle has a [built-in matching function](http://docs.oracle.com/cd/E11882_01/appdev.112/e25788/u_match.htm#CHDEAEGD) which may or may not be useful to you.
comment on: http://stackoverflow.com/q/22669799
type: Comment
type: QuestionComment
score: 1

http://stackoverflow.com/comment/34691866
score: 0
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/22756940
has text: Looks OK as far as I saw. Just note that the order is not *random*, it's just not specified. Random order would actually be a stronger guarantee.

http://stackoverflow.com/comment/34768493
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/22799081
has text: I agree with David Wallace, Enum is still the nicest way, also witching with enums is possible(before java 7) and if some color is added to use case, not much work to refactor the code.
score: 0

http://stackoverflow.com/comment/34547420
comment on: http://stackoverflow.com/q/22677699
has text: Something else is very much the issue; even the operating system often can't distinguish between a laptop and external keyboard, and a Swing app certainly doesn't. Start by printing `keyChar` and seeing what its value is. (Additionally, it would probably be better to use `switch` instead of chained `if`s here.)
type: Comment
type: QuestionComment
score: 0

http://stackoverflow.com/comment/34610470
has text: `&` in email address ?
type: Comment
comment on: http://stackoverflow.com/q/22712745
type: QuestionComment
score: 1

http://stackoverflow.com/a/22766857
answers question: http://stackoverflow.com/q/22766644
downvote count: 0
type: Answer
score: 2
has comment: http://stackoverflow.com/comment/34709499
upvote count: 2
has body: Don't use a JPanel to display an image. Instead use a JLabel with an ImageIcon. If you want extra space around the image then you use an EmptyBorder on the label.

http://stackoverflow.com/comment/34653149
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/22735677
has text: @ylabidi I've updated the question and posted the full output log. The line the error is occurring on is `obj.put("lat",tweet.getGeoLocation().getLatitude());`
score: 0

http://stackoverflow.com/comment/34580851
score: 0
has text: All I have tried is to make sure I can pull up a saved log. Pretty much just a file read. I am just looking for a way to read the log real time. We are talking about thousands of line. I am just trying to flag key words in real time. So, instead of post processing, I want to implement real time processing. I just don't know how, but I don't want to use already developed one so that i can have the potential to expand it.
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/22696039

http://stackoverflow.com/q/22735446
downvote count: 0
favorite count: 0
tagged with: nullpointerexception
has comment: http://stackoverflow.com/comment/34696769
has title: error when trying to load file information java.lang.NullPointerException
has comment: http://stackoverflow.com/comment/34693129
answer count: 0
type: UnansweredQuestion
score: 1
has comment: http://stackoverflow.com/comment/34669937
has comment: http://stackoverflow.com/comment/34693459
duplicate of: http://stackoverflow.com/q/218384
upvote count: 1
has comment: http://stackoverflow.com/comment/34671315
type: Question
has comment: http://stackoverflow.com/comment/34694593
has comment: http://stackoverflow.com/comment/34675427
linked to: http://stackoverflow.com/q/218384
has comment: http://stackoverflow.com/comment/34695655
tagged with: java
has comment: http://stackoverflow.com/comment/34690725
has comment: http://stackoverflow.com/comment/34697142
has comment: http://stackoverflow.com/comment/34680148
has comment: http://stackoverflow.com/comment/34652549
has comment: http://stackoverflow.com/comment/34695064
has comment: http://stackoverflow.com/comment/34690704
has comment: http://stackoverflow.com/comment/34696888
has comment: http://stackoverflow.com/comment/34658315
has comment: http://stackoverflow.com/comment/34680197
has body: NetBeans are sending error messages when ever i try to read the file after selecting the file from hard disk using JFileChooser the error message i get this messages but and the file are not loading in the JTable Exception in thread "AWT-EventQueue-0" java.lang.NullPointerException at AnimeAid.GuiInterface.createModel(GuiInterface.java:252) at AnimeAid.GuiInterface.access$100(GuiInterface.java:34) at AnimeAid.GuiInterface$2.actionPerformed(GuiInterface.java:144) at javax.swing.AbstractButton.fireActionPerformed(AbstractButton.java:2018) at javax.swing.AbstractButton$Handler.actionPerformed(AbstractButton.java:2341) at javax.swing.DefaultButtonModel.fireActionPerformed(DefaultButtonModel.java:402) at javax.swing.DefaultButtonModel.setPressed(DefaultButtonModel.java:259) at javax.swing.plaf.basic.BasicButtonListener.mouseReleased(BasicButtonListener.java:252) at java.awt.Component.processMouseEvent(Component.java:6505) at javax.swing.JComponent.processMouseEvent(JComponent.java:3320) at java.awt.Component.processEvent(Component.java:6270) at java.awt.Container.processEvent(Container.java:2229) at java.awt.Component.dispatchEventImpl(Component.java:4861) at java.awt.Container.dispatchEventImpl(Container.java:2287) at java.awt.Component.dispatchEvent(Component.java:4687) at java.awt.LightweightDispatcher.retargetMouseEvent(Container.java:4832) at java.awt.LightweightDispatcher.processMouseEvent(Container.java:4492) at java.awt.LightweightDispatcher.dispatchEvent(Container.java:4422) at java.awt.Container.dispatchEventImpl(Container.java:2273) at java.awt.Window.dispatchEventImpl(Window.java:2719) at java.awt.Component.dispatchEvent(Component.java:4687) at java.awt.EventQueue.dispatchEventImpl(EventQueue.java:735) at java.awt.EventQueue.access$200(EventQueue.java:103) at java.awt.EventQueue$3.run(EventQueue.java:694) at java.awt.EventQueue$3.run(EventQueue.java:692) at java.security.AccessController.doPrivileged(Native Method) at java.security.ProtectionDomain$1.doInters…

http://stackoverflow.com/comment/34739132
score: 0
has text: Try CascadeType.PERSIST
comment on: http://stackoverflow.com/q/22782734
type: Comment
type: QuestionComment

http://stackoverflow.com/q/22675605
has title: How Spring TimerFactoryBean will start timer task
has body: I want to setup timer task through spring.xml and timer should start whenever applicationContext is loaded. I am reading this tutorial from Spring: http://docs.spring.io/spring/docs/3.0.x/spring-framework-reference/html/scheduling.html But I don't find any information about how spring will start timer start executing. For example, Using Timer class we can say: new Timer(new Task).schedule() and then it will right away start executing tasks, how will that work with following configuration? public class CheckEmailAddresses extends TimerTask { private List emailAddresses; public void setEmailAddresses(List emailAddresses) { this.emailAddresses = emailAddresses; } public void run() { // iterate over all email addresses and archive them } } Spring Configuration: test@springframework.org foo@bar.com john@doe.net
tagged with: spring
type: AnsweredQuestion
tagged with: java
tagged with: timertask
type: Question
has answer: http://stackoverflow.com/a/22675688
accepted answer: http://stackoverflow.com/a/22675688
answer count: 1
score: 0
tagged with: timer

http://stackoverflow.com/comment/34760700
has text: @Pentium10: We'll see.
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/22796035

http://stackoverflow.com/q/22675542
has comment: http://stackoverflow.com/comment/34546297
type: Question
has answer: http://stackoverflow.com/a/22675618
has comment: http://stackoverflow.com/comment/34543784
upvote count: 0
answer count: 1
has title: Do-While loop with user input
favorite count: 0
type: UnansweredQuestion
score: -3
has comment: http://stackoverflow.com/comment/34547996
has body: How would I allow user input to select one of four methods that print a certain pattern using a do-while loop and no input validation is required. The user just needs to select a number from 1-4 that corresponds to each method.
tagged with: user-input
has comment: http://stackoverflow.com/comment/34545108
has comment: http://stackoverflow.com/comment/34543714
tagged with: java.util.scanner
tagged with: java
downvote count: 3

http://stackoverflow.com/comment/34723045
score: 0
type: AnswerComment
has text: Well, I wrote it myself without any help except programs I had made previously that used solely a Canvas as the display with no other GUI components involved. Now the reasoning to what I did initially: I had always used a Canvas and it had never failed me before, repaint is what is always called to "repaint" the canvas (although in retrospect I should have overridden paint), and I set ignore repaint to true because I only wanted the canvas to repaint when I told it to. Now that I removed the canvas and am painting directly to the panel and changed how I drew the currentView, it works :3
type: Comment
comment on: http://stackoverflow.com/a/22774636

http://stackoverflow.com/q/22698584
type: Question
answer count: 6
tagged with: class
has body: From a good design/practice point of view, when should we create and use custom Java exception classes instead of the ones already predefined in Java? In some applications I see almost custom exception classes created, they make an effort to always use native Java exceptions. On the other hand, there are some applications that define custom exceptions for (almost) everything.
linked to: http://stackoverflow.com/q/1546514
tagged with: api-design
has answer: http://stackoverflow.com/a/22698708
accepted answer: http://stackoverflow.com/a/22698673
has answer: http://stackoverflow.com/a/22698747
possible better answer: http://stackoverflow.com/a/22698711
favorite count: 0
score: 47
has answer: http://stackoverflow.com/a/30723974
has answer: http://stackoverflow.com/a/22698711
tagged with: exception
has title: When should we create our own Java exception classes?
has answer: http://stackoverflow.com/a/22698673
upvote count: 47
type: AnsweredQuestion
downvote count: 0
tagged with: java
has answer: http://stackoverflow.com/a/53564013

http://stackoverflow.com/q/22739281
upvote count: 1
possible better answer: http://stackoverflow.com/a/22739309
has answer: http://stackoverflow.com/a/22739598
accepted answer: http://stackoverflow.com/a/22739598
has answer: http://stackoverflow.com/a/22739579
has answer: http://stackoverflow.com/a/22739309
tagged with: code-readability
favorite count: 0
linked to: http://stackoverflow.com/q/5245600
tagged with: class-variables
has title: Java optimization: declaring class variables VS using temporary variables
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/34658289
downvote count: 0
score: 1
tagged with: java
type: Question
has body: First of all, excuse me if my english isn't perfect, but I'm not from a english speaking country (Spain), so... Well, here's the question. When creating a class, ¿is a good practice to use temporary variables all you can, or is better to declare your variables as class variables, just in order to keep things clear? I'll give you an example, using a simple class SpriteSheet. Is a very short and popular class, used almost in every 2D game out there in Java. Here is the code just as it originally was planned by the creator of the tutorial I was watching: public class SpriteSheet { private String path; private final int SIZE; public int[] spriteSheetPixels; public SpriteSheet(String path, int size) { this.path = path; SIZE = size; spriteSheetPixels = new int[SIZE * SIZE]; load(); } private final void load() { try { BufferedImage image = ImageIO.read(SpriteSheet.class .getResource(path)); int w = image.getWidth(); int h = image.getHeight(); image.getRGB(0, 0, w, h, spriteSheetPixels, 0, w); } catch (IOException e) { e.printStackTrace(); } } } Point is, he is doing just a normal class, following all Java conventions as far as I know. After having a look at it, I thought I could improve it a little bit. Here is my version of the very same class: public final class SpriteSheet { public final int[] spriteSheetPixels; public SpriteSheet(final String path, final int width, final int height) { spriteSheetPixels = new int[width * height]; load(path, width, height); } private final void load(final String path, final int width, final int height) { try { BufferedImage image = ImageIO.read(SpriteSheet.class .getResource(path)); final int w = image.getWidth(); final int h = image.getHeight(); final byte ZERO = 0; image.getRGB(ZERO, ZERO, w, h, spriteSheetPixels, ZERO, w); } catch (IOException e) { e.printStackTrace(); } } } Just in case, if you don't feel like paying too much attention, I'll try to resume what I've changed and why: - Added "final" to class declaration, as I don't thi…
has comment: http://stackoverflow.com/comment/34658548
tagged with: optimization
tagged with: temporary-objects
answer count: 3

http://stackoverflow.com/comment/137515964
comment on: http://stackoverflow.com/a/22670380
type: Comment
has text: @J.Coenen Again, you're talking about a very specific usecase and I'm saying thats ridiculous to even be in a position to have such a need (90 percent of cases). That's like saying: "If you were to be in a muddy area 40 miles away from civilization your little hatchback would not be able to move. Clearly everyone should drive massive AWD trucks or just buy a tracked vehicle." Your conclusion is faulty because it's derived from a faulty premise.
score: 0
type: AnswerComment

http://stackoverflow.com/q/22694486
has comment: http://stackoverflow.com/comment/34581618
has title: Missing IN or OUT parameter at index:: 1; nested exception is java.sql.SQLException: Missing IN or OUT parameter at index:: 1. spring jdbc
type: Question
score: 2
has body: Hi All I am using spring simple JDBC template to call oracle function the function is as below: CREATE OR REPLACE FUNCTION RADON_DBA.Dbf_Verify_Address_Wrapper(P_Addr1 VARCHAR2, P_Addr2 VARCHAR2, P_City VARCHAR2, P_State VARCHAR2, P_Zip_Code VARCHAR2, P_App_Identifier VARCHAR2) RETURN NUMBER IS BEGIN RETURN (radon_dba.Dbf_Verify_Address(radon_dba.address_t(P_Addr1,P_Addr2,P_City,P_State,P_Zip_Code,P_App_Identifier))); END; and my dao class is as below public Integer fetchVerifiedId(Address address, String vSource) { SimpleJdbcCall getVerifiedId =new SimpleJdbcCall(jdbcTemplate).withCatalogName("RADON_DBA") .withFunctionName("Dbf_Verify_Address_Wrapper").withoutProcedureColumnMetaDataAccess(); SqlParameterSource parMap =new MapSqlParameterSource().addValue("P_Addr1", address.getAddressLine1()) .addValue("P_Addr2", address.getAddressLine2()) .addValue("P_App_Identifier",vSource) .addValue("P_City",address.getCity()) .addValue("P_State",address.getState()) .addValue("P_Zip_Code",address.getZip()); Integer verified_id = getVerifiedId.executeFunction(Integer.class, parMap); return verified_id; } when i execute i get the below error Exception: CallableStatementCallback; uncategorized SQLException for SQL [{? = call RADON_DBA.DBF_VERIFY_ADDRESS_WRAPPER()}]; SQL state [99999]; error code [17041]; Missing IN or OUT parameter at index:: 1; nested exception is java.sql.SQLException: Missing IN or OUT parameter at index:: 1.
has comment: http://stackoverflow.com/comment/34580083
tagged with: java
has comment: http://stackoverflow.com/comment/34581568
has comment: http://stackoverflow.com/comment/34581482
downvote count: 0
favorite count: 0
tagged with: oracle-database
tagged with: jdbc
answer count: 0
upvote count: 2
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/34626074
has comment: http://stackoverflow.com/comment/34625136
tagged with: spring
has comment: http://stackoverflow.com/comment/117544016

http://stackoverflow.com/q/22678588
accepted answer: http://stackoverflow.com/a/22682200
answer count: 1
tagged with: jersey-2.0
has body: I'm trying to learn Java specifically in making a RESTful Web Service. I'm using Intellij IDEA 13 as IDE, GlassFish 4.0 as server and Jersey 2.7. Here is the screenshot of the project's structure: When I tried to deploy the project, it always fails with a sort of dependency injection exception. GlassFish's log : [2014-03-27T11:46:36.443+0700] [glassfish 4.0] [SEVERE] [NCLS-CORE-00026] [javax.enterprise.system.core] [tid: _ThreadID=33 _ThreadName=admin-listener(2)] [timeMillis: 1395895596443] [levelValue: 1000] [[ Exception during lifecycle processing org.glassfish.deployment.common.DeploymentException: CDI deployment failure:WELD-001408 Unsatisfied dependencies for type [IterableProvider&lt;InjectionResolver&lt;Object&gt;&gt;] with qualifiers [@Default] at injection point [[BackedAnnotatedParameter] Parameter 2 of [BackedAnnotatedConstructor] @Inject org.glassfish.jersey.internal.inject.JerseyClassAnalyzer(@Named ClassAnalyzer, IterableProvider&lt;InjectionResolver&lt;Object&gt;&gt;)] at org.glassfish.weld.WeldDeployer.event(WeldDeployer.java:225) at org.glassfish.kernel.event.EventsImpl.send(EventsImpl.java:131) at org.glassfish.internal.data.ApplicationInfo.load(ApplicationInfo.java:328) at com.sun.enterprise.v3.server.ApplicationLifecycle.deploy(ApplicationLifecycle.java:493) at com.sun.enterprise.v3.server.ApplicationLifecycle.deploy(ApplicationLifecycle.java:219) at org.glassfish.deployment.admin.DeployCommand.execute(DeployCommand.java:491) at com.sun.enterprise.v3.admin.CommandRunnerImpl$2$1.run(CommandRunnerImpl.java:527) at com.sun.enterprise.v3.admin.CommandRunnerImpl$2$1.run(CommandRunnerImpl.java:523) at java.security.AccessController.doPrivileged(Native Method) at javax.security.auth.Subject.doAs(Subject.java:356) at com.sun.enterprise.v3.admin.CommandRunnerImpl$2.execute(CommandRunnerImpl.java:522) at com.sun.enterprise.v3.admin.CommandRunnerImpl.doCommand(CommandRunnerImpl.java:546) at com.sun.enterprise.v3.admin.CommandRunnerImpl.doCommand(CommandRun…
tagged with: rest
tagged with: intellij-13
type: AnsweredQuestion
tagged with: glassfish-4
type: Question
has title: Jersey 2.7 + GlassFish 4 CDI deployment failure
tagged with: java
has answer: http://stackoverflow.com/a/22682200
score: 0

http://stackoverflow.com/a/22809637
answers question: http://stackoverflow.com/q/22787482
has body: As AsyncTasks can share a single thread I would try decoupling them by calling: my_task.executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR, (Void[])null); in place of my_task.execute((Void[])null) as described in this answer: Android SDK AsyncTask doInBackground not running (subclass) Another way would be to use Executor framework and ThreadPoolExecutor.
type: AcceptedAnswer
downvote count: 0
accepted answer of: http://stackoverflow.com/q/22787482
type: Answer
score: 1
upvote count: 1

http://stackoverflow.com/q/22750152
has comment: http://stackoverflow.com/comment/34678074
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/34678018
duplicate of: http://stackoverflow.com/q/4534146
has body: I noticed strange situation: consider these code snippets: 1 List&lt;Integer&gt; list= new ArrayList&lt;&gt;(); list.add(1); list.add(2); list.add(3); list.remove(new Integer(1)); out: [2, 3] 2 List&lt;Integer&gt; list= new ArrayList&lt;&gt;(); list.add(1); list.add(2); list.add(3); list.remove(1); System.out.println(list); out: [1, 3] After comparison of first two snippets I thought that in first case code works so thanks to integers pool but following snippet reassured me: 3 List&lt;Integer&gt; list= new ArrayList&lt;&gt;(); list.add( new Integer(12345)); list.add(2); list.add(3); list.remove(new Integer(12345)); System.out.println(list); out: [2, 3] Please explain what rules does ArrayList use to detect object or index?
score: 2
answer count: 0
downvote count: 0
has comment: http://stackoverflow.com/comment/34678330
has title: List<Integer> confuse index or object during removal
favorite count: 0
type: Question
has comment: http://stackoverflow.com/comment/34677947
has comment: http://stackoverflow.com/comment/34677854
has comment: http://stackoverflow.com/comment/34678011
upvote count: 2
linked to: http://stackoverflow.com/q/4534146
tagged with: java
tagged with: collections

http://stackoverflow.com/q/22667659
score: 0
tagged with: exception
has answer: http://stackoverflow.com/a/61395913
type: UnansweredQuestion
tagged with: itext
has comment: http://stackoverflow.com/comment/34529778
has title: iText DocumentException
tagged with: java
tagged with: document
has comment: http://stackoverflow.com/comment/34536799
type: Question
has comment: http://stackoverflow.com/comment/34536747
answer count: 1
has body: When does a DocumentException (iText) occur? I am trying to document my code and I want to add some explanation after the @throws DocumentException tag. I didn't find anything in the API.

http://stackoverflow.com/comment/34650854
type: Comment
comment on: http://stackoverflow.com/a/22734934
type: AnswerComment
has text: Thanks for the clarification. Not totally clear, but I get the idea.
score: 0

http://stackoverflow.com/q/22768689
has body: While I am trying to get a html page from server, I would like to add some config to the server (eg. login with post method). How to let the server knows that I am the same user and access the other pages? Eg. login wordpress get private page of wordpress (java coding might not needed, I think I need to know the idea.)
has title: Java browsing - section handling
type: Question
has comment: http://stackoverflow.com/comment/34844726
has comment: http://stackoverflow.com/comment/34711653
tagged with: browser
score: 0
tagged with: fetch
answer count: 1
has answer: http://stackoverflow.com/a/23594910
has comment: http://stackoverflow.com/comment/34843134
accepted answer: http://stackoverflow.com/a/23594910
type: AnsweredQuestion
tagged with: java

http://stackoverflow.com/comment/34629367
has text: @DigCamara, It's possible that `ave` is unboxed later, but there's no unboxing in the code posted. Just a lot of SQL-injection vulnerabilities.
score: 0
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/22718965

http://stackoverflow.com/q/22672109
downvote count: 0
favorite count: 0
type: UnansweredQuestion
tagged with: android
has body: I have an app I'm currently working on based on the HTC Open Sense SDK for android. However my biggest problem is keeping up with the device checker through the Google Play dev console to only allow certain devices to download the app. My biggest reason is that people will rate my app so low on the scale and say it sucks, but the problem is that they don't read the requirements - if you use an Lg G2 to try and launch an app made for an HTC ONE that requires Sense, it's going to crash. So, how would i go about building a helper class that would check the device's model via build.prop (without needing root privileges) before opening/starting the main activity, and give the user a notification if the device was incapable of launching the app, and with devices that are capable of launching it, just continue the process of opening the app?
has title: How to programmatically check build.prop to verify model
answer count: 0
upvote count: 2
type: Question
tagged with: java
tagged with: adt
tagged with: eclipse
tagged with: class
score: 2

http://stackoverflow.com/q/22780347
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/34734100
has body: Given a comparator: public int compareTo(Person p1, Person p2) { String val1 = StringUtils.isEmpty(p1.nickName) ? p1.name : p1.nickName; String val2 = StringUtils.isBlank(p2.nickName) ? p2.name : p2.nickName; return val1.compareTo(val2); } I'd like to achieve the same result with "order by" using a xpath query (or SQL2 if it's beyond xpath's capabilities). Is it possible? Given data: No. | Name | Nickname | 1 | Adam | Hornet | 2. | Adam | | 3. | Jack | Legend | Sorted data: No. | name | nickname 2. | Adam | 1. | Adam | Hornet 3. | Jack | Legend
tagged with: xpath
has answer: http://stackoverflow.com/a/22788320
upvote count: 2
tagged with: java
has title: "order by" based on a expression
has comment: http://stackoverflow.com/comment/34732346
type: Question
tagged with: jcr
answer count: 2
score: 2
downvote count: 0
has answer: http://stackoverflow.com/a/22789199
tagged with: jcr-sql2
favorite count: 0

http://stackoverflow.com/a/22781587
answers question: http://stackoverflow.com/q/22781437
score: 5
upvote count: 5
type: AcceptedAnswer
downvote count: 0
has body: The problem is that the finally block would remove any exceptions being thrown since it would issue a "normal" return. From the JLS spec: Abrupt completion of a finally clause can disrupt the transfer of control initiated by a return statement. and (more relevant in your case): Note that abrupt completion of a finally clause can disrupt the transfer of control initiated by a throw statement.
has comment: http://stackoverflow.com/comment/34734325
accepted answer of: http://stackoverflow.com/q/22781437
type: Answer

http://stackoverflow.com/a/22763775
type: Answer
upvote count: 1
score: 1
answers question: http://stackoverflow.com/q/22763692
has comment: http://stackoverflow.com/comment/34702999
has body: I think that if you need to restart the activity - then something is wrong with your design - anyway startActivity(getIntent()); finish(); this will do the trick
downvote count: 0
has comment: http://stackoverflow.com/comment/34731991
has comment: http://stackoverflow.com/comment/34702735

http://stackoverflow.com/q/22723857
has title: Android - Storing 3d models or creating them
type: AnsweredQuestion
tagged with: performance
tagged with: java
type: Question
score: 0
tagged with: 3d
answer count: 1
tagged with: android
has answer: http://stackoverflow.com/a/24749847
accepted answer: http://stackoverflow.com/a/24749847
tagged with: memory-management
has body: Which is best for Android? I have 30 3D models but there is only ever one drawn on the screen at any time. Do I: create the model and destroy the previous model every time the displayed one changes. or create all 30, store them and just reference them when I want to draw them. Note that when one model is removed another model appears and the transition must be smooth. In what context would one be better than the other?

http://stackoverflow.com/comment/34630289
has text: They do matter to the execution... I'll try to come up with a short version of it, although that will be difficult since simulating circuits is non-trivial. In the meantime, the code is available publicly, though, at https://github.com/ddickstein/BooLeX. (see the `markfree` branch)
type: Comment
comment on: http://stackoverflow.com/q/22723313
score: 0
type: QuestionComment

http://stackoverflow.com/q/22699519
has answer: http://stackoverflow.com/a/22699588
type: Question
tagged with: for-loop
has answer: http://stackoverflow.com/a/22699800
has comment: http://stackoverflow.com/comment/34592001
tagged with: while-loop
has answer: http://stackoverflow.com/a/22699549
has title: Not sure what loop to use
has answer: http://stackoverflow.com/a/22699668
has comment: http://stackoverflow.com/comment/34587423
answer count: 5
type: UnansweredQuestion
has body: Edit: Just wanted to say thank you to everyone who've helped so far! I'm new to Java and my professor recommended this site for outside help. It's been great so far. I'm going to take a few moments and work on the code and implement the suggestions I've received. Thanks! I'm trying to create a program that converts temperatures from degrees Fahrenheit to degrees Celsius, and vice-versa. If the user does not enter the correct unit, the program loops back and asks them to re-enter the unit or enter Q to quit the program. This is what I have so far: My thinking is to incorporate a loop into the default portion of my switch statement, but I'm not sure which loop to use (maybe for?) that will loop back and ask the user to re enter the unit or Q to quit. Any help is really, really appreciated! I've been stuck on this for hours! System.out.print("\tEnter 'F' (or 'f') for Fahrenheit or " + "'C' (or 'c') for Celcius: "); f_or_c = console.next(); double fahrenheit = 5*(temperature-32)/9; double celcius = (9*(temperature)/5)+32; switch (f_or_c) { case "C": case "c": System.out.println("\n\t" + temperature + " " + " degrees Celcius " + "= " + celcius + " degrees Fahrenheit."); break; case "F": case "f": System.out.println("\n\t" + temperature + " " + " degrees Fahrenheit " + "= " + fahrenheit + " degrees Celcius."); break; default: System.out.println("\n\tUnknown units -" + "\n\tCannot do calculation -" + "\n\tPlease next time enter either 'F' for Fahrenheit or 'C' Celcius"); System.out.print("\nEnter 'Q' to quit or " + "any other character to perform another temperature conversion: "); break;
score: 0
tagged with: java
tagged with: loops
has answer: http://stackoverflow.com/a/22699557

http://stackoverflow.com/q/22722971
favorite count: 0
has answer: http://stackoverflow.com/a/22723110
type: AnsweredQuestion
tagged with: maven
upvote count: 1
tagged with: gradle
type: Question
score: 1
tagged with: java
has title: Gradle setupBuild not converting maven pom.xml file
has body: I have a maven project that I'd like to convert so that it builds using Gradle. it seems that gradle isn't detecting the pom.xml file though: $ gradle -v ------------------------------------------------------------ Gradle 1.11 ------------------------------------------------------------ Build time: 2014-02-11 11:34:39 UTC Build number: none Revision: a831fa866d46cbee94e61a09af15f9dd95987421 Groovy: 1.8.6 Ant: Apache Ant(TM) version 1.9.2 compiled on July 8 2013 Ivy: 2.2.0 JVM: 1.7.0_45 (Oracle Corporation 24.45-b08) OS: Windows 7 6.1 amd64 $ ls pom.xml src target $ gradle setupBuild --info Starting Build Settings evaluated using empty settings script. Projects loaded. Root project using empty build file. Included projects: [root project 'simple-service-webapp'] Evaluating root project 'simple-service-webapp' using empty build file. All projects evaluated. FAILURE: Build failed with an exception. * What went wrong: Task 'setupBuild' not found in root project 'simple-service-webapp'. * Try: Run gradle tasks to get a list of available tasks. Run with --stacktrace option to get the stack trace. Run with --debug option to get more log output. BUILD FAILED Total time: 1.589 secs
answer count: 1
downvote count: 0
accepted answer: http://stackoverflow.com/a/22723110

http://stackoverflow.com/a/22774936
answers question: http://stackoverflow.com/q/22774806
type: Answer
has body: You can use something like this: List&lt;String&gt; list = new ArrayList&lt;String&gt;(); Since Java SE 1.7, it can a little simpler: List&lt;String&gt; list = new ArrayList&lt;&gt;();
score: 3
upvote count: 3
downvote count: 0

java-8
tags question: http://stackoverflow.com/q/22717234
tags question: http://stackoverflow.com/q/22776511
tags question: http://stackoverflow.com/q/22694884
tags question: http://stackoverflow.com/q/22715836
tags question: http://stackoverflow.com/q/22737315
tags question: http://stackoverflow.com/q/22757764
tags question: http://stackoverflow.com/q/22742974
tags question: http://stackoverflow.com/q/22662606
tags question: http://stackoverflow.com/q/22687943
tags question: http://stackoverflow.com/q/22738962
tags question: http://stackoverflow.com/q/22760259
tags question: http://stackoverflow.com/q/22753755
tags question: http://stackoverflow.com/q/22686174
tags question: http://stackoverflow.com/q/22793006
tags question: http://stackoverflow.com/q/22792509
tags question: http://stackoverflow.com/q/22661207
tags question: http://stackoverflow.com/q/22703412
tags question: http://stackoverflow.com/q/22714850
tags question: http://stackoverflow.com/q/22713652
tags question: http://stackoverflow.com/q/22723313
tags question: http://stackoverflow.com/q/22734660
tags question: http://stackoverflow.com/q/22725537
tags question: http://stackoverflow.com/q/22686586
tags question: http://stackoverflow.com/q/22777915
tags question: http://stackoverflow.com/q/22779413
tags question: http://stackoverflow.com/q/22660268
tags question: http://stackoverflow.com/q/22808485
tags question: http://stackoverflow.com/q/22649978
tags question: http://stackoverflow.com/q/22684170
tags question: http://stackoverflow.com/q/22682836
tags question: http://stackoverflow.com/q/22754660
tags question: http://stackoverflow.com/q/22703838
tags question: http://stackoverflow.com/q/22658322
tags question: http://stackoverflow.com/q/22690271
tags question: http://stackoverflow.com/q/22736122
tags question: http://stackoverflow.com/q/22721400
tags question: http://stackoverflow.com/q/22793315
tags question: http://stackoverflow.com/q/22784030
tags question: http://stackoverflow.com/q/22751657
tags question: http://stackoverflow.com/q/22773003
tags question: http://stackoverflow.com/q/22807912
tags question: http://stackoverflow.com/q/22718744
tags question: http://stackoverflow.com/q/22659866
tags question: http://stackoverflow.com/q/22743425
tags question: http://stackoverflow.com/q/22681885
tags question: http://stackoverflow.com/q/22685930
tag name: java-8
tags question: http://stackoverflow.com/q/22740464
tags question: http://stackoverflow.com/q/22663112
tags question: http://stackoverflow.com/q/22749200
tags question: http://stackoverflow.com/q/22673421
tags question: http://stackoverflow.com/q/22732039
tags question: http://stackoverflow.com/q/22746948
tags question: http://stackoverflow.com/q/22800096
tags question: http://stackoverflow.com/q/22805923
tags question: http://stackoverflow.com/q/22696040
type: Tag
tags question: http://stackoverflow.com/q/22789413
tags question: http://stackoverflow.com/q/22747036
tags question: http://stackoverflow.com/q/22803776
tags question: http://stackoverflow.com/q/22735872
tags question: http://stackoverflow.com/q/22712153
tags question: http://stackoverflow.com/q/22756850
tags question: http://stackoverflow.com/q/22737535
tags question: http://stackoverflow.com/q/22794665
tags question: http://stackoverflow.com/q/22713863
tags question: http://stackoverflow.com/q/22665150

http://stackoverflow.com/comment/34776449
score: 0
comment on: http://stackoverflow.com/q/22804909
type: QuestionComment
type: Comment
has text: Have you done a memory dump to just quickly see what Objects it is filled up with? This may help to figure out who is the culprit.

http://stackoverflow.com/comment/34663485
type: Comment
type: QuestionComment
score: 0
has text: jDBC resources like Statements must be released otherwise you'll have a resource leak and the Database will refuse further requests.
comment on: http://stackoverflow.com/q/22742016

http://stackoverflow.com/q/22746403
tagged with: jbutton
type: Question
tagged with: java
has comment: http://stackoverflow.com/comment/34670772
has title: Why is this not showing buttons in gridlayout?
score: 0
accepted answer: http://stackoverflow.com/a/22746430
tagged with: grid-layout
answer count: 1
has answer: http://stackoverflow.com/a/22746430
has body: Im trying to create the so called "15 game" , which is like a slide puzzle with 16 buttons, 15 of them with numbers 1-15 and a empty one. Clicking on a button next to the empty one will switch position with the clicked button and the empty one. BUt now I am trying to set up the gui, which is made with Swing, gridlayout and 16 buttons. BUt i cant make it to work, here is my code: package game; import java.awt.GridLayout; import javax.swing.JButton; import javax.swing.JFrame; import javax.swing.JMenuBar; import javax.swing.JPanel; public class TheGame{ public static void main(String[] args){ TheGame game = new TheGame(); } public TheGame(){ JMenuBar menubar = new JMenuBar(); JFrame frame = new JFrame("15Game"); GridLayout grid = new GridLayout(4,4,3,3); JPanel panel = new JPanel(); Cell cell1 = new Cell("1"); Cell cell2 = new Cell("2"); Cell cell3 = new Cell("3"); Cell cell4 = new Cell("4"); Cell cell5 = new Cell("5"); Cell cell6 = new Cell("6"); Cell cell7 = new Cell("7"); Cell cell8 = new Cell("8"); Cell cell9 = new Cell("9"); Cell cell10 = new Cell("10"); Cell cell11 = new Cell("11"); Cell cell12 = new Cell("12"); Cell cell13 = new Cell("13"); Cell cell14 = new Cell("14"); Cell cell15 = new Cell("15"); Cell cellEmpty = new Cell(""); panel.add(cell1); panel.add(cell2); panel.add(cell3); panel.add(cell4); panel.add(cell5); panel.add(cell6); panel.add(cell7); panel.add(cell8); panel.add(cell9); panel.add(cell10); panel.add(cell11); panel.add(cell12); panel.add(cell13); panel.add(cell14); panel.add(cell15); panel.add(cellEmpty); panel.setLayout(grid); frame.setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE); frame.pack(); frame.setVisible(true); } } And here is Cell: package game; import javax.swing.JButton; public class Cell extends JButton { //Variables public Cell(String s){ this.setText(s); } When i create this, it only pop up a small empty gui window, with no buttons at all. Why is that, and what am I doing wrong?
type: AnsweredQuestion
tagged with: jframe
tagged with: swing

http://stackoverflow.com/a/22675152
accepted answer of: http://stackoverflow.com/q/22674750
has body: I like this way String[] ss = { "100", "10", "KONG", "102.65" }; List&lt;String&gt; s = Arrays.asList(ss); Collections.sort(s, new Comparator&lt;String&gt;() { @Override public int compare(String o1, String o2) { if (isNumber(o1)) { if (isNumber(o2)) { // o1 = number // o2 = number return (Double.valueOf(o1).compareTo(Double.valueOf(o2))); } else { // o1 = number // o2 = string return -1; } } else { if (isNumber(o2)) { // o1 = string // o2 = number return 1; } else { // o1 = string // o2 = string return o1.compareTo(o2); } } } private boolean isNumber(String s) { try { Double.parseDouble(s); return true; } catch (NumberFormatException nfe) { return false; } } }); System.out.println(s); }
upvote count: 1
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/34543193
answers question: http://stackoverflow.com/q/22674750
type: Answer
has comment: http://stackoverflow.com/comment/34543156
downvote count: 0
score: 1

http://stackoverflow.com/comment/34582664
type: QuestionComment
comment on: http://stackoverflow.com/q/22696776
has text: Where are you getting a NPE?
score: 0
type: Comment

http://stackoverflow.com/q/22684455
has answer: http://stackoverflow.com/a/22684604
has body: This code works only for the class in the same package. I need to load the file from absolute path like c:/home/lpl/asm/hello.class Any one please help me do this InputStream in=ASMHelloWorld.class.getResourceAsStream("/aasm/ClassModificationDemo.class"); ClassReader classReader=new ClassReader(in);
tagged with: asmx
downvote count: 4
favorite count: 0
has title: How to load the class with full absolute path
type: Question
answer count: 2
tagged with: java
linked to: http://stackoverflow.com/q/20127017
upvote count: 0
has answer: http://stackoverflow.com/a/22684682
type: UnansweredQuestion
score: -4

http://stackoverflow.com/a/22691362
answers question: http://stackoverflow.com/q/22690261
score: 0
type: Answer
has body: You can try this simple method with a modulo approach (only valid for A-Za-z range): public static char moveUpChar(final char c, final int i) { int offset, range; if (c &gt;= 'A' &amp;&amp; c &lt;= 'Z') { offset = 'A'; range = 'Z' - 'A' + 1; } else if (c &gt;= 'a' &amp;&amp; c &lt;= 'z') { offset = 'a'; range = 'z' - 'a' + 1; } else { throw new InvalidParameterException("Invalid character: " + c); } int abs = c - offset; abs = (abs + i) % range; return (char) (abs + offset); } Test main method: public static void main(String[] args) throws Exception { System.out.println("a + 2 = " + moveUpChar('a', 2)); System.out.println("A + 2 = " + moveUpChar('A', 2)); System.out.println("J + 7 = " + moveUpChar('J', 7)); System.out.println("y + 2 = " + moveUpChar('y', 2)); System.out.println("z + 3 = " + moveUpChar('z', 3)); System.out.println("Y + 4 = " + moveUpChar('Y', 4)); System.out.println("Z + 1 = " + moveUpChar('Z', 1)); } Output: a + 2 = c A + 2 = C J + 7 = Q y + 2 = a z + 3 = c Y + 4 = C Z + 1 = A

http://stackoverflow.com/comment/34669260
has text: I have added a line to print json in case of success, try it now
type: AnswerComment
comment on: http://stackoverflow.com/a/22744805
score: 0
type: Comment

http://stackoverflow.com/q/22729649
favorite count: 0
tagged with: android
has title: android : unable to load weview in tab view
has answer: http://stackoverflow.com/a/22729666
type: AnsweredQuestion
has body: I have no idea why my WebView is unable to load in my tab view. When I write codes that web.loadUrl("http://www.naver.com"); in tab1 and excute a program, the application stop. Below are my codes. Can you help me? Thanks so much in advance! :) tab1.java public class Tab1 extends Fragment { Context mContext; public Tab1(Context context) { mContext = context; } @Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { View mainView = (View) inflater.inflate(R.layout.activity_main, container, false); WebView web = (WebView) mainView.findViewById(R.id.webview); web.loadUrl("http://www.naver.com"); <---this make program stop. return mainView; } } main.java <--part of the main source public class SectionsPagerAdapter extends FragmentPagerAdapter { Context mContext; public SectionsPagerAdapter(android.support.v4.app.FragmentManager fm) { super(fm); } @Override public android.support.v4.app.Fragment getItem(int position) { // getItem is called to instantiate the fragment for the given page. // Return a DummySectionFragment (defined as a static inner class // below) with the page number as its lone argument. switch(position) { case 0: return new Tab1(mContext); case 1: return new Tab2(mContext); case 2: return new Tab3(mContext); case 3: return new Tab4(mContext); case 4: return new Tab5(mContext); } return null; } activity_tab1.xml <?xml version="1.0" encoding="utf-8"?> <WebView android:id="@+id/webview" android:layout_width="fill_parent" android:layout_height="wrap_content" android:layout_marginLeft="10dip" android:layout_marginRight="10dip" android:focusable="false"/> AndroidManiFast.xml <?xml version="1.0" encoding="utf-8"?> <uses-sdk android:minSdkVersion="8" android:targetSdkVersion="17" /> <action android:name="android.intent.action.MAIN" /> <category android:name="android.intent.category.LAUNCHER" /> <uses-permission android:name="android.permission.INTERNET" /> stacktrace 03-29 20:08:22.588: D/dalvikvm(2575): Set h…
score: 1
tagged with: java
upvote count: 1
type: Question
accepted answer: http://stackoverflow.com/a/22729666
has comment: http://stackoverflow.com/comment/34642384
downvote count: 0
answer count: 1
has comment: http://stackoverflow.com/comment/34641437

http://stackoverflow.com/comment/34554390
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/22681703
has text: What do you mean? They have a please wait message, if they choose not no then there's nothing you can do. How does Google make people wait for their search results to return?

http://stackoverflow.com/a/22686749
downvote count: 0
score: 1
has comment: http://stackoverflow.com/comment/34565285
has body: Suppose you have unzipped it into c:\tmp\meka\, so you have c:\tmp\meka\run.bat, you can: open a shell (cmd.exe) go inside your tmp dir: cd c:\tmp\meka\' call .\run.bat' You should at least use a JRE >= 6, because the script is using the star notation in order to list the Jars: @ECHO OFF SET MEMORY=512m SET MAIN=meka.gui.explorer.Explorer java -Xmx%MEMORY% -cp ".\lib\*" %MAIN% %1
has comment: http://stackoverflow.com/comment/34565453
upvote count: 1
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/22685527
answers question: http://stackoverflow.com/q/22685527
type: Answer
has comment: http://stackoverflow.com/comment/34565174

http://stackoverflow.com/a/22675904
accepted answer of: http://stackoverflow.com/q/22675330
has body: You could do something like this, assuming you're reading from a file: Scanner s = new Scanner(new File("oldLinesFilePath")); List&lt;String&gt; oldLines = new ArrayList&lt;String&gt;(); List&lt;String&gt; newLines = new ArrayList&lt;String&gt;(); while (s.hasNext()){ oldLines.add(s.nextLine()); } s = new Scanner(new File("newLinesFilePath")); while (s.hasNext()){ newLines.add(s.nextLine()); } s.close(); for(int i = 0; i &lt; newLines.size(); i++) { if(!oldLines.contains(newLines.get(i)) { System.out.println(newLines.get(i)); } }
answers question: http://stackoverflow.com/q/22675330
score: 0
type: AcceptedAnswer
type: Answer

http://stackoverflow.com/comment/34615409
comment on: http://stackoverflow.com/q/22708911
score: 0
has text: @luksch thank you for your reply, I have tried this but the largest file I could download was 11-12 MB.
type: Comment
type: QuestionComment

http://stackoverflow.com/a/22812504
answers question: http://stackoverflow.com/q/22791246
score: 1
upvote count: 1
type: AcceptedAnswer
type: Answer
downvote count: 0
accepted answer of: http://stackoverflow.com/q/22791246
has body: This isn't exactly what I wanted, but it's close enough: PolicyMap policyMap = broker.getDestinationPolicy(); PolicyEntry policy = new PolicyEntry(); policy.setSubscriptionRecoveryPolicy( new LastImageSubscriptionRecoveryPolicy() ); ActiveMQDestination destination = (ActiveMQDestination) session.createTopic( "a.topic" ); policyMap.put( destination, policy );

http://stackoverflow.com/a/22683398
answers question: http://stackoverflow.com/q/22678032
has body: Your method of obtaining an IV value is quite broken: String initialVectorString = Helper.randomString(CHARSET_AZ_09, 16); // .... IvParameterSpec initialVector = new IvParameterSpec( (new org.apache.commons.codec.binary.Base64()).decode( initialVectorString.getBytes())); It looks like you are creating a 16 character alphanumeric string, then treating this as base64-encoded data (which it isn't) and using that result as an IV. Very odd! Instead, just use the Random class to generate random bytes. I would suggest Random is secure enough for generating a public IV value, but if you feel super paranoid you could use SecureRandom. byte[] iv = new byte[16]; random.nextBytes(iv); // where 'random' is a private static final field of // your class, with type Random
type: Answer
upvote count: 1
downvote count: 0
score: 1

http://stackoverflow.com/comment/34824177
has text: @tim_yates Added a general test case to the question, will test with a more recent Groovy version.
comment on: http://stackoverflow.com/q/22792269
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/q/22687945
has comment: http://stackoverflow.com/comment/34565506
score: -1
has comment: http://stackoverflow.com/comment/34565095
has comment: http://stackoverflow.com/comment/34564905
answer count: 3
upvote count: 0
has comment: http://stackoverflow.com/comment/34564950
has comment: http://stackoverflow.com/comment/34565358
favorite count: 0
has comment: http://stackoverflow.com/comment/34565037
has answer: http://stackoverflow.com/a/22688081
has answer: http://stackoverflow.com/a/22689461
has answer: http://stackoverflow.com/a/22688317
possible better answer: http://stackoverflow.com/a/22688317
has title: My for loop for Graphics g return a NullPointerException
downvote count: 1
type: Question
type: AnsweredQuestion
has body: Sorry for such a basic question, but I'm losing my mind here.. Here is my code: public void paint(Graphics g) { for(int i=0;i&lt;11;i++){ for(int x=0;x&lt;2100;x+=210){ for(int y=0;y&lt;2100;y+=210){ g.drawImage(img[i], x, y,200,200, null); } // g.drawImage(img2, WIDTH, WIDTH, jc); } } } That method which I used to draw multiple images to an applet caused a NullPointerException Anybody knows why? Thanks in advance :) My image: public void loadimg(File fn){ try{ // File fn = jc.getSelectedFile(); for(int i=0;i&lt;11;i++){ img[i] = ImageIO.read(fn).getSubimage(3881, 923, 673, 713); repaint(); } } catch(Exception e){ e.printStackTrace(); } } is something wrong with my code? It isn't finish yet but sub image should be splitting the image separately.. thanks Sorry for my bad english. by the way, this is my complete code package afisapplet; import java.applet.Applet; import java.awt.*; import java.awt.image.*; import java.io.*; //import java.net.URL; import javax.imageio.*; import java.awt.event.*; import javax.swing.JFileChooser; import afisapplet.Afisapplet; public class displayaplet extends Applet implements ActionListener { JFileChooser jc = new JFileChooser(); private BufferedImage img[]; //private BufferedImage img2; Button b = new Button("Scan"); Button c = new Button("View"); // Button d = new Button("Select Image"); static Afisapplet afap ; public void init() { b.addActionListener(this); c.addActionListener(this); add(b); add(c); } public void paint(Graphics g) { for(int i=0;i&lt;11;i++){ for(int x=0;x&lt;2100;x+=210){ for(int y=0;y&lt;2100;y+=210){ g.drawImage(img[i], x, y,200,200, null); } // g.drawImage(img2, WIDTH, WIDTH, jc); } } } public void scan(){ try{ afap = new Afisapplet(); } catch(Exception e){ e.printStackTrace(); } } public void loadimg(File fn){ try{ // File fn = jc.getSelectedFile(); for(int i=0;i&lt;11;i++){ img[i] = ImageIO.read(fn).getSubimage(3881, 923, 673, 713); repaint(); } } catch(Exception e){ e.printStackTrace(); } } @Override public vo…
tagged with: java
accepted answer: http://stackoverflow.com/a/22689461

http://stackoverflow.com/q/22684459
has body: I am using MySQL with Java, I have arraylist with some values, and I have MySQL table with some column. Example: Arraylist valAry = new ArrayList(); valAry.add('25'); valAry.add('28'); Table value: Existing new table may be **newtable** id val1 min_val1 max_val1 val2 min_val1 max_val1 time_stamp 1 24 9 24 27 14 35 2014-03-27 15:06:00 From that I want to check the newTable with my current arraylist and update the newtable values. id val1 min_val1 max_val1 val2 min_val1 max_val1 time_stamp 1 25 9 25 28 14 35 2014-03-27 15:07:00 Here I have listed just 2 values in arraylist, in future it may go 5 or 15 or 30, what ever it may be, like the the table columns will be auto generated. So using single query comparison update statement to update table.
tagged with: mysql
has comment: http://stackoverflow.com/comment/34559043
type: Question
has comment: http://stackoverflow.com/comment/34558860
has answer: http://stackoverflow.com/a/22687117
tagged with: java
accepted answer: http://stackoverflow.com/a/22687117
possible better answer: http://stackoverflow.com/a/22684910
score: 0
answer count: 2
has comment: http://stackoverflow.com/comment/34559298
has title: Compare arraylist value and update MySQL
tagged with: arraylist
has comment: http://stackoverflow.com/comment/34558923
has comment: http://stackoverflow.com/comment/34558989
has comment: http://stackoverflow.com/comment/34561565
has comment: http://stackoverflow.com/comment/34558994
has answer: http://stackoverflow.com/a/22684910
type: AnsweredQuestion

http://stackoverflow.com/comment/34653321
score: 0
type: Comment
comment on: http://stackoverflow.com/a/22692112
has text: Yes, Hotspot JVM already knows about the intrinsics, but they should be declared in the class library. So you'll need to either patch `rt.jar` (replace Unsafe.class) or prepend the [modified Unsafe.class](https://docs.google.com/file/d/0B7LUxTf0AV-faDBWRzE3UzVFa2M) to boot classpath using `-Xbootclasspath/p` flag.
type: AnswerComment

http://stackoverflow.com/comment/34562186
comment on: http://stackoverflow.com/q/22686297
score: 0
type: Comment
type: QuestionComment
has text: What is the nature of the byte array? Where does it come from? It would be a hit and miss (more often miss) to convert it properly to a String if it is unknown byte array.

http://stackoverflow.com/a/22729118
score: 0
has body: Both approaches are valid. Which one to use depends of your usage: If you implement an interface inside another class, you will have access to protected and private methods of the parent class. If you want to keep things separated and reuse the same implementation for this interface, creating a separate class is the way to go.
type: Answer
answers question: http://stackoverflow.com/q/22728932

http://stackoverflow.com/a/22754340
score: 0
answers question: http://stackoverflow.com/q/22753918
has body: I'm assuming you have a method named getIntArrayString inside another class. If you want to send the values of test1, the method getIntArrayString must have a parameter of test1's datatype. For example, public int getIntArrayString(int [] x) { } You should review your knowledge of methods.
type: Answer

http://stackoverflow.com/comment/117797761
type: AnswerComment
score: 0
type: Comment
comment on: http://stackoverflow.com/a/52525033
has text: I had a similar issue with @OneToOne relation and your explanation helped me to resolve it. Very nice! Thank you.

http://stackoverflow.com/a/22889015
type: AcceptedAnswer
type: Answer
has body: The original stored procedure I was using had multiple required parameters, including current_date. I was receiving the same exception which prompted me to trim down all the parameters and only use the DATE parameter at no avail. Finally I gave up and put back all the parameters back in the PL/SQL stored procedure and declared parameters in the StoredProcedure class. What the issue was, and I can't figure why, is the order in which the parameters were being declared, i.e.: PROCEDURE update_curr_date( h_id IN NUMBER, h_type IN VARCHAR2, h_pnum IN VARCHAR2, h_curr_date IN DATE, mode IN VARCHAR2 DEFAULT 'INSERT'); And had it declared in StoredProcedure: declareParameter(new SqlParameter("h_id", OracleTypes.NUMBER)); declareParameter(new SqlParameter("h_curr_date", OracleTypes.DATE)); declareParameter(new SqlParameter("h_type", OracleTypes.VARCHAR)); declareParameter(new SqlParameter("h_pnum", OracleTypes.VARCHAR)); And the query string: {call update_curr_date ( h_id =&gt; :h_id, h_type =&gt; :h_type, h_curr_date =&gt; :h_curr_date, h_pnum =&gt; :h_pnum Note: mode is dynamically appended to the end of SQL query string along side its corresponding declaration since it's an optional parameter, but that's beside the point. When I moved h_curr_date's declaration to the end of declareParameter(), it worked: declareParameter(new SqlParameter("h_id", OracleTypes.NUMBER)); declareParameter(new SqlParameter("h_type", OracleTypes.VARCHAR)); declareParameter(new SqlParameter("h_pnum", OracleTypes.VARCHAR)); declareParameter(new SqlParameter("h_curr_date", OracleTypes.DATE)); Given that I am using a named parameter to do my declaration and binding the variables, it is odd that Spring (or perhaps Oracle implementation of JDBC, but I suspect the former since mapping is done in the Spring code) doesn't work in this case when parameters are declared out of order (I've had some weird outcome with OUT parameters too).
answers question: http://stackoverflow.com/q/22789667
accepted answer of: http://stackoverflow.com/q/22789667
score: 0

http://stackoverflow.com/comment/34834414
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/22803142
score: 0
has text: possible duplicate of [scrape data from website?](http://stackoverflow.com/questions/22803854/scrape-data-from-website)

http://stackoverflow.com/comment/34501990
score: 0
has text: public void DisplayTotalCost(ArrayList<person> customers){ items item = new items(); person customer = new person(); System.out.println("Name" + "\t" + "Total Cost"); for (int i=0; i<customerlist.size(); i++){ System.out.println(customer.name + "\t"); } }
type: QuestionComment
comment on: http://stackoverflow.com/q/22651770
type: Comment

http://stackoverflow.com/q/22663107
has comment: http://stackoverflow.com/comment/34523793
downvote count: 0
favorite count: 0
has answer: http://stackoverflow.com/a/36633098
has answer: http://stackoverflow.com/a/31304833
has title: Print all key/value pairs in a Java ConcurrentHashMap
has comment: http://stackoverflow.com/comment/34523599
upvote count: 15
has answer: http://stackoverflow.com/a/35198952
accepted answer: http://stackoverflow.com/a/22663205
tagged with: concurrenthashmap
has comment: http://stackoverflow.com/comment/34524177
tagged with: collections
has answer: http://stackoverflow.com/a/22663210
type: AnsweredQuestion
tagged with: hashmap
has answer: http://stackoverflow.com/a/22663205
tagged with: java
has body: I am trying to simply print all key/value pair(s) in a ConcurrentHashMap. I found this code online that I thought would do it, but it seems to be getting information about the buckets/hashcode. Actually to be honest the output it quite strange, its possible my program is incorrect, but I first want to make sure this part is what I want to be using. for (Entry&lt;StringBuilder, Integer&gt; entry : wordCountMap.entrySet()) { String key = entry.getKey().toString(); Integer value = entry.getValue(); System.out.println("key, " + key + " value " + value); } This gives output for about 10 different keys, with counts that seem to be the sum of the number of total inserts into the map.
answer count: 6
score: 15
type: Question
has comment: http://stackoverflow.com/comment/34521057
has answer: http://stackoverflow.com/a/34893070
possible better answer: http://stackoverflow.com/a/36633098

http://stackoverflow.com/comment/34640210
type: AnswerComment
score: 0
type: Comment
comment on: http://stackoverflow.com/a/22729032
has text: i included the where clause where Patient_ID=?

http://stackoverflow.com/a/36009213
score: 1
upvote count: 1
answers question: http://stackoverflow.com/q/22789428
has body: This is happening as the bean is trying to initialize even after its initialized once. I was facing the same issue with RabbitMQ configuration in Spring TestNG testcases. Use @DirtiesContext as a class level annotation for every testcase class. This will create applicationcontext and kill it once the testcase class is run and a new applicationcontext will be created for the next testcase class. Example - @Test @ContextConfiguration(classes = { ApplicationConfig.class }) @DirtiesContext @WebAppConfiguration public class ATest extends AbstractTestNGSpringContextTests{ @BeforeSuite public void setup() throws Throwable { } @AfterSuite public void teardown() { } }
downvote count: 0
type: Answer

http://stackoverflow.com/a/22733763
has comment: http://stackoverflow.com/comment/34648692
downvote count: 1
has comment: http://stackoverflow.com/comment/34648975
has comment: http://stackoverflow.com/comment/34648931
has comment: http://stackoverflow.com/comment/34648794
has comment: http://stackoverflow.com/comment/34648949
type: Answer
has body: package com.loknath.lab; import java.util.ArrayList; import java.util.Arrays; import java.util.Scanner; public class User1 { public static void main(String[] args) { Scanner kb = new Scanner(System.in); // array containing usernames String[] name = {"zerr", "barry", "matty", "olly", "joey" }; // elements String []temp=name; Arrays.sort(temp); while (true) { System.out.println("Enter your name"); String name1 = kb.nextLine(); if (Arrays.binarySearch(temp,name1)&gt;=0) { System.out.println("you are verified you may use the lift"); break; } else { System.out.println("Not a verified user try again!"); } } System.out.println("Done"); } } output Enter your name loknath Not a verified user try again! Enter your name chiku Not a verified user try again! Enter your name zerr you are verified you may use the lift Done
upvote count: 2
has comment: http://stackoverflow.com/comment/34648633
score: 1
answers question: http://stackoverflow.com/q/22733632
has comment: http://stackoverflow.com/comment/34649360

http://stackoverflow.com/comment/35343671
type: Comment
comment on: http://stackoverflow.com/q/22766988
type: QuestionComment
has text: @flup, I'm explicitly asking for a solution that offers an expiring lock. All the other SO questions are only about distributed locks, not distributed expiring locks, the key feature I care about.
score: 0

http://stackoverflow.com/comment/34729708
has text: can you show Android.mk?
comment on: http://stackoverflow.com/q/22778599
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/q/22752240
tagged with: java
type: Question
tagged with: graphics
has body: I have an AWT Canvas within a JFrame (I know that Swing and AWT shouldn't be used simultaneously but it works well on Windows so I don't think the problem is caused by this) and using a BufferStrategy from the Canvas to draw on screen. It runs pretty smooth on Windows but when I tried to run it on Ubuntu 12.04 it became unbearably slow. Not just the rendering but JFrame is also unresponsive. When I comment out the double buffering and rendering part it's smooth again. I have an ATI graphics card which is no longer supported so I'm using the open source video drivers, but when I run another program which uses OpenGL it's not slow like Swing/AWT one. Why could this be happening? Main render: ... private void render() { bs = gamePanel.getBufferStrategy(); Graphics g = bs.getDrawGraphics(); currentState.render(g); g.dispose(); bs.show(); } ... I don't draw anything in currentstate.render() method except a black rectangle that fills the screen. edit: OK so I tracked down the real problem, it's my game loop. I'm using a while loop within a new Thread to update and render(render code provided above). If I use paint() method of Canvas it runs smoothly but then I don't have any control over my frame rate. Why is a while loop slowing down my program? Game Loop looks like this: while(running) { update(); render(); }
has title: Swing/AWT Double Buffering very slow on Linux
accepted answer: http://stackoverflow.com/a/66511510
tagged with: awt
upvote count: 3
tagged with: linux
has comment: http://stackoverflow.com/comment/34681572
has comment: http://stackoverflow.com/comment/34681629
linked to: http://stackoverflow.com/q/3256269
answer count: 1
has comment: http://stackoverflow.com/comment/34681826
has answer: http://stackoverflow.com/a/66511510
has comment: http://stackoverflow.com/comment/34681795
has comment: http://stackoverflow.com/comment/34682533
favorite count: 0
has comment: http://stackoverflow.com/comment/34681756
tagged with: swing
has comment: http://stackoverflow.com/comment/34682119
has comment: http://stackoverflow.com/comment/34689081
type: AnsweredQuestion
score: 3
downvote count: 0
has comment: http://stackoverflow.com/comment/34681767

http://stackoverflow.com/a/22698708
has body: certainly when you expect to be able to programmatically handle an exception - ie it's easy to create separate catch statements for different exception types, ie: try{ buyWidgets(); } catch(AuthenticationException ex) { promptForLogin(); } catch(InsufficientFundsException ex) { promptToRefillAccount(); } //let other types of exceptions to propagate up the call stack On whether the above constitutes inappropriate use of exception for flow control While exceptions are more CPU-expensive than if-else statements (mainly due to cost of constructing a stack trace), cost is relative and should be assessed in the context of particular use case. Not every piece of code needs to be web-scale fast and some people find reading and testing conditionals more cumbersome. For example pretty much all transaction managers implement commit-rollback-retry idioms using exceptions. (Try writing a transaction retry aspect without catching an exception) Separately, one should adhere to separation of concerns principle: not every piece of code needs to deal with every possible condition. Whether not being logged in while buying widgets is an exceptional case really depends on the app and particular place in the app code base. For example, you could have a Service with operations for logged-in users. It makes no sense for methods in that service to deal with authentication - instead these methods would expect code earlier in the call chain to ensure user is authenticated, and thus simply throw exceptions if that is not so. Thus, for those methods being not logged in IS an exceptional case.
downvote count: 1
has comment: http://stackoverflow.com/comment/34594576
type: Answer
has comment: http://stackoverflow.com/comment/34617278
answers question: http://stackoverflow.com/q/22698584
score: 7
upvote count: 8

http://stackoverflow.com/q/22756619
tagged with: arrays
downvote count: 0
has comment: http://stackoverflow.com/comment/34689580
type: AnsweredQuestion
has title: Generics in Java array
has body: To start with there are multiple posts on SO itself which explain why Generics and arrays do not mix in Java. Like Generic arrays in Java But my question is - if that is so why do I get a warning in Eclipse when I do something like the following and how to get rid of this warning message. private RotatingQueue&lt;RotatingQueueData&gt; rQueue[] = new RotatingQueue[15]; Warning: Multiple markers at this line - Type safety: The expression of type RotatingQueue[] needs unchecked conversion to conform to RotatingQueue[]
score: 1
tagged with: generics
favorite count: 0
type: Question
linked to: http://stackoverflow.com/q/1817524
has comment: http://stackoverflow.com/comment/34689687
has comment: http://stackoverflow.com/comment/34689926
linked to: http://stackoverflow.com/q/22729271
answer count: 1
has comment: http://stackoverflow.com/comment/34689707
has comment: http://stackoverflow.com/comment/34689548
tagged with: java
has answer: http://stackoverflow.com/a/22756777
upvote count: 1
accepted answer: http://stackoverflow.com/a/22756777
has comment: http://stackoverflow.com/comment/34690014
has comment: http://stackoverflow.com/comment/34689950

http://stackoverflow.com/comment/34711653
type: QuestionComment
has text: Generally you have to make your client behave like the web browser does. Save cookies that wordpress sends. Be sure that any session IDs or other relevant parameters passed via URL parameters or other means are saved and passed back to the server appropriately. Etc.
comment on: http://stackoverflow.com/q/22768689
score: 0
type: Comment

http://stackoverflow.com/a/51630263
has body: We come across these situations, in case we want to return wrapper class objects. Simple solution for this would be to return map as follow: private void parentFunction() { Map&lt;String,Integer&gt; flagsForEventRule = new HashMap&lt;&gt;(); // call the method inside which you want to set these parameters sample(flagsForEventRule); System.out.println(flagsForEventRule.get("pathsMatched")); } private void sample(Map&lt;String,Boolean&gt; flagsForEventRule) { // you can set the values in map like this flagsForEventRule.put("pathsMatched", 1); flagsForEventRule.put("shouldCreateRule", 2); }
type: Answer
downvote count: 0
score: 1
answers question: http://stackoverflow.com/q/22680262
upvote count: 1

http://stackoverflow.com/comment/75344426
type: Comment
score: 0
type: AnswerComment
has text: Haversine isn't really needed for smaller distances; a square root of sum of powers suffices. The issue is that longitude isn't linear and so must be multiplied by cos(latitude) before you multiply by deg-to-meter constans (111244m per degree).
comment on: http://stackoverflow.com/a/22683718

http://stackoverflow.com/comment/34563153
has text: http://stackoverflow.com/questions/1116123/how-do-i-calculate-someones-age-in-java
comment on: http://stackoverflow.com/q/22686816
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/34698187
comment on: http://stackoverflow.com/q/22756940
score: 0
type: Comment
type: QuestionComment
has text: @ Marko Topolnik I just forgot remove **synchronized** from method test(

http://stackoverflow.com/a/25369063
answers question: http://stackoverflow.com/q/22805368
has comment: http://stackoverflow.com/comment/121304526
type: AcceptedAnswer
downvote count: 0
has body: There is currently no workaround for using the Android client over a proxy, sorry. I've put this on the Firebase feature list and hopefully we can address it in the near future. (Answer copied from a previously posted comment)
accepted answer of: http://stackoverflow.com/q/22805368
type: Answer
upvote count: 5
score: 5

http://stackoverflow.com/comment/34624220
comment on: http://stackoverflow.com/a/22720079
score: 1
type: AnswerComment
type: Comment
has text: Tried to post the same answer, but was late for couple of seconds :) I would only add a link to the awesome explanation what is actually happening: http://youtu.be/EZAoJU-nUyI?t=15m28s

http://stackoverflow.com/comment/34670573
type: AnswerComment
type: Comment
has text: @Naruto..to be more precise I want i to be shared between t1 and t2 which work on two different instances of Calculate class.
comment on: http://stackoverflow.com/a/22746043
score: 0

http://stackoverflow.com/comment/34711350
type: Comment
type: QuestionComment
has text: while (true){} looks very suspicious... I guess this is why you are making several markers
score: 0
comment on: http://stackoverflow.com/q/22768537

http://stackoverflow.com/q/22800029
tagged with: loops
has body: I have a text file admin.dat which looks like this: blackranger|sdasdasdasd23123|1000 blueranger|sdasdasdasdwhhh22|1000 brownranger|lppsadospd123|1000 I am trying to read every line, using | as my delimiter and outputting to the console every section. Code: package testing; import java.io.File; import java.io.FileNotFoundException; import java.io.IOException; import java.util.Scanner; public class Testing { public static void main(String[] args) { Scanner filereader = null; try { filereader = new Scanner(new File("./src/testing/players.dat")); String data; while(filereader.hasNextLine()) { String foo = "abc|123|a213"; String[] bar = foo.split("|"); for (int i = 0; i &lt; 3; i++) { System.out.println(bar[i]); } } } catch (FileNotFoundException e) { System.out.println("File not found"); } catch (IOException e) { System.out.println("Error while reading file"); } finally { if (filereader != null) { filereader.close(); } } } } Expected Outcome: blackranger sdasdasdasd23123 1000 blueranger sdasdasdasdwhhh22 1000 brownranger lppsadosph123 1000 Actual Outcome: a // infinite loop b a b a b a b a b Why am I getting an infinite loop which prints a b forever?
tagged with: split
tagged with: file-io
type: AnsweredQuestion
tagged with: string
type: Question
has title: Infinite loop during file reading and String.split() not working properly
has answer: http://stackoverflow.com/a/22800057
has answer: http://stackoverflow.com/a/22800053
accepted answer: http://stackoverflow.com/a/22800053
has answer: http://stackoverflow.com/a/22800050
score: 0
tagged with: java
possible better answer: http://stackoverflow.com/a/22800057
answer count: 3

http://stackoverflow.com/q/22707631
has title: How to write new line characters into a file in Java after converting a Byte Array into a String
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/22707978
upvote count: 1
downvote count: 1
has body: I want to read a text file, convert it into a byte array, process the byte array and then write it into another file. To do so I don't want to lose any newline characters so that new lines shall also be written into the new file created in the previous step. This is what I have done so far: StringBuilder line=null; try (BufferedReader in = new BufferedReader(new FileReader(filePath))) { line = new StringBuilder(); String tempLine=null; fileSelect=true; while ((tempLine=in.readLine()) != null) { line.append(tempLine+System.lineSeparator()); } } byte[] plaintext =String.valueOf(line).getBytes("UTF-8"); // Encrypt the data byte[] encrypted = cipher.doFinal(plaintext); //String enc=new String(encrypted); try (FileOutputStream out = new FileOutputStream(fileName)) { out.write(encrypted); } Take filePath and fileName as valid identifiers in the above code snippet.
tagged with: java
has answer: http://stackoverflow.com/a/22707975
has comment: http://stackoverflow.com/comment/34601763
type: Question
tagged with: cbc-mode
answer count: 2
has comment: http://stackoverflow.com/comment/34601387
score: 0
tagged with: file-io
favorite count: 0

http://stackoverflow.com/comment/34668648
type: Comment
has text: Thank you! I am still very new to coding, I would have just posted the bit I didn't understand but I wasn't really sure of which part I was missing out on. I talked to my teacher and he showed me what looks to be a lot more like what you're showing me here... I will use these two pushes in the right direction to see if I can get it. Thank you very much! :D
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/22740068

http://stackoverflow.com/comment/34505053
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/22653440
has text: @Mukund can u see my answer

http://stackoverflow.com/comment/80791114
type: Comment
has text: I was running a spring boot ap, and not sure what went wrong after I started using lambda expressions, I changed the project settings, but after following this modules setting, It worked fine.
score: 0
comment on: http://stackoverflow.com/a/30522340
type: AnswerComment

http://stackoverflow.com/q/22648999
upvote count: 0
has title: Java JNI - native method invoked too late in main()
answer count: 1
favorite count: 0
has answer: http://stackoverflow.com/a/22649307
type: UnansweredQuestion
downvote count: 1
type: Question
has comment: http://stackoverflow.com/comment/34496996
tagged with: java-native-interface
tagged with: java
score: -1
has comment: http://stackoverflow.com/comment/34496786
has body: I'm using JNI to make my java program working with C libraries but native method is invoked too late. here's my code: public class QuadcopterClient{ static { try { System.loadLibrary("MPU6050"); System.out.println("libMPU6050.so loaded."); } catch (UnsatisfiedLinkError e) { System.err.println("Couldn't load MPU6050: " + e.toString()); } } public native void HelloWorld(); public static void main(String argv[]) { System.out.println("Trying invoke native method"); QuadcopterClient qc = new QuadcopterClient(); for (int i = 0; i &lt; 10; i++) { qc.HelloWorld(); } System.out.println("Method invoked."); Thread.sleep(2500); } then I run it pi@raspberrypi ~/local/quadcopterClient $ java -jar -Djava.library.path=. dist/quad* libMPU6050.so loaded. Trying invoke native method Method invoked. Hello worldHello worldHello worldHello worldHello worldHello worldHello worldHello worldHello worldHello world You can see the "Hello world" appears on the ending of program. QuadcopterClient class is placed in "quadcopterclient" florder: pi@raspberrypi ~/local/quadcopterClient/src $ ls AccGyroModule ClientServerModule ControlerModule MotorsModule quadcopterclient SharedLibrary Pls why? Thx

http://stackoverflow.com/q/22783078
answer count: 1
downvote count: 1
favorite count: 0
type: UnansweredQuestion
duplicate of: http://stackoverflow.com/q/910374
linked to: http://stackoverflow.com/q/910374
tagged with: java
has comment: http://stackoverflow.com/comment/34736722
type: Question
has body: Can someone explain me real world example of in which situation i can use transient modifier in Java ? I absolutely don't understand its use so far for me ? public transient int a= 55; public int a= 55;
has title: When to use transient modifier in java?
score: 0
upvote count: 1
has answer: http://stackoverflow.com/a/22783143

http://stackoverflow.com/comment/34538564
has text: I am not sure if I got it completely or at all for that matter. I am not into testing world ... so hardly understand any terms that you have used. My properties file is simply a list of few properties required to be used across web application
type: Comment
comment on: http://stackoverflow.com/a/22672738
score: 0
type: AnswerComment

http://stackoverflow.com/q/22749096
tagged with: java
tagged with: file
downvote count: 1
linked to: http://stackoverflow.com/q/21817816
has answer: http://stackoverflow.com/a/22749401
type: Question
has title: Efficient Way to Read a File Java
has comment: http://stackoverflow.com/comment/34675863
has comment: http://stackoverflow.com/comment/45023036
answer count: 1
tagged with: bufferedreader
favorite count: 0
has comment: http://stackoverflow.com/comment/34676032
type: UnansweredQuestion
has body: What is the most efficient way to read input from a file ? I have a very very large file which contains a list of words separated by a newline e.g computer science is fun really I was thinking about using a BufferedReader object however I was confused by this line in the documentation. "In general, each read request made of a Reader causes a corresponding read request to be made of the underlying character or byte stream. It is therefore advisable to wrap a BufferedReader around any Reader whose read() operations may be costly, such as FileReaders and InputStreamReaders. For example, BufferedReader in = new BufferedReader(new FileReader("foo.in")); will buffer the input from the specified file. Without buffering, each invocation of read() or readLine() could cause bytes to be read from the file, converted into characters, and then returned, which can be very inefficient. " &lt; Can some please explain this to me? On second read I starting to believe the BufferedReader is my best bet. Is there a better way?
upvote count: 2
score: 1

http://stackoverflow.com/comment/34639314
score: 0
comment on: http://stackoverflow.com/q/22728431
type: Comment
type: QuestionComment
has text: You need to edit your post with your code. Don't put it in a comment

http://stackoverflow.com/a/22663644
upvote count: 2
type: AcceptedAnswer
has body: For services, look at Settings -> Applications -> Services. and see if it is running. However, poorly designed services may run more often or perform syncing operations. So yes it is possible.
type: Answer
score: 2
downvote count: 0
answers question: http://stackoverflow.com/q/22662687
has comment: http://stackoverflow.com/comment/34523868
accepted answer of: http://stackoverflow.com/q/22662687

http://stackoverflow.com/comment/34573409
score: 1
has text: I may think of only one use of violating `equals` and `hashCode` contracts: if you want to inflict damage to your company's project (and you need to hide the error) and even after that a skilled programmer will find your bug
comment on: http://stackoverflow.com/q/22683634
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/34685702
has text: how is that repeating? Is it that onCreate() method keeps on repeating while an application is running?
score: 0
comment on: http://stackoverflow.com/a/22753759
type: Comment
type: AnswerComment

jlist
tags question: http://stackoverflow.com/q/22723413
tags question: http://stackoverflow.com/q/22773450
tags question: http://stackoverflow.com/q/22668844
tags question: http://stackoverflow.com/q/22726291
tags question: http://stackoverflow.com/q/22725141
tags question: http://stackoverflow.com/q/22743922
type: Tag
tags question: http://stackoverflow.com/q/22707787
tag name: jlist

http://stackoverflow.com/comment/34544055
has text: "It will use the first two elements of the array as the first two numbers of a Fibonacci sequence and fill the rest of the array with the rest of the sequence." - That's not quite what you've done, right?
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/22675559
score: 1

http://stackoverflow.com/a/33592215
has body: in the triggers table there is a column in the name of trigger_state . change that column for desirable record to ERROR. usually the value of column is WAITING
upvote count: 1
type: Answer
answers question: http://stackoverflow.com/q/22757396
downvote count: 0
score: 1

http://stackoverflow.com/comment/34655802
type: QuestionComment
score: 1
comment on: http://stackoverflow.com/q/22737872
has text: One way would be to host a server on your company's LAN and have your application try to connect to it. If it fails, you're not on the LAN and you can call `System.exit` or some equivalent.
type: Comment

http://stackoverflow.com/q/22675272
tagged with: while-loop
tagged with: input
has body: I'm working on a small programming assignment for my Algorithms class in JAVA. I'm trying to figure out how to implement my while loop correctly, but I'm having no luck. I have this program set up to where the method I created puts an edge on 1, to where a 1 is returned more likely than a 0 would be. I'm trying to get the while loop to run 10,000 times and have two counters, countZeros and countOnes to see how many of each showed up out of the 10,000 times. public class BiasedRandom { public static void main(String[] args) { int countZeros = 0, countOnes = 0; double value = randomNumberGen(1); // while loop here // while(value &lt; 10000) } public static double randomNumberGen(double n) { double r = Math.random(); double p = 0.6; if (r &gt; p) return 0; else return 1; } }
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/34543400
accepted answer: http://stackoverflow.com/a/22675414
type: Question
tagged with: java
tagged with: counter
score: 0
tagged with: random
answer count: 1
has title: Bias Random Generator Mini-program
has answer: http://stackoverflow.com/a/22675414

http://stackoverflow.com/comment/34653837
type: QuestionComment
type: Comment
has text: @user2825125 It makes no sense to recompile the same regex. You need to compile it only once before the loop. And if you replace the content with F_4({something}...), doesn't it mean that you have infinite loop since F_4 is always there in the string?
comment on: http://stackoverflow.com/q/22735515
score: 0

http://stackoverflow.com/q/22767274
answer count: 2
has title: Java project that uses library throws NoClassDefFoundError when using project that uses the same library
upvote count: 1
has body: I'm creating a Java library for using in other Java projects. The projects use Repast Symphony and my library does so too (so i'm afraid this error is being caused by some conflict). Everything builds fine, but when I run a the Repast simulation, it throws java.lang.NoClassDefFoundError: repast/simphony/context/Context I tried exporting my library as a jar, importing the project directly and adding the library to my project's classpath, to no avail. What can I be doing wrong? This Context class is being used in both my library and my projects. The following is a snippet of it use in two classes: // MyContextBulder.java // This file is in my project // This class is called by Repast first import repast.simphony.context.Context; import repast.simphony.dataLoader.ContextBuilder; import mylibrary.core.DF; import mylibrary.core.DF.MyContext; public class MyContextBuilder implements ContextBuilder&lt;Object&gt; { @Override public Context&lt;Object&gt; build(Context&lt;Object&gt; context) { context.setId("test"); DF.setContext((MyContext) context); // Create agent new MyAgent(); // Add the agent to the Repast context. // context.add(t); return context; } } // DF.java // This file is in my library import java.util.Collection; import java.util.HashMap; import java.util.Iterator; import org.apache.commons.collections15.Predicate; import repast.simphony.context.Context; import repast.simphony.context.ContextListener; import repast.simphony.space.projection.Projection; import repast.simphony.util.collections.IndexedIterable; import repast.simphony.valueLayer.ValueLayer; import mylibrary.Agent; /** * This static class provides the Directory Facilitator Service * and is used to send messages to agents * and to keep a directory of all agents in the application. * Agents use the static method send(ACLMessage) to send a message * to one or more agents. The ACLMessage object contains * the receiver agent and the sender (so the receiver can reply back). * * This class needs to be setu…
downvote count: 0
favorite count: 0
has answer: http://stackoverflow.com/a/22768203
tagged with: repast-simphony
type: AnsweredQuestion
score: 1
tagged with: java
type: Question
has comment: http://stackoverflow.com/comment/34709712
has answer: http://stackoverflow.com/a/22767956
accepted answer: http://stackoverflow.com/a/22767956
possible better answer: http://stackoverflow.com/a/22768203
has comment: http://stackoverflow.com/comment/34709415
tagged with: eclipse

http://stackoverflow.com/comment/34659873
type: AnswerComment
type: Comment
has text: :) im not a fan of hardcoding a date though, so I figured i would just comment and let the OP figure out a way to do the date as a variable
comment on: http://stackoverflow.com/a/22740274
score: 0

http://stackoverflow.com/comment/34675470
type: Comment
type: QuestionComment
score: 0
comment on: http://stackoverflow.com/q/22748171
has text: Yes, Tab1, Tab2 and Tab3

http://stackoverflow.com/a/22784392
type: Answer
accepted answer of: http://stackoverflow.com/q/22782521
answers question: http://stackoverflow.com/q/22782521
has body: In my case this work fine, but I "cheat" and do a false mapping: The classes: @Entity public class Comment{ private int idComment; private String text; @Embedded private User user; } public class User{ private int idUser; private String nick; } The query: List&lt;Comment&gt; comments = session.createSQLQuery("SELECT idComment, text,comment.idUser, nick FROM user,comment WHERE user.idUser=comment.idUser AND idUser=1;").addEntity(ProxyHistoria.class).list()
score: 0
type: AcceptedAnswer

http://stackoverflow.com/comment/34542421
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/22674587
score: 0
has text: The `FileIO` class can not be resolved since it is not included in your example.

http://stackoverflow.com/a/22797214
score: 0
type: AcceptedAnswer
type: Answer
has comment: http://stackoverflow.com/comment/34764571
answers question: http://stackoverflow.com/q/22797118
has body: Yes, you can do : System.gc(); and call to garbage collector explicity. And you can do a simple: var = null; and you will deallocate the memory assigned to this var. I hope this help.
has comment: http://stackoverflow.com/comment/34764695
accepted answer of: http://stackoverflow.com/q/22797118

http://stackoverflow.com/q/22755456
tagged with: jsp
score: 0
answer count: 1
has answer: http://stackoverflow.com/a/22755677
has comment: http://stackoverflow.com/comment/34688053
type: UnansweredQuestion
has body: Branch Select Branch CE IT Batch i.e if i have branch field in my jsp form so my branch firld contains 2 inputs as 1.CE & 2.IT. So when i click on CE ,so it have to show me A1,A2,....A5 & when i click on IT, it will have to show B1...B5 from which we can select any one of the field. So, pls help me for above program. Here is my code. Pls help me what code should i write in "Batch" field""
tagged with: java
has title: how can i make field dependent to another field in jsp?
type: Question

http://stackoverflow.com/q/22776564
has title: Image not displayed when inserting and fetching from sql database using java
has body: This is the code to submit and retrieve the images from database, but the images are neither visible in database, nor in the jpg files (when I am fetching them). Can anybody tell me what the error is? public void actionPerformed(ActionEvent ae) { String sw = ""; if(ae.getSource() == b1) { JFileChooser fileChooser = new JFileChooser(); fileChooser.setFileSelectionMode(JFileChooser.FILES_ONLY); fileChooser.showOpenDialog(null); File selectedFile = fileChooser.getSelectedFile(); try { // Insert image Class.forName("com.mysql.jdbc.Driver"); Connection conn = DriverManager.getConnection("jdbc:mysql://localhost:3306/test1","root","kanishkag"); String INSERT_PICTURE = "insert into image values (?)"; conn.setAutoCommit(false); FileInputStream fis = new FileInputStream(selectedFile); byte blob[] = new byte[(byte)selectedFile.length()]; fis.read(blob); PreparedStatement ps = conn.prepareStatement(INSERT_PICTURE); ps.setBinaryStream(1, (InputStream)fis, (int) selectedFile.length()); ps.executeUpdate(); conn.commit(); ps.close(); fis.close(); conn.close(); } catch(Exception e) { System.out.println(""+e); } } else { try{ // Retrieve image Class.forName("com.mysql.jdbc.Driver"); Connection conn = DriverManager.getConnection("jdbc:mysql://localhost:3306/test1","root","kanishkag"); Statement smt = conn.createStatement(); ResultSet rs = smt.executeQuery("select pictures from image "); int i = 0; while(rs.next()) { OutputStream os = null; InputStream is = null; System.out.println("hiiiii"); BufferedImage bi = new BufferedImage(800,600, BufferedImage.TYPE_INT_RGB); is = rs.getBinaryStream(1); ImageInputStream iis = ImageIO.createImageInputStream(is); os = new FileOutputStream(new File("test1"+i+".jpg")); ImageOutputStream oss = ImageIO.createImageOutputStream(os); i++; int c = 0; while((c=iis.read())&gt; -1) { os.write(c); } ImageIO.write(bi, "test1"+i+".jpg", oss); os.close(); is.close(); } } catch(Exception e1) { e1.printStackTrace(); } } }
has comment: http://stackoverflow.com/comment/34725688
has comment: http://stackoverflow.com/comment/34725818
has comment: http://stackoverflow.com/comment/34725867
type: UnansweredQuestion
tagged with: jdbc
answer count: 0
score: 0
tagged with: mysql
has comment: http://stackoverflow.com/comment/34725650
type: Question
tagged with: java
tagged with: image
has comment: http://stackoverflow.com/comment/34725475
has comment: http://stackoverflow.com/comment/34725852

http://stackoverflow.com/q/22696402
has body: I have a table in which I use a JCombobox as an editor for the first column. I want the user to be able to start typing directly when the cursor reaches this column in order to search in the JComboBox without having to first press enter or space. To do that I override the changeSelection method when defining the table: public void changeSelection(int row, int column, boolean toggle, boolean extend) { super.changeSelection(row, column, toggle, extend); if (editCellAt(row, column)) { Component editor = getEditorComponent(); editor.requestFocusInWindow(); } } This works for the first column. However, I do not want the same thing to apply for the other columns, which are not JComboBoxes. I just want this overridden method to apply to the first column. I tried inserting a (if column == 0) in the method but that didn't work. Can someone please help me. Thanks.
answer count: 1
tagged with: jcombobox
favorite count: 0
type: UnansweredQuestion
tagged with: tablecelleditor
has comment: http://stackoverflow.com/comment/34602421
tagged with: swing
downvote count: 0
has answer: http://stackoverflow.com/a/22698769
score: 1
tagged with: java
type: Question
has comment: http://stackoverflow.com/comment/34607676
tagged with: jtable
has title: How to search in a JComboBox in a table directly
upvote count: 1

http://stackoverflow.com/a/22759633
upvote count: 2
type: AcceptedAnswer
downvote count: 0
type: Answer
accepted answer of: http://stackoverflow.com/q/22754720
score: 2
answers question: http://stackoverflow.com/q/22754720
has body: What is the problem? I'm so glad you asked that question. It's not just a matter of getting a Swing application to work. You must get the Swing application to work correctly so that you can add more functionality to your Swing application without your Swing application breaking. I added a call to SwingUtilities invokeLater in the main method. This call ensures that the Swing components are defined and used on the Event Dispatch thread (EDT). I changed the name of your class to MainPage to conform to Java standards for naming classes. I implemented Runnable to make the invokeLater method parameter easier to define. I removed the extends of JPanel. You use Swing components. The only reason to extend a Swing component is when you want to override one of the component methods. The only reason you extend any Java class is when you want to override one of the class methods. I changed the name of your MainPage method to run. I set a layout (FlowLayout) for your JPanel. You must always use a layout manager for your Swing components. I made button1 lowercase. Java field names are lowercase, so you can easily differentiate them from class names. I added a call to the JFrame setDefaultCloseOperation to your run method. Without this call, your Swing application will not stop executing when you close the window. After a while, you'll have dozens of copies of your Swing application running, with no easy way to stop them. I added a call to the JFrame pack to let the JFrame expand or contract to fit the components, rather than be a fixed size. Here's the revised code. I put the main method in the MainPage class to make it easier to paste the code. package com.ggl.testing; import java.awt.Color; import java.awt.FlowLayout; import javax.swing.JButton; import javax.swing.JFrame; import javax.swing.JPanel; import javax.swing.SwingUtilities; public class MainPage implements Runnable { @Override public void run() { JPanel panel1 = new JPanel(); panel1.setBackground(Color.pink); panel1.se…

http://stackoverflow.com/comment/34718811
type: AnswerComment
comment on: http://stackoverflow.com/a/22769948
type: Comment
has text: yes, it helped. I was unaware of that concept. Initially i could not create a Class named 'package-info' due to incorrect Java type. Then understood that it cannot create a main class with that, hence created a file with .java extension and copied the contents as you mentioned in your blog. I was confused because you mentioned in blog that "create a class called package-info in the desired package", and not "create a file called package-info.java in the desired package ".
score: 0

http://stackoverflow.com/comment/34772791
score: 0
type: AnswerComment
type: Comment
has text: no, it didnt solve the problem.. same thing happeening.
comment on: http://stackoverflow.com/a/22802968

http://stackoverflow.com/comment/34526326
type: QuestionComment
has text: have you thought about mocking the dependency?
score: 0
comment on: http://stackoverflow.com/q/22664272
type: Comment

http://stackoverflow.com/a/22745324
type: Answer
has body: Try to use Letter.matches(".*0c.*");
answers question: http://stackoverflow.com/q/22745081
score: 0

search
tags question: http://stackoverflow.com/q/22777159
tags question: http://stackoverflow.com/q/22755783
tags question: http://stackoverflow.com/q/22657720
tags question: http://stackoverflow.com/q/22697227
tags question: http://stackoverflow.com/q/22747748
tags question: http://stackoverflow.com/q/22734553
tags question: http://stackoverflow.com/q/22790196
tags question: http://stackoverflow.com/q/22752363
type: Tag
tags question: http://stackoverflow.com/q/22693197
tags question: http://stackoverflow.com/q/22710363
tags question: http://stackoverflow.com/q/22804001
tags question: http://stackoverflow.com/q/22751383
tags question: http://stackoverflow.com/q/22759077
tags question: http://stackoverflow.com/q/22662076
tag name: search
tags question: http://stackoverflow.com/q/22720995
tags question: http://stackoverflow.com/q/22767742

http://stackoverflow.com/comment/34681447
comment on: http://stackoverflow.com/q/22752192
type: Comment
type: QuestionComment
has text: Recompile your classes and rebuild your project.
score: 1

http://stackoverflow.com/q/22652176
type: AnsweredQuestion
tagged with: java
type: Question
accepted answer: http://stackoverflow.com/a/22658251
tagged with: svn
tagged with: eclipse
has title: Checkout maven project from SCM: disconnect and merge
has body: Whenever checking out Maven project from svn server in Eclipse, it creates a new folder like maven.xxxxxxxxxxxx under the target workspace. After specific time, it disconnected from SVN server. My question is when the new checkout process is started again:- Can the next checking-out process merge to one of the existing folder maven.xxxxxxxxxxxx? Any input would be appreciated!!
score: 0
answer count: 1
has answer: http://stackoverflow.com/a/22658251
tagged with: maven

http://stackoverflow.com/comment/34573571
type: QuestionComment
score: 0
comment on: http://stackoverflow.com/q/22692300
has text: http://docs.oracle.com/javase/tutorial/java/nutsandbolts/op2.html - it's a *ternary* operator.
type: Comment

http://stackoverflow.com/comment/34535438
has text: @Yoda I can't think of any reason to leave it there, especially when you're just inheriting from `Object`.
score: 0
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/22670956

http://stackoverflow.com/comment/34571452
comment on: http://stackoverflow.com/a/22691388
score: 0
type: AnswerComment
type: Comment
has text: Is there some more flexible way to define the location of rectangle? For instance, based on pixels?

http://stackoverflow.com/comment/34656248
comment on: http://stackoverflow.com/q/22738173
type: Comment
type: QuestionComment
score: 2
has text: Big question for a simple typo. ;)

http://stackoverflow.com/q/22741638
tagged with: file
type: Question
has answer: http://stackoverflow.com/a/22741683
score: 4
upvote count: 4
answer count: 2
downvote count: 0
has title: Properly reading files with FileReader and BufferedReader in Java
tagged with: bufferedreader
favorite count: 0
type: UnansweredQuestion
has body: I am trying to learn how to use read files using FileReader in Java however I get persistent errors. I am using Eclipse and I get a red error indicating that The constructor FileReader(File) is undefined and The constructor BufferedReader(FileReader) is undefined; however, I do not know where this error is originating from because I am using the right libraries and statements. I get the following error: Exception in thread "main" java.lang.Error: Unresolved compilation problems: The constructor FileReader(File) is undefined The constructor BufferedReader(FileReader) is undefined at FileReader.main(FileReader.java:17) My code is below: import java.io.BufferedReader; import java.io.File; import java.io.FileNotFoundException; import java.io.FileReader; import java.io.IOException; public class FileReader { public static void main(String[] args) { File file = new File("example.txt"); BufferedReader br = null; try { FileReader fr = new FileReader(file); br = new BufferedReader(fr); String line; while( (line = br.readLine()) != null ) { System.out.println(line); } } catch (FileNotFoundException e) { System.out.println("File not found: " + file.toString()); } catch (IOException e) { System.out.println("Unable to read file: " + file.toString()); } finally { try { br.close(); } catch (IOException e) { System.out.println("Unable to close file: " + file.toString()); } catch(NullPointerException ex) { } } } } For extra context (Sorry about the size but I believe you can zoom in. You can see where to red errors are on the left of the line):
tagged with: java
has answer: http://stackoverflow.com/a/22741863

http://stackoverflow.com/comment/34833136
type: Comment
type: AnswerComment
score: 0
has text: i didn't get you? Why getter and Setter not insert. means? please elaborate more.
comment on: http://stackoverflow.com/a/22786460

http://stackoverflow.com/a/22802340
type: Answer
has body: I have searched a lot this , for my project.It is not possible with android.Both android libraries , and device doesn't support this in the current scenario.
score: 0
answers question: http://stackoverflow.com/q/22802193

http://stackoverflow.com/comment/34605589
type: QuestionComment
has text: Your URL is wrong. You are mixing the old SID based syntax with the new service name based syntax. It's either: `jdbc:oracle:thin:@localhost:1521:XE` or `jdbc:oracle:thin:@//localhost:1521/XE`
comment on: http://stackoverflow.com/q/22709813
score: 0
type: Comment

http://stackoverflow.com/comment/34707022
type: Comment
comment on: http://stackoverflow.com/a/22751991
has text: or is this you want to try out ? `try { ...} catch (SQLException ex) { throw new ServletException(ex);}`
type: AnswerComment
score: 0

http://stackoverflow.com/a/22788148
has comment: http://stackoverflow.com/comment/34745960
score: 2
has comment: http://stackoverflow.com/comment/34746108
downvote count: 0
has comment: http://stackoverflow.com/comment/34746037
has body: Revised answer There's time taken to load and JIT-compile the code on the first call - that's why typically benchmarks don't include the first run. (In fact, many JVMs re-JIT more and more aggressively, so the performance improves over time - so good benchmarks run code lots of times before timing it.) Additionally, it's not unreasonable to think that a crypto provider may well do some one-time setup, especially if it's trying its best to get some decent entropy. (It could be using SecureRandom internally, for example.) You might want to time the Cipher.getInstance, Cipher.init and Cypher.doFinal method calls separately, to determine which is the slow part. Finally, you haven't shown us all the code (generateVectot?) so there could be things lurking there. Initial answer Apparently randomString is: simple function which generate random string with certain length and yes is use SecureRandom which instance is crateted just once Given that you're looking for something which is expensive (as creating and using a SecureRandom instance is) and only happens once, this sounds like a smoking gun to me. I suggest you add timing (using System.nanoTime, not System.currentTimeMillis) within randomString to test that hypothesis. I'd also strongly suggest that you don't use the overload of String.getBytes which uses the platform default encoding - instead, always specify the encoding explicitly.
has comment: http://stackoverflow.com/comment/34746157
has comment: http://stackoverflow.com/comment/34746932
upvote count: 2
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/22788031
answers question: http://stackoverflow.com/q/22788031
has comment: http://stackoverflow.com/comment/34748561
has comment: http://stackoverflow.com/comment/34746634
type: Answer

file
tags question: http://stackoverflow.com/q/22708933
type: Tag
tags question: http://stackoverflow.com/q/22652858
tags question: http://stackoverflow.com/q/22768091
tags question: http://stackoverflow.com/q/22661503
tags question: http://stackoverflow.com/q/22800628
tags question: http://stackoverflow.com/q/22754329
tags question: http://stackoverflow.com/q/22775676
tags question: http://stackoverflow.com/q/22797260
tags question: http://stackoverflow.com/q/22726954
tag name: file
tags question: http://stackoverflow.com/q/22748484
tags question: http://stackoverflow.com/q/22735524
tags question: http://stackoverflow.com/q/22792472
tags question: http://stackoverflow.com/q/22734052
tags question: http://stackoverflow.com/q/22723683
tags question: http://stackoverflow.com/q/22675394
tags question: http://stackoverflow.com/q/22719496
tags question: http://stackoverflow.com/q/22679052
tags question: http://stackoverflow.com/q/22734500
tags question: http://stackoverflow.com/q/22769443
tags question: http://stackoverflow.com/q/22741388
tags question: http://stackoverflow.com/q/22767742
tags question: http://stackoverflow.com/q/22711379
tags question: http://stackoverflow.com/q/22684115
tags question: http://stackoverflow.com/q/22697975
tags question: http://stackoverflow.com/q/22774626
tags question: http://stackoverflow.com/q/22694623
tags question: http://stackoverflow.com/q/22766084
tags question: http://stackoverflow.com/q/22750245
tags question: http://stackoverflow.com/q/22674353
tags question: http://stackoverflow.com/q/22651622
tags question: http://stackoverflow.com/q/22658040
tags question: http://stackoverflow.com/q/22656364
tags question: http://stackoverflow.com/q/22722481
tags question: http://stackoverflow.com/q/22720477
tags question: http://stackoverflow.com/q/22763506
tags question: http://stackoverflow.com/q/22773090
tags question: http://stackoverflow.com/q/22779916
tags question: http://stackoverflow.com/q/22777605
tags question: http://stackoverflow.com/q/22781430
tags question: http://stackoverflow.com/q/22715232
tags question: http://stackoverflow.com/q/22767877
tags question: http://stackoverflow.com/q/22654501
tags question: http://stackoverflow.com/q/22768071
tags question: http://stackoverflow.com/q/22749096
tags question: http://stackoverflow.com/q/22650669
tags question: http://stackoverflow.com/q/22734112
tags question: http://stackoverflow.com/q/22652668
tags question: http://stackoverflow.com/q/22776243
tags question: http://stackoverflow.com/q/22675796
tags question: http://stackoverflow.com/q/22741638
tags question: http://stackoverflow.com/q/22654487
tags question: http://stackoverflow.com/q/22756186
tags question: http://stackoverflow.com/q/22668660

http://stackoverflow.com/a/22762159
has comment: http://stackoverflow.com/comment/34707830
has comment: http://stackoverflow.com/comment/34703811
has body: You use the variable 'ks' out of scope. The lines ks.deleteEntry("Alias"); ks.setKeyEntry("Alias", privateKey.getEncoded(), null); need to be in the same try{ block as KeyStore ks = KeyStore.getInstance("JKS"); You also need to initialize the keystore, by using the load(..) method: http://developer.android.com/reference/java/security/KeyStore.html#load(java.io.InputStream, char[]) Using your example code, that would be: try { KeyStore ks = KeyStore.getInstance("JKS"); ks.load(null, null); pk = ks.getKey("Alias", null); if(pk != null){ sendSMS("5556", Base64.encodeToString(pk.getEncoded(), Base64.DEFAULT)); } ks.deleteEntry("Alias"); ks.setKeyEntry("Alias", privateKey.getEncoded(), null); } catch (KeyStoreException e) { e.printStackTrace(); } catch(NoSuchAlgorithmException e){ e.printStackTrace(); } catch (UnrecoverableKeyException e){ e.printStackTrace(); }
has comment: http://stackoverflow.com/comment/34701637
has comment: http://stackoverflow.com/comment/34729127
downvote count: 0
answers question: http://stackoverflow.com/q/22761847
type: Answer
score: 2
upvote count: 2

http://stackoverflow.com/comment/34537507
type: Comment
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/22670624
has text: It is understand, but if I don`t use style - anyway I do not see the chart now on the screen

http://stackoverflow.com/q/22791098
upvote count: 1
type: Question
has title: Get a specific child name in an XML file
score: 1
tagged with: java
tagged with: jdom-2
has answer: http://stackoverflow.com/a/36242522
possible better answer: http://stackoverflow.com/a/22792018
tagged with: jdom
has answer: http://stackoverflow.com/a/22792018
has body: I have an xml file like this: <?xml version="1.0" encoding="UTF-8"?> 1005390 SAP 4663789 XETR 23.0 <Order_Type>Limit</Order_Type> SELL <Order_Quantity>0.001</Order_Quantity> 1005390 SAP 4663789 XETR 13.0 <Order_Type>Limit</Order_Type> SELL <Order_Quantity>0.001</Order_Quantity> 1005390 SAP 4663789 XETR 13.0 <Order_Type>Limit</Order_Type> BUY <Order_Quantity>0.001</Order_Quantity> 1005390 SAP 4663789 XETR 13.0 <Order_Type>Limit</Order_Type> BUY <Order_Quantity>0.001</Order_Quantity> 1005390 SAP 4663789 XETR 13.0 <Order_Type>Limit</Order_Type> BUY <Order_Quantity>0.001</Order_Quantity> 1005390 SAP 4663789 XETR 13.0 <Order_Type>Limit</Order_Type> BUY <Order_Quantity>0.001</Order_Quantity> 1005390 SAP 4663789 XETR 13.0 <Order_Type>Limit</Order_Type> SELL <Order_Quantity>0.001</Order_Quantity> How can I extract the elements of child with ClOrdID id="3" ? THANKS
downvote count: 0
has answer: http://stackoverflow.com/a/22792843
favorite count: 0
answer count: 3
tagged with: http://stackoverflow.com/tag/xml
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/22792843

http://stackoverflow.com/comment/34732756
score: 0
comment on: http://stackoverflow.com/a/22770976
type: AnswerComment
has text: Yes. I haven't encountered this issue with FF. The URLs mentioned do not talk about problems with the APIs not working. I scanned through the solution for screenshot however, did not found an answer to that to.
type: Comment

http://stackoverflow.com/comment/34709798
comment on: http://stackoverflow.com/q/22767759
score: 1
has text: possible duplicate of [How can I iterate over a map of <String, POJO>?](http://stackoverflow.com/questions/3995463/how-can-i-iterate-over-a-map-of-string-pojo)
type: Comment
type: QuestionComment

http://stackoverflow.com/q/22673684
tagged with: methods
type: Question
tagged with: arrays
score: 0
linked to: http://stackoverflow.com/q/513832
has title: Comparing user's String input to a String array
has answer: http://stackoverflow.com/a/22673727
answer count: 1
tagged with: string
duplicate of: http://stackoverflow.com/q/513832
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/22673727
tagged with: java
has body: I know this is something really small and stupid but I don't know why this doesn't work. Basically there are only two names of employees that can be used to login. These two names are stored in an array. Once the user enters a name and it's not one of the two correct ones, the program keeps asking for the user name. String [] userNames = {"Jack", "Jill"}; logIn(userNames); public static void logIn(String [] name) { String userName = ""; Scanner kb = new Scanner(System.in); System.out.print("Enter Username: "); userName = kb.nextLine(); while (userName != name[0] || userName != name[1]) { System.out.print("Enter Username: "); userName = kb.nextLine(); } System.out.println("Correct"); }

http://stackoverflow.com/a/22685729
type: AcceptedAnswer
type: Answer
has body: You always overwrite k but if i understand you correctly you want all features in one String for (FeatureInfo s : feature) { k =k+ s.name + "\n" + "glEsVersion =" + s.reqGlEsVersion; }
downvote count: 0
score: 1
answers question: http://stackoverflow.com/q/22685088
has comment: http://stackoverflow.com/comment/34682482
accepted answer of: http://stackoverflow.com/q/22685088
upvote count: 1

http://stackoverflow.com/a/22653905
downvote count: 0
has body: I think it is more the question of taste. Some people always use this qualifier when accessing class members. I personally do not do this because this makes code more verbose. Explicit qualifying of outer class' this is even more verbose. One additional argument is that it can cause some problems when refactoring your code (unless your IDE does this correctly).
type: Answer
score: 1
answers question: http://stackoverflow.com/q/22653767
upvote count: 1

http://stackoverflow.com/q/22661503
tagged with: adobe-indesign
has answer: http://stackoverflow.com/a/22661992
has comment: http://stackoverflow.com/comment/34518172
has answer: http://stackoverflow.com/a/36698862
has title: Change Indesign File externally with Java etc
has body: my goal is to change texts in an indesign file via an external program(Java). We get our flyers as .indd files, due to changes in our pricing model we would like to change the prices, without editing the indd files manually(service provider would have to do that, $$$). I've build a program in Java to identify the locations to be changes, prices and text are in plaintext in the file. But when I try to change the prices from 19.9 to 22.9, the .indd file can't be opened due to a database error. :-( Might be a checksum or so). My question: Is there a way without Indesing to edit an .indd file. I've found the SDK from Adobe but you can't use it without a InD Server or Software. Is there any new software to do these changes, earlier post suggest no possibility,... Thank you! MTH_DE
has answer: http://stackoverflow.com/a/34133354
type: UnansweredQuestion
tagged with: java
tagged with: file
type: Question
score: 0
has comment: http://stackoverflow.com/comment/34525103
answer count: 3

http://stackoverflow.com/comment/34586869
score: 0
type: Comment
type: QuestionComment
has text: `why [0][0].length is 6??`. Think of it this way. You have `x`, `x` is an array of 4 elements `(x.length;)`, each element in x is an array of 5 elements `(x[i].length;)` and each element in there is an array of 6 elements `(x[i][i].length;)`. To make it clearer, the length of even `x[2][3].length` is 6.
comment on: http://stackoverflow.com/q/22699399

http://stackoverflow.com/a/22730160
accepted answer of: http://stackoverflow.com/q/22728916
upvote count: 5
downvote count: 0
answers question: http://stackoverflow.com/q/22728916
has comment: http://stackoverflow.com/comment/34643225
has comment: http://stackoverflow.com/comment/34642916
score: 5
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/34642349
type: Answer
has body: The HttpServletResponse will be controlled by your servlet container (Tomcat, Jetty etc.) . If you write into the response the servlet container automatically flush the response after a defined buffer size (e.g Tomcat after 9000 byte). Usually you can configure it (in Tomcat with the parameter socketBuffer). This is the way it works, if you do not control it by yourself. In your case, you control the response by your self and after you call response.flush() the response will be send to the client. If you had writte more the 9000 Byte (in Tomcat), the response will be send automatically (in the middle of it all). (excuse my bad english)

http://stackoverflow.com/comment/34633688
score: 0
type: AnswerComment
has text: Yep. It's in your logcat somewhere. It'll be the last line that has `Main.java:###` at the end, where `###` is the line number. I can be more specific about what to look for if you gimme a second to run a broken app.
type: Comment
comment on: http://stackoverflow.com/a/22725169

http://stackoverflow.com/a/22769864
type: Answer
upvote count: 1
downvote count: 1
answers question: http://stackoverflow.com/q/22769724
score: 0
has body: A boolean value has two states (true and false). You are essentially trying to return 3 states (higher, same, or neither). I suggest using a more appropriate data type. For example, you could use an enum: enum CardRelation { HIGHER, SAME, LOWER }; Or you could return a HigherSame. You could also take a comparator-style approach and return an int: negative if less than, 0 if equal, 1 if higher -- then &gt;= 0 can be used to test if the result is "same or higher". You could even implement Comparable or use a proper Comparator. While int itself carries no meaning, this style of comparison is frequently used in Java and so the meaning can remain clear. Think of what you are trying to determine (compare two cards) and try to come up with a data type that naturally reflects that concept and keeps appropriate semantics. A boolean[], by the way, also loses all semantic value and is generally a poor choice, "result[0]" requires some explanation and you also end up making assumptions about the array length all over the place, and what does a null signify?

http://stackoverflow.com/comment/34626804
type: QuestionComment
has text: possible duplicate of [Java: iterate through HashMap](http://stackoverflow.com/questions/1066589/java-iterate-through-hashmap)
score: 1
comment on: http://stackoverflow.com/q/22721517
type: Comment

http://stackoverflow.com/q/22769651
has answer: http://stackoverflow.com/a/22769754
has title: HTTP Status 500 - Cannot forward after response has been committed
has body: How would I go about fixing this? I have tried numerous things and looked at alot of different things on here with the same question but I cannot fix it. Could someone explain what is going on. If it helps, I want the customer to submit a form, once they do it goes to the servlet and sends it to a receipt where they see the info they have entered. If there is an easier solution I am all ears. Below is the stacktrace Mar 31, 2014 2:40:17 PM org.apache.catalina.core.StandardWrapperValve invoke SEVERE: Servlet.service() for servlet [edu.witc.Assignment03.controller.CustomerServlet] in context with path [/Justin_EJ_Assignment03_15400579] threw exception java.lang.IllegalStateException: Cannot forward after response has been committed at org.apache.catalina.core.ApplicationDispatcher.doForward(ApplicationDispatcher.java:348) at org.apache.catalina.core.ApplicationDispatcher.forward(ApplicationDispatcher.java:338) at edu.witc.Assignment03.controller.CustomerServlet.sendCustomerInfo(CustomerServlet.java:85) at edu.witc.Assignment03.controller.CustomerServlet.doPost(CustomerServlet.java:139) at javax.servlet.http.HttpServlet.service(HttpServlet.java:646) at javax.servlet.http.HttpServlet.service(HttpServlet.java:727) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:303) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208) at org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:241) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208) at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:220) at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:122) at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:501) at org.apache.catalina.core.StandardHostValve…
possible better answer: http://stackoverflow.com/a/22769754
type: AnsweredQuestion
tagged with: java
has answer: http://stackoverflow.com/a/22770008
type: Question
tagged with: jakarta-ee
tagged with: servlets
score: 0
answer count: 2
accepted answer: http://stackoverflow.com/a/22770008

http://stackoverflow.com/a/22781549
has body: Denvironment=test triggers a maven build profile with the name test. environment test ... This explains its exactly ;)
answers question: http://stackoverflow.com/q/22781399
score: 5
upvote count: 5
has comment: http://stackoverflow.com/comment/34734233
type: AcceptedAnswer
downvote count: 0
type: Answer
accepted answer of: http://stackoverflow.com/q/22781399

http://stackoverflow.com/comment/34535238
type: QuestionComment
comment on: http://stackoverflow.com/q/22670841
has text: perhaps the compiler inlined it?
score: 0
type: Comment

http://stackoverflow.com/comment/34679751
has text: It doesn't. No parentheses, no operator precedence.
comment on: http://stackoverflow.com/a/22751108
type: AnswerComment
score: 0
type: Comment

http://stackoverflow.com/comment/34531830
has text: Please post the stack trace and better describe the issue. Is `e` a `NullPointereException` or does invoking `Log.e` cause a `NullPointerException`?
type: Comment
type: QuestionComment
score: 6
comment on: http://stackoverflow.com/q/22668971

http://stackoverflow.com/comment/34711541
score: 0
has text: @AdrianMitev I use a restful service so the data will get sent to `http://ip/stuff`
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/22768449

http://stackoverflow.com/comment/34658813
type: Comment
comment on: http://stackoverflow.com/a/22739462
has text: Isn't a problem with this approach what to do if you have for instance two points, say `{4,1,0.9,0.7}`?
score: 0
type: AnswerComment

http://stackoverflow.com/a/22793510
downvote count: 0
has comment: http://stackoverflow.com/comment/34844871
type: Answer
has comment: http://stackoverflow.com/comment/34858752
has comment: http://stackoverflow.com/comment/34853869
has comment: http://stackoverflow.com/comment/34853785
has body: I suspect the problem is that you're not getting a good connection. if(response == HttpURLConnection.HTTP_OK) { in = httpConn.getInputStream(); } At this point in the code you're setting the input stream, but if the result is not HTTP_OK, you're going to return null, and you're not handling that possibility correctly, neither in OpenHttpConnection() nor in wolframAnswer() where you call it. It seems something in your connection setup code is not correctly connecting, and thus your input stream is null and crashing when you try to parse it with the DocumentBuilder.
has comment: http://stackoverflow.com/comment/34848612
accepted answer of: http://stackoverflow.com/q/22790965
upvote count: 1
answers question: http://stackoverflow.com/q/22790965
score: 1
type: AcceptedAnswer

http://stackoverflow.com/comment/34656168
has text: Unfortunately, I can't add any library to the code base. There are some restrictions to get this piece done and that's what makes it hard for me. Would the treeMap/treeSet work for this?
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/22724872
score: 0

http://stackoverflow.com/q/22691402
has body: I'm trying to do a simple Selenium test using webdriver (firefox). Steps: 1. Open login page 2. Log in 3. Open subpage My problem is that when a subpage is loaded user is no longer logged in. Thanks in advance for tips how to solve this. public class Test { public static void main(String[] args) { WebDriver driver = new FirefoxDriver(); driver.get("https://example.com/login"); WebElement login = driver.findElement(By.id("login_username")); WebElement pass = driver.findElement(By.id("login_password")); WebElement loginButton = driver.findElement(By.id("auth-login-submit")); login.sendKeys("login"); pass.sendKeys("pass"); loginButton.click(); driver.get("https://example.com/subpage"); } }
linked to: http://stackoverflow.com/q/19908296
has comment: http://stackoverflow.com/comment/34602320
answer count: 1
has comment: http://stackoverflow.com/comment/34571994
type: UnansweredQuestion
has title: Selenium webdriver - keep user logged in (java)
has comment: http://stackoverflow.com/comment/34613936
score: 0
tagged with: java
tagged with: selenium
tagged with: webdriver
has answer: http://stackoverflow.com/a/24095452
type: Question

http://stackoverflow.com/a/22696262
score: 2
upvote count: 2
has body: Get current time, Calendar.getInstance(); Get another 2 instance of current time, and set time fields based on your input For example: Calendar.set(Calendar.HOUR_OF_DAY, 1); and invoke compare() on the boundry of time
type: Answer
downvote count: 0
answers question: http://stackoverflow.com/q/22696124
has comment: http://stackoverflow.com/comment/34580691
has comment: http://stackoverflow.com/comment/34580767

http://stackoverflow.com/q/22749761
has answer: http://stackoverflow.com/a/22750111
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/22749975
tagged with: java
type: Question
score: 0
has answer: http://stackoverflow.com/a/22750086
answer count: 3
has title: Searching through parallel arrays
has comment: http://stackoverflow.com/comment/34677173
has comment: http://stackoverflow.com/comment/34677393
has body: I am trying to write a program to search through parallel arrays on stores double values one string, I need to be able to search either by a certain value returning all values equal to or more than in the array and the same index in the string array. I was able to write methods to sort the array like this public static void Sortstrength(Double[] strength, String[] names, int sel) //method to sort beers alphabetically up and down { String tmpStr; //temp string to help sort array Double tmpDbl; //temp double to help sort array if (sel == 1) //sort by names ascending if sel int = 1 { for (int t = 0; t &lt; strength.length - 1; t++) { for (int i = 0; i &lt; strength.length - 1; i++) { if (strength[i].compareTo(strength[i + 1]) &gt; 0) { tmpStr = names[i]; tmpDbl = strength[i]; names[i] = names[i + 1]; strength[i] = strength[i + 1]; names[i + 1] = tmpStr; strength[i + 1] = tmpDbl; } } } for (int i = 0; i &lt; names.length; i++) { System.out.printf("%-15s %s \n", names[i], strength[i]); } } else //sort by names descending { for (int t = 0; t &lt; strength.length - 1; t++) { for (int i = 0; i &lt; strength.length - 1; i++) { if (strength[i].compareTo(strength[i + 1]) &lt; 0) { tmpStr = names[i]; tmpDbl = strength[i]; names[i] = names[i + 1]; strength[i] = strength[i + 1]; names[i + 1] = tmpStr; strength[i + 1] = tmpDbl; } } } for (int i = 0; i &lt; names.length; i++) { System.out.printf("%-15s %s \n", names[i], strength[i]); } } } I have no clue how to alter this if it is even possible to do so but any help would be appreciated as I am pretty stuck Thanks for any help.

http://stackoverflow.com/comment/34576059
comment on: http://stackoverflow.com/a/22692412
type: AnswerComment
type: Comment
has text: I don't think DOM being language-neutral interface relates to the fact which java interfaces org.w3c.dom library implements. For example, Microsofts MSXML DOM has [IXMLDOMDocument](http://msdn.microsoft.com/en-us/library/windows/desktop/dd892951%28v=vs.85%29.aspx), [IXMLDOMDocument2](http://msdn.microsoft.com/en-us/library/ms761358%28v=vs.85%29.aspx) and [IXMLDOMDocument3](http://msdn.microsoft.com/en-us/library/ms763789%28v=vs.85%29.aspx) interfaces that supplement each other and add extensions to the DOM specification.
score: 1

http://stackoverflow.com/a/22768693
has comment: http://stackoverflow.com/comment/34832470
accepted answer of: http://stackoverflow.com/q/22768615
answers question: http://stackoverflow.com/q/22768615
has comment: http://stackoverflow.com/comment/34832691
has comment: http://stackoverflow.com/comment/34797524
upvote count: 1
type: AcceptedAnswer
has body: First, add the class declaration line at the top of your code: public class MyClass { Now it will compile :). Save it as MyClass.java, and add the line package my.package; at the very top. Compile it, and then, in another java file, import it with import my.package.MyClass; and use it with int i = MyClass.encrypt(password); A much less common way to do it is to not use the import at all, and specify the fully-qualified name when using it: int i = my.package.MyClass.encrypt(password); Ideally, MyClass.java is stored in the directory as specified by your package line, such as C:\java_code\my\package\MyClass.java MyClass must be compiled such that MyClass.class is in your CLASSPATH, and must be in its package directory (\my\package\MyClass.class). More information: https://www.google.com/search?q=java+CLASSPATH (You should also take a look at the "Related Questions" on the upper right of this page.)
downvote count: 0
has comment: http://stackoverflow.com/comment/34797933
type: Answer
score: 1

http://stackoverflow.com/comment/34635315
has text: You have to implement `.equals()` (and for good measure: `.hashCode()`) in your custom class `TransactionReportItem`.
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/22726182

http://stackoverflow.com/comment/34518162
type: QuestionComment
has text: Use polymorphism. Whatever it is you are needing to do, put it on the interface.
comment on: http://stackoverflow.com/q/22661469
score: 0
type: Comment

http://stackoverflow.com/a/22746392
type: Answer
upvote count: 2
has body: Here there is an extra semicolon after the condition: if (stack.getItem() == halo.TitaniumLeggings); Remove it. Statement will be like this: if (stack.getItem() == halo.TitaniumLeggings) { ... }
score: 2
accepted answer of: http://stackoverflow.com/q/22746317
type: AcceptedAnswer
downvote count: 0
answers question: http://stackoverflow.com/q/22746317

http://stackoverflow.com/comment/34531839
comment on: http://stackoverflow.com/a/22655429
type: Comment
has text: I see - instead of iterating through a complete turn, tracking the progress of a given turn and having the updater do different things depending on the turn state.
score: 0
type: AnswerComment

http://stackoverflow.com/comment/34507773
has text: i changed my function but still it doesn't work. `criteria.and("insured_name").regex( sb.getInsured_name(),"i");`
type: Comment
type: AnswerComment
score: 0
comment on: http://stackoverflow.com/a/22655452

http://stackoverflow.com/q/22720233
favorite count: 0
accepted answer: http://stackoverflow.com/a/22720548
type: AnsweredQuestion
tagged with: java
type: Question
upvote count: 9
has answer: http://stackoverflow.com/a/22720548
score: 9
tagged with: hamcrest
has title: Hamcrest Matchers.contains matcher not working (?)
answer count: 1
tagged with: junit
downvote count: 0
has body: I am trying to test if a collection has an item which toString() method returns a particular String. I tried do it using excellent Hamcrest matching classes, by combining contains with Matchers.hasToString, but somehow, its Matchers.contains is not being able to match an item even though it is present in the collection. Here's an example: class Item { private String name; public Item(String name){ this.name = name; } public String toString(){ return name; } } // here's a sample collection, with the desired item added in the end Collection&lt;Item&gt; items = new LinkedList&lt;Item&gt;(){{ add(new Item("a")); add(new Item("b")); add(new Item("c")); }}; Assert.assertThat(items, Matchers.contains(Matchers.hasToString("c"))); The above assertion is not successful. Here's the message: java.lang.AssertionError: Expected: iterable containing [with toString() "c"] but: item 0: toString() was "a" at org.hamcrest.MatcherAssert.assertThat(MatcherAssert.java:20) at org.junit.Assert.assertThat(Assert.java:865) at org.junit.Assert.assertThat(Assert.java:832) It looks like the Matchers.contains matcher tries to iterate over the list, but the Matchers.hasToString matcher fails in the first item and invalidates the rest of the iteration. Hamcrest javadoc for Matchers.contains says: "Creates a matcher for Iterables that matches when a single pass over the examined Iterable yields a single item that satisfies the specified matcher. For a positive match, the examined iterable must only yield one item" Am I doing something wrong?

pessimistic-locking
type: Tag
tag name: pessimistic-locking
tags question: http://stackoverflow.com/q/22663923

http://stackoverflow.com/comment/67591666
comment on: http://stackoverflow.com/a/22726869
type: Comment
has text: @flkes Yeah we've kicked around this idea, but it doesn't seem to add all that much value now that (in JDK 9) there is `Optional.stream()`.
type: AnswerComment
score: 4

http://stackoverflow.com/a/22682454
downvote count: 0
type: AcceptedAnswer
score: 4
has body: A Resource in Java is not a File. If the Resource is inside a JAR, for example, you can't access it like a File. You have to explode the JAR first. You may try: Class.getResourceAsStream() to read the content. Here is a short example: public class Example { public static void main(String[] args) throws IOException { BufferedReader br = new BufferedReader(new InputStreamReader(Example.class.getResourceAsStream("/META-INF/MANIFEST.MF"))); String line; do { line = br.readLine(); if (line != null) System.out.println(line); } while (line != null); } }
type: Answer
upvote count: 4
accepted answer of: http://stackoverflow.com/q/22682384
answers question: http://stackoverflow.com/q/22682384

http://stackoverflow.com/q/22736092
type: Question
has answer: http://stackoverflow.com/a/22736131
has title: declaring ArrayList in java Constructor
downvote count: 0
answer count: 6
favorite count: 0
accepted answer: http://stackoverflow.com/a/22736131
tagged with: arraylist
has body: I am working on a project, and I was taught to instantiate variables in constructors. I'm having some trouble doing this with an ArrayList thought. Can you suggest some best practices, do I need to define the ArrayList with the instance variables or can I do it in the constructor. Thanks for your suggestions! I have an example of what I'm talking about below: //imports import java.util.*; import java.lang.*; public class ArrayListConstructorDemo { //instance variables/attributes String string; List&lt;String&gt; list;// for example does this line need to say List&lt;String&gt; list = new ArrayList&lt;String&gt;(); //constructors public ArrayListConstructorDemo() { String string = "null"; List&lt;String&gt; list = new ArrayList&lt;String&gt;();//is there anyway I can do this here instead of 6 lines up? }//end default constructor public ArrayListConstructorDemo(String string,List&lt;String&gt; list) { this.string = string; this.list = list; }//end generic constructor //observers/getters/accessors public String getString(){return string;}//end method getString() public List&lt;String&gt; getList(){return list;}//end method getList() //transformers/setters/mutators public void setTable(String string){this.string = string;} public void setValues(String list) { // for(String s : test) // { list.add(this.list); // } } public String toString() { return "this is a generic toString method for the class ArrayListConstructorDemo"; }//end toString public static void main(String[] args) { ArrayListConstructorDemo alcd = new ArrayListConstructorDemo(); System.out.println(alcd.list.size()); //test Lists in general List&lt;String&gt; bleh = new ArrayList&lt;String&gt;(); bleh.add("b1"); System.out.println(bleh.get(0)); }//end method main() }//end class ArrayListConstructorDemo
has comment: http://stackoverflow.com/comment/34652665
has answer: http://stackoverflow.com/a/22736296
has comment: http://stackoverflow.com/comment/34652545
has answer: http://stackoverflow.com/a/22736164
has answer: http://stackoverflow.com/a/22736117
tagged with: constructor
upvote count: 7
has comment: http://stackoverflow.com/comment/34652556
has comment: http://stackoverflow.com/comment/34652692
type: AnsweredQuestion
possible better answer: http://stackoverflow.com/a/22736124
score: 7
tagged with: java
has answer: http://stackoverflow.com/a/22736124
has answer: http://stackoverflow.com/a/22736145

http://stackoverflow.com/comment/34697692
type: Comment
comment on: http://stackoverflow.com/a/22760337
score: 0
has text: Man i have no idea what you are talking about! Forgive me I am just 15 yrs old + new to java. Could you pls care 2 elaborate?
type: AnswerComment

http://stackoverflow.com/comment/34517531
comment on: http://stackoverflow.com/a/22661288
has text: Who gives minuses without a comment?
score: 0
type: AnswerComment
type: Comment

http://stackoverflow.com/q/22746689
has title: Why not rename System.out as PrintWriter?
answer count: 7
has answer: http://stackoverflow.com/a/22746726
has answer: http://stackoverflow.com/a/22747017
has answer: http://stackoverflow.com/a/22747119
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/22746863
score: 0
has comment: http://stackoverflow.com/comment/72786964
type: Question
has body: For simple laziness reasons, I get annoyed having to type the full System.out.println("..."); in Java code. Why would it be bad programming practice (if at all) to do something like this? import java.io.PrintWriter; public class RenameSystemOut{ public static void main(String[] args){ PrintWriter w = new PrintWriter(System.out); w.println("Hello, world"); w.close(); } } My guess is that it risks the programmer forgetting to close() the resource. But I imagine that in a long program with many print statements, you could save yourself a lot of trouble.
tagged with: java
has answer: http://stackoverflow.com/a/22746784
has comment: http://stackoverflow.com/comment/34672060
has comment: http://stackoverflow.com/comment/34671542
has answer: http://stackoverflow.com/a/22746715
has comment: http://stackoverflow.com/comment/34671333
has answer: http://stackoverflow.com/a/22746728

http://stackoverflow.com/q/22703560
has comment: http://stackoverflow.com/comment/34595142
has comment: http://stackoverflow.com/comment/34594969
tagged with: android
tagged with: sqlite
has comment: http://stackoverflow.com/comment/34595123
has body: I'm Developing an android app in which there are Login activity and a Questionnaire activity contains Questions which as radio Buttons and also a Button(Next).So now I wanted to create a database to store the values of the respective fields. I've typed the code for dataHandler and Login.java now the problem is i wanted to know whether the table has been created and also how to view my table please help me and also please check whether my code is correct. Thanks in Advance. Here is code for the DatabaseAdapter.java public class DatabaseAdapter { DatabaseHandler dbhandler; public DatabaseAdapter(Context context){ dbhandler =new DatabaseHandler(context); } public long insertData(String name,String desig,String years,String dept) { SQLiteDatabase db=dbhandler.getWritableDatabase(); ContentValues content=new ContentValues(); content.put(DatabaseHandler.NAME, name); content.put(DatabaseHandler.DESIGNATION,desig); content.put(DatabaseHandler.YEARS, years); content.put(DatabaseHandler.DEPARTMENT, dept); long id=db.insertOrThrow(DatabaseHandler.TABLE_NAME, null, content); return id; } static class DatabaseHandler extends SQLiteOpenHelper { private static final String NAME="name"; private static final String DESIGNATION="desig"; private static final String YEARS="years"; private static final String DEPARTMENT="dept"; private static final String TABLE_NAME="visteon"; private static final String DATA_BASE_NAME="VisteonSurvey"; private static final int DATABASE_VERSION=2; private static final String CREATE_TABLE="CREATE TABLE "+TABLE_NAME+"("+NAME+" VARCHAR(255),"+DESIGNATION+"text not null,"+YEARS+" text not null,"+DEPARTMENT+" text not null);"; public DatabaseHandler(Context context) { super(context,DATA_BASE_NAME,null,DATABASE_VERSION); } @Override public void onCreate(SQLiteDatabase db) { try{ db.execSQL(CREATE_TABLE); } catch(SQLException e) { e.printStackTrace(); } } @Override public void onUpgrade(SQLiteDatabase db, int oldVersion, int newVersion) { try { db.execSQL("DROP…
answer count: 0
type: UnansweredQuestion
tagged with: android-sqlite
has comment: http://stackoverflow.com/comment/34595106
tagged with: java
has title: How to check whether the table has been created and how to get the values from a radiobutton and a spinner using SQlite?
type: Question
has comment: http://stackoverflow.com/comment/34595182
tagged with: sqliteopenhelper
score: 0
has comment: http://stackoverflow.com/comment/34594701

http://stackoverflow.com/q/22780917
accepted answer: http://stackoverflow.com/a/22781543
type: Question
tagged with: eclipse
has answer: http://stackoverflow.com/a/22781543
score: 0
answer count: 1
tagged with: eclipse-plugin
type: AnsweredQuestion
has title: How to get full method name in eclipse plugin application
tagged with: java
has body: For example my method name is public static Address convert(final com.test.Address wsAddress)throws Exception I want the whole line. If I do IMethod[] methods=type.getMethods(); IMethod method=methods[0]; String mname=method.toString(); mname=mname.substring(0, mname.indexOf(")")+1); I get only Address convert(com.test.Address)

http://stackoverflow.com/a/22786996
has comment: http://stackoverflow.com/comment/34746453
has comment: http://stackoverflow.com/comment/34751906
type: AcceptedAnswer
downvote count: 0
score: 3
accepted answer of: http://stackoverflow.com/q/22785447
has comment: http://stackoverflow.com/comment/34745035
answers question: http://stackoverflow.com/q/22785447
has comment: http://stackoverflow.com/comment/34751808
type: Answer
has comment: http://stackoverflow.com/comment/34747730
has comment: http://stackoverflow.com/comment/34745504
has comment: http://stackoverflow.com/comment/34745141
has body: I admit that my answer this is partly a hunch (because it was long time ago I wrote it) but with JSP you should typically name form action to be name of the servlet configured in web.xml I think your web.xml should be this: LoginServlet pl./*...*/.LogoutServlet LoginServlet /login And change your HTML to this: For the JavaScript part if you submit form with jQuery you can modify your parameters which to post and omit posting of password (because it should not be needed if you want to post it as hashed) see below code for usage: JavaScript (using jQuery): // Attach a submit handler to the form $("#loginForm").submit(function( event ) { // Stop form from submitting normally event.preventDefault(); // Get some values from elements on the page: var $form = $( this ); // We want to customize what we post, therefore we format our data var data = "login="+ $('#login').val() +"&passwordHash=" + CryptoJS.MD5($('#password').val()); // For debugging purposes... see your console: // Prints out for example: login=myLoginName&passwordHash=a011a78a0c8d9e4f0038a5032d7668ab console.log(data); // The actual from POST method $.ajax({ type: $form.attr('method'), url: $form.attr('action'), data: data, success: function (data) { console.log("Hey, we got reply form java side, with following data: "); console.log(data); // redirecting example.. if(data === "SUCCESS") { window.location.replace("http://stackoverflow.com"); } } }); }); Finally, at Java side you will need doPost() method which captures login and passwordHash value etc. protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { String login = request.getParameter("login"); String password = request.getParameter("passwordHash"); // // Do what ever you want with login and passwordHash here... // // Because we are using ajax we need to respond to it stating whether we can redirect or not to new location, see lines below // Content type of the response - You could also ret…
upvote count: 3

http://stackoverflow.com/comment/34799924
type: Comment
comment on: http://stackoverflow.com/a/22817363
has text: Actually this project works fine on other machine and I get this error on my laptop only. Also this error occurs on random JSPs so dont think its a JSP issue
score: 0
type: AnswerComment

http://stackoverflow.com/q/22695956
has comment: http://stackoverflow.com/comment/34581285
has comment: http://stackoverflow.com/comment/34583216
has body: I'm trying to conceptualize how to communicate and sync the data between my view tablets and the server. Fist let me describe the set up: I have several tablets running the same app that can choose to display any view in particular. A main server contains the models for all those views and manipulates the data in those models. The tablets will only be used to display said data and send back touch inputs. If I understand sockets well enough, you can send entire serialized objects through a network from a java server to an android device. As a result, this made me come up with the following way to handle the situation: I will have the same model object per view on the server, and have the same model object on the tablet. Both the server and the tablets will contain their own controllers for those models/ views. Every second or so, the tablets will send back the state of their model object to the server, which will change the states of all the model objects if necessary, and send those objects back out to be displayed. A big issue that I see with this, is what will happen when a model is changed by two different sources, I'd have to figure out some merging methods which seems like a wee bit of hassle, but doable. Also, having it update once per second, I wonder if that will cause a noticeable lag or not. Are there better ideas as far as how to accomplish this type of communication, perhaps a well known pattern?
type: UnansweredQuestion
tagged with: sockets
tagged with: android
tagged with: model-view
answer count: 0
has comment: http://stackoverflow.com/comment/34581039
tagged with: java
type: Question
has comment: http://stackoverflow.com/comment/34580236
has title: Efficient way to communicate with sockets by passing model objects between them
score: 0

http://stackoverflow.com/comment/34780567
type: Comment
has text: Well, it does. We are in the process of merging the fbthrift changes into Apache Thrift, hence the ticket(s). Regarding AOP: you can't make any component (including Thrift but not limited to) liable for not being AOP, when it was not a design goal. If you want to do AOP, that's your choice.
type: AnswerComment
comment on: http://stackoverflow.com/a/22711212
score: 0

http://stackoverflow.com/q/22690374
has comment: http://stackoverflow.com/comment/34570059
has title: How to draw a rectange on top of JPanel?
has body: I want to draw a rectange on top of JPanel. Next I want to set proper location for this rectangle. This is how I do this. I tried to change number in g.fillRect(margin, margin, 30, 30), but my rectangle is always located in the center of JPanel. Why? JPanel chartPanel = new JPanel(); // here we add components to chartPanel // ... chartPanel.add(new LegoBox()); class LegoBox extends JPanel { public void paintComponent(Graphics g) { super.paintComponent(g); int margin = 0; g.setColor(Color.red); g.fillRect(margin, margin, 30, 30); } }
type: UnansweredQuestion
tagged with: java
type: Question
tagged with: graphics
tagged with: rectangles
score: 0
has answer: http://stackoverflow.com/a/22691388
has comment: http://stackoverflow.com/comment/34569852
has comment: http://stackoverflow.com/comment/34570907
answer count: 1
has comment: http://stackoverflow.com/comment/34570773
tagged with: java-2d

http://stackoverflow.com/comment/34642478
comment on: http://stackoverflow.com/q/22698214
type: QuestionComment
has text: I have edited the first post with what I did so far. I created the simple average and works perfect, only that it does not show the exact average, I mean, beetwen 9 and 10, the average is 9.5, but my application is showing 9. Why and how to create the complex average? Thx!!!
score: 0
type: Comment

http://stackoverflow.com/a/22649300
downvote count: 0
type: Answer
score: 1
has body: Just use this, it is all you need. for (int[] out1 : out) { Arrays.toString(out1); } Remember to add following : import java.util.Arrays; If you insist on output exactly as you write, you can do following for (int[] out1 : out) { System.out.print(Arrays.toString(out1).replaceAll("\\[", "{").replaceAll("\\]", "}")); } But there remains comma on last line, so if you do not want it there, you have to check it for (int[] out1 : out) { System.out.print(Arrays.toString(out1).replaceAll("\\[", "{").replaceAll("\\]", "}")); if (out1 != out[out.length-1]){ System.out.print(","); } System.out.println(""); }
upvote count: 1
answers question: http://stackoverflow.com/q/22649269

maps
tags question: http://stackoverflow.com/q/22682358
tag name: maps
tags question: http://stackoverflow.com/q/22651192
tags question: http://stackoverflow.com/q/22695326
tags question: http://stackoverflow.com/q/22768537
type: Tag

http://stackoverflow.com/comment/34543449
type: Comment
has text: Thank you! Now that I can run the program the frequency does not show. Is there a way to take the expressions from the frequency method and print it into the final line where it says "frequency is: "?
comment on: http://stackoverflow.com/a/22674849
type: AnswerComment
score: 0

timer
tag name: timer
tags question: http://stackoverflow.com/q/22770214
tags question: http://stackoverflow.com/q/22671941
tags question: http://stackoverflow.com/q/22691468
tags question: http://stackoverflow.com/q/22686159
tags question: http://stackoverflow.com/q/22689491
tags question: http://stackoverflow.com/q/22652351
type: Tag
tags question: http://stackoverflow.com/q/22800242
tags question: http://stackoverflow.com/q/22804359
tags question: http://stackoverflow.com/q/22721279
tags question: http://stackoverflow.com/q/22712655
tags question: http://stackoverflow.com/q/22698698
tags question: http://stackoverflow.com/q/22715224
tags question: http://stackoverflow.com/q/22726896
tags question: http://stackoverflow.com/q/22689069
tags question: http://stackoverflow.com/q/22788934
tags question: http://stackoverflow.com/q/22807756
tags question: http://stackoverflow.com/q/22675605
tags question: http://stackoverflow.com/q/22788639
tags question: http://stackoverflow.com/q/22748547
tags question: http://stackoverflow.com/q/22746318
tags question: http://stackoverflow.com/q/22796767
tags question: http://stackoverflow.com/q/22773353
tags question: http://stackoverflow.com/q/22728794
tags question: http://stackoverflow.com/q/22797175

http://stackoverflow.com/a/22719705
type: AcceptedAnswer
has body: You seem to be sorting the entire array each time through. You need to sort from 0 to i (exclusive) at each iteration. Also, for odd length, you need parentheses when computing the subscript: myIntArray[(i+1)/2] instead of myIntArray[i+1/2]. Because of operator precedence, Java will evaluate the latter as myIntArray[i+(1/2)], which is just myIntArray[i], since 1/2 is 0 in integer division.
answers question: http://stackoverflow.com/q/22719433
type: Answer
accepted answer of: http://stackoverflow.com/q/22719433
has comment: http://stackoverflow.com/comment/34623567
score: 0

http://stackoverflow.com/comment/34670274
has text: Good idea. That's HTTP specific and a header is a good place for that type of info.
type: AnswerComment
score: 0
type: Comment
comment on: http://stackoverflow.com/a/22745160

http://stackoverflow.com/a/22780602
has comment: http://stackoverflow.com/comment/94224415
has comment: http://stackoverflow.com/comment/94224285
type: Answer
score: 4
has body: The JDBC specification requires that compliant drivers register themselves with java.sql.DriverManager when they are loaded (using a static initializer block). You should never have to register a driver yourself. Starting from JDBC 4.0 (Java 6), JDBC drivers are required to specify a services definition declaring all java.sql.Driver implementations provided by the driver (usually one). This is done through a file META-INF/services/java.sql.Driver. The DriverManager will query all instances of this file on the classpath (using java.util.ServiceLoader and load all driver implementations contained in these files. As a (compliant) driver is required to register itself, all these implementations are now registered with DriverManager. So: It is no longer necessary to use Class.forName(...); to load a driver (unless the driver is not JDBC 4 compliant) You should never have to manually register a driver with DriverManager (unless the driver is not JDBC 1 compliant, or was specifically built to not register itself) In your specific code you have three JDBC 4 compliant drivers (at least with regard to the services definition) so they are loaded automatically. Executing Class.forName(..) has no effect because the class is already loaded (so it won't be loaded again). When you manually register a driver (which as I said before, you should never do), it will add an additional instance to the list of registered drivers.
answers question: http://stackoverflow.com/q/22779917
downvote count: 0
upvote count: 4

http://stackoverflow.com/comment/34739933
type: AnswerComment
comment on: http://stackoverflow.com/a/22784739
type: Comment
has text: go to https://code.google.com/p/libphonenumber/downloads/list and download any version of libphonenumber.jar
score: 0

http://stackoverflow.com/comment/34677091
score: 0
type: AnswerComment
type: Comment
has text: Actually my code is working fine for checking the strange prime.But it is not working when I added the part of returning Nth strange prime.
comment on: http://stackoverflow.com/a/22749699

http://stackoverflow.com/comment/34744971
score: 0
has text: if you can write insertion code , and how you are using this, then might be we can solve it
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/22787121

http://stackoverflow.com/q/22799317
answer count: 2
tagged with: program-entry-point
downvote count: 0
has comment: http://stackoverflow.com/comment/34766675
has body: I am creating a GUI in java and am getting the following error: Error: Main method not found in class mainGUI, please define the main method as: public static void main(String[] args) I cant work out why this is happening, considering that i do have a main method in my code and it does contain some code. My GUI code is as follows: import javax.swing.JButton; import javax.swing.JFrame; import javax.swing.JLabel; import javax.swing.JTextField; import javax.swing.SwingConstants; import java.awt.*; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; public class mainGUI extends JFrame { /** * */ private static final long serialVersionUID = 1L; private static final int WIDTH = 400; private static final int HEIGHT = 300; private JLabel lengthL, widthL, areaL, perimeterL; private JTextField lengthTF, widthTF, areaTF, perimeterTF; private JButton calculateB, exitB; private CalculateButtonHandler cbHandler; private ExitButtonHandler ebHandler; public mainGUI() { lengthL = new JLabel("Enter the length: ", SwingConstants.RIGHT); widthL = new JLabel("Enter the width: ", SwingConstants.RIGHT); areaL = new JLabel("Area: ", SwingConstants.RIGHT); perimeterL = new JLabel("Perimeter: ", SwingConstants.RIGHT); lengthTF = new JTextField(10); widthTF = new JTextField(10); areaTF = new JTextField(10); calculateB = new JButton("Calculate"); cbHandler = new CalculateButtonHandler(); calculateB.addActionListener(cbHandler); exitB = new JButton("Exit"); ebHandler = new ExitButtonHandler(); exitB.addActionListener(ebHandler); lengthTF = new JTextField(10); widthTF = new JTextField(10); areaTF = new JTextField(10); perimeterTF = new JTextField(10); calculateB = new JButton("Calculate"); exitB = new JButton("Exit"); Container pane = getContentPane(); pane.setLayout(new GridLayout(5, 2)); pane.add(lengthL); pane.add(lengthTF); pane.add(widthL); pane.add(widthTF); pane.add(areaL); pane.add(areaTF); pane.add(calculateB); pane.add(exitB); setTitle("Main Menu"); setSize(WIDTH, …
favorite count: 0
has comment: http://stackoverflow.com/comment/34766719
has comment: http://stackoverflow.com/comment/34766776
tagged with: compiler-errors
type: UnansweredQuestion
has title: Error: Main method not found in class mainGUI, please define the main method as: public static void main(String[] args)
upvote count: 1
type: Question
has answer: http://stackoverflow.com/a/45472035
has comment: http://stackoverflow.com/comment/34767105
score: 1
has comment: http://stackoverflow.com/comment/34766785
tagged with: java
has answer: http://stackoverflow.com/a/22800200
has comment: http://stackoverflow.com/comment/34766667

http://stackoverflow.com/a/22713998
downvote count: 0
answers question: http://stackoverflow.com/q/22713804
type: Answer
score: 1
upvote count: 1
has body: First of all your main method should be static like: public static void main(String args[]){ } To correct your code: public class CountChars { public int countit(String word, char ch) { int count = 0; int index = 0; while (index &lt; word.length()) { if (word.charAt(index) == ch) { count = count + 1; } index = index + 1; return count; } return count; } public static void main(String args[]) { CountChars count = new CountChars(); System.out.println(count.countit("hello", 'o')); } } If you want to refference to a method within a class without instantiating an object of that class the method has to be static. So if you want to call your method countit() in you main method you should make that method static: public static int countit(...){}

http://stackoverflow.com/a/22777607
has body: The stack trace is telling you that the problem is on line 35 of the Practise_Assessment class. You need to look at that line. If line 35 is this: for(numDayEntries =0; numDayEntries &lt; daysArray.length;numDayEntries++ ){ then it is probably because you did not initialise daysArray - you set it to null.
score: 1
upvote count: 1
answers question: http://stackoverflow.com/q/22777550
type: Answer
downvote count: 0

http://stackoverflow.com/comment/34625541
type: Comment
comment on: http://stackoverflow.com/a/22720651
score: 0
type: AnswerComment
has text: Thank you! Error was in "tree." than wasn't writed )

http://stackoverflow.com/comment/34690067
has text: @TheStack: Some time ago I ran into a similar [funny thing](http://stackoverflow.com/questions/19689214/strange-branching-performance). The exact timing is hard to predict and JIT doesn't get it always right. I'm going to fix/extend my answer now.
type: Comment
comment on: http://stackoverflow.com/a/22755044
score: 0
type: AnswerComment

http://stackoverflow.com/q/22728431
has comment: http://stackoverflow.com/comment/34639158
tagged with: java
has answer: http://stackoverflow.com/a/22728604
score: -1
has comment: http://stackoverflow.com/comment/34639513
tagged with: image
type: Question
has comment: http://stackoverflow.com/comment/34639314
upvote count: 0
answer count: 1
accepted answer: http://stackoverflow.com/a/22728604
has comment: http://stackoverflow.com/comment/34639324
has comment: http://stackoverflow.com/comment/34639419
favorite count: 0
tagged with: jlabel
has title: Laying grids above images
linked to: http://stackoverflow.com/q/22214202
has body: What I have implemented till now in java is ask the user to upload an image from the directory. My next step is that when the image is loaded a grid is placed above that image just for visual purpose so that the image gets divided in a, say 10 x 10 grids. How do I implement this stuff? Here's what I have implemented till now. JFileChooser choose=new JFileChooser(); choose.showOpenDialog(null); File f=choose.getSelectedFile(); String filename=f.getAbsolutePath(); path.setText(filename); BufferedImage img; try { img=ImageIO.read(f); Image dimg = img.getScaledInstance(500,500,Image.SCALE_SMOOTH); ImageIcon imageIcon = new ImageIcon(dimg); image_label.setIcon(imageIcon); } catch(Exception e) { System.out.println(e); }
has comment: http://stackoverflow.com/comment/34640423
has comment: http://stackoverflow.com/comment/34639302
tagged with: swing
linked to: http://stackoverflow.com/q/19209650
downvote count: 1
tagged with: grid
type: AnsweredQuestion

mkdir
tags question: http://stackoverflow.com/q/22675796
tag name: mkdir
type: Tag
tags question: http://stackoverflow.com/q/22767877

http://stackoverflow.com/a/22758580
upvote count: 4
type: AcceptedAnswer
downvote count: 0
type: Answer
accepted answer of: http://stackoverflow.com/q/22754879
has body: With JAX-RS 2.0, you can do as follow: @Path("{categoryId}/products") public CategoryProductResource getCategoryProducts( @PathParam("categoryId") int id, @Context ResourceContext rc) { return rc.initResource(new CategoryProductResource(id)); } In that case, I think the @Stateless annotation is not required on the CategoryProductResource. HTH.
answers question: http://stackoverflow.com/q/22754879
score: 4

http://stackoverflow.com/comment/34547308
type: QuestionComment
type: Comment
score: 0
has text: Oh yes, I understand now, thank you. (I'm an amateur Java programmer, so please forgive the silly mistakes...!) Thank you, MadProgrammer, that was the solution...
comment on: http://stackoverflow.com/q/22677613

http://stackoverflow.com/q/22725395
answer count: 2
upvote count: 1
has answer: http://stackoverflow.com/a/22725408
accepted answer: http://stackoverflow.com/a/22725408
has body: Statement stmt = con.createStatement(); String pubBooks = "select title_name " + "from publisher, title " + "where pub_name = ? " + "and publisher.pub_no = title.pub_no " + "order by title_name"; ResultSet rS = stmt.executeQuery(pubBooks); stmt.close(); String pubss = "Irwin"; PreparedStatement pStmt = con.prepareStatement(pubBooks); pStmt.setString(1, pubss); pStmt.executeUpdate(); Hey, I'm trying to use JDBC to query my database to the the list of book titles produced by that publisher however I run into the error java.sql.SQLException: ORA-01008: not all variables bound. I've been trying everything that I can think of but I am just not quite sure what to do at this point.
favorite count: 0
tagged with: oracle-database
tagged with: sql
tagged with: jdbc
has answer: http://stackoverflow.com/a/22725516
type: AnsweredQuestion
possible better answer: http://stackoverflow.com/a/22725516
downvote count: 0
score: 1
tagged with: java
type: Question
has title: SQLException: ORA-01008: not all variables bound -- SQL error using java to query database JDBC

http://stackoverflow.com/comment/34667932
type: Comment
comment on: http://stackoverflow.com/q/22744799
score: 0
type: QuestionComment
has text: Check if your ids on the layout correspond with your `findViewById` methods.

http://stackoverflow.com/comment/34722604
type: QuestionComment
comment on: http://stackoverflow.com/q/22774698
has text: if you can - replace conditionals with polymorphism http://refactoring.com/catalog/replaceConditionalWithPolymorphism.html
score: 0
type: Comment

http://stackoverflow.com/q/22652856
tagged with: gson
type: Question
has title: ArrayList<CustomClass> to JsonArray
has answer: http://stackoverflow.com/a/22672070
has comment: http://stackoverflow.com/comment/34503599
score: 0
answer count: 1
accepted answer: http://stackoverflow.com/a/22672070
has body: ArrayList&lt;Custom&gt; ex= new ArrayList&lt;Custom&gt;(); ex = ApproverDao.fetchRequests(); Gson gson = new Gson(); JsonElement el = gson.toJsonTree(ex, new TypeToken&lt;List&lt;Custom&gt;&gt;(){}.getType());//Line4 JsonArray ja = el.getAsJsonArray(); I'm getting an error here that says "The method toJsonTree(List, Type) is undefined for the type Gson". Where have I gone wrong? I have the c2dm.jar in my build path.
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/34503385
tagged with: java
tagged with: http://stackoverflow.com/tag/json

http://stackoverflow.com/comment/34541946
has text: The javax.persistence.Entity is a class inside the J2EE SDK library “javaee.jar“, you are missing this jar file in your project classpath.
comment on: http://stackoverflow.com/a/22672764
type: AnswerComment
type: Comment
score: 0

http://stackoverflow.com/comment/34655762
has text: @Hussain how does that change the question? Replace `X` with `Y` where `Y` is a property of `X` and you have exactly the same problem.
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/22737903
score: 0

http://stackoverflow.com/comment/34643929
type: Comment
type: AnswerComment
score: 0
comment on: http://stackoverflow.com/a/22729705
has text: @Tanmay I copied your code and dont encounter this problem. I wonder it's something wrong with your classpath or something else

for-loop
tags question: http://stackoverflow.com/q/22666755
tags question: http://stackoverflow.com/q/22738271
tags question: http://stackoverflow.com/q/22653228
tags question: http://stackoverflow.com/q/22699519
tags question: http://stackoverflow.com/q/22706448
tag name: for-loop
tags question: http://stackoverflow.com/q/22806764
tags question: http://stackoverflow.com/q/22691734
tags question: http://stackoverflow.com/q/22679261
tags question: http://stackoverflow.com/q/22742538
tags question: http://stackoverflow.com/q/22789734
tags question: http://stackoverflow.com/q/22794493
type: Tag
tags question: http://stackoverflow.com/q/22708047
tags question: http://stackoverflow.com/q/22651424
tags question: http://stackoverflow.com/q/22768889
tags question: http://stackoverflow.com/q/22793006
tags question: http://stackoverflow.com/q/22650444
tags question: http://stackoverflow.com/q/22727994
tags question: http://stackoverflow.com/q/22694217

http://stackoverflow.com/q/22694217
has answer: http://stackoverflow.com/a/22695681
has answer: http://stackoverflow.com/a/22696118
downvote count: 0
has answer: http://stackoverflow.com/a/22696087
has title: For loop that counts how many characters repeat in a string, then removes the repeated characters
tagged with: string
has body: Example: attack at noon = a3t3c1k1 2n2o2 It also counts spaces. Here is what I have, but it doesn't seem to be returning correctly: String getCount(String str) { String R = ""; int l = S.length(); int cnt = 1; for (int i = 0; i &lt; l; i++) for (int j = i + 1; j &lt; l; j++) if (S.charAt(j) == S.charAt(i)) { cnt++; R = R + S.charAt(i)+""+cnt; System.out.print(S.charAt(i) + cnt); } return R; }
favorite count: 0
has answer: http://stackoverflow.com/a/22698048
has comment: http://stackoverflow.com/comment/34578440
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/22696087
upvote count: 2
tagged with: java
possible better answer: http://stackoverflow.com/a/22695764
tagged with: loops
has answer: http://stackoverflow.com/a/22695962
has answer: http://stackoverflow.com/a/22695764
has comment: http://stackoverflow.com/comment/34579299
type: Question
answer count: 6
has comment: http://stackoverflow.com/comment/34577986
tagged with: for-loop
score: 2

http://stackoverflow.com/comment/34644729
type: Comment
type: QuestionComment
has text: If your ranges overlap, you are counting some time steps more than once. Do you want this?
comment on: http://stackoverflow.com/q/22731613
score: 0

http://stackoverflow.com/q/22789441
score: 0
has title: Java download a file from HTTPS html form
answer count: 1
tagged with: httpurlconnection
type: UnansweredQuestion
has body: I have to download a file from a website. It's a normal html form, I usually download several files from html forms. But this one is in a site that only allow access via HTTPS. I have one great program, I can't use Apache Commons HttpClient, because I can't download nothing from my job beyond excel and pdfs files. It was very hard to get Eclipse. Thus, I'm using HttpURLConnection (I tried HttpsURLConnection too), but this way I can't even connect to the site, so send parameters to the form and download the file are been impossible. Please, could someone help me? Thanks and regards.
tagged with: java
type: Question
linked to: http://stackoverflow.com/q/14392120
has answer: http://stackoverflow.com/a/22789917

http://stackoverflow.com/q/22726213
answer count: 1
tagged with: bayesian
tagged with: weka
accepted answer: http://stackoverflow.com/a/22726265
has title: unable to find class label in arff file
type: AnsweredQuestion
score: 0
tagged with: java
type: Question
has answer: http://stackoverflow.com/a/22726265
has body: I have followed example code on weka websites for example but i still keep on getting an error of unable to find the class label weka.core.WekaException: weka.classifiers.bayes.NaiveBayesMultinomialUpdateable: Not enough training instances with class labels (required: 1, provided: 0)! I have tried this file with the weka explorer and it works fine. ArffLoader loader = new ArffLoader(); loader.setFile(new File(""));//file is valid Instances structure = loader.getStructure(); structure.setClassIndex(structure.numAttributes() - 1); // train NaiveBayes NaiveBayesMultinomialUpdateable n = new NaiveBayesMultinomialUpdateable(); FilteredClassifier f = new FilteredClassifier(); StringToWordVector s = new StringToWordVector(); f.setFilter(s); f.setClassifier(n); f.buildClassifier(structure); Instance current; while ((current = loader.getNextInstance(structure)) != null) n.updateClassifier(current); // output generated model System.out.println(n);

http://stackoverflow.com/q/22724474
tagged with: jndi
tagged with: java
has comment: http://stackoverflow.com/comment/34632595
has answer: http://stackoverflow.com/a/22729566
has title: Standalone application for JMS/MQ messaging?
answer count: 2
downvote count: 0
tagged with: ibm-mq
has answer: http://stackoverflow.com/a/22729560
accepted answer: http://stackoverflow.com/a/22729560
has comment: http://stackoverflow.com/comment/34632836
possible better answer: http://stackoverflow.com/a/22729566
tagged with: jms
favorite count: 0
has body: I want to create a Java standalone application for connecting via JMS to an MQ Queue Manager (not to be confused with a client). I want to create the JNDI resources independently and put everything in a JAR a run it to make some tests. Is there any example that I can take to build this?
score: 2
has comment: http://stackoverflow.com/comment/34632478
upvote count: 2
type: Question
type: AnsweredQuestion

http://stackoverflow.com/q/22721283
has answer: http://stackoverflow.com/a/63543741
favorite count: 0
has title: Maven (commandline): No compiler is provided in this environment
type: Question
tagged with: windows
score: 26
has answer: http://stackoverflow.com/a/40810188
has answer: http://stackoverflow.com/a/78213338
answer count: 6
tagged with: command-line
possible better answer: http://stackoverflow.com/a/49922882
has answer: http://stackoverflow.com/a/22730419
has answer: http://stackoverflow.com/a/49922882
tagged with: java
upvote count: 26
accepted answer: http://stackoverflow.com/a/22730419
has answer: http://stackoverflow.com/a/68884068
has body: Failed to execute goal or.apache.maven.plugins:maven-compiler-plugin:3.1:comple &lt;default-compile&gt; on project google-play-services: Compilation failure No compiler is provided in this environment. Perhaps you are running on a JRE rather than a JDK? This is the result when using the Android SDK Deployer from the commandline in Windows. I added JAVA_HOME C:\Program Files (x86)\Java\jdk1.7.0_45 to my system variables. Did I configured the wrong parts?
type: AnsweredQuestion
tagged with: environment-variables
downvote count: 0

http://stackoverflow.com/a/22700962
type: Answer
score: 13
upvote count: 13
accepted answer of: http://stackoverflow.com/q/22700944
downvote count: 0
has body: If you're trying to call a static method within the class it's defined in, you don't need to specify the type. (The rules get a little more complicated with nested classes). For instance methods and variables, you can use the this keyword in your field access and method invocation expressions.
answers question: http://stackoverflow.com/q/22700944
type: AcceptedAnswer

http://stackoverflow.com/comment/34651570
type: Comment
comment on: http://stackoverflow.com/a/22735484
has text: thanks for reply.Can you give some examples with brief.
type: AnswerComment
score: 0

http://stackoverflow.com/a/22655187
has body: You could approach it two ways. Parse the values from your result set into separate Lists. Since you don't have an entity defined for it, the query will return a List&lt;Object[]&gt; list = query.getResultList(); For each row returned, you can access age and name by the index in which they appear. i.e. Age is selected first in your above example so you would it would be index 0 and Name is index 1. for (Object[] obj : list) { age = obj[0]; name = obj[1]; // ..put them into whatever collection you desire } Use two queries. One that selects AGE and the other that selects NAME. Each one will return the corresponding values to it's own list. Query query = entityManager.createNativeQuery("SELECT age FROM Student"); List ages=query.getResultList(); query = entityManager.createNativeQuery("SELECT name FROM Student"); List names=query.getResultList(); Only caveat to this method is that there is no true relationship between the two lists. In other words, ages[3] may not logically match names[3]. But... as it is, the original question does not have any definition as to how the two lists should be created.
has comment: http://stackoverflow.com/comment/106518200
downvote count: 0
type: Answer
score: 13
upvote count: 13
answers question: http://stackoverflow.com/q/22653858
has comment: http://stackoverflow.com/comment/34507500
has comment: http://stackoverflow.com/comment/93771851

http://stackoverflow.com/q/22799842
linked to: http://stackoverflow.com/q/1205995
has title: Address Book Application - @SuppressWarnings
has body: I'm using Eclipse ADT to build an Address Book App, and am having issues with some of the code. I am receiving @SuppressWarnings for SimpleCursorAdapter and deactivate. Add @SuppressWarnings 'depresiation' to onCreate() Add @SuppressWarnings 'depresiation' to onStop() How do I fix this? // AddressBook.java // Main activity for the Address Book app. package com.deitel.addressbook; import android.app.ListActivity; import android.content.Intent; import android.database.Cursor; import android.os.AsyncTask; import android.os.Bundle; import android.view.Menu; import android.view.MenuInflater; import android.view.MenuItem; import android.view.View; import android.widget.AdapterView; import android.widget.AdapterView.OnItemClickListener; import android.widget.CursorAdapter; import android.widget.ListView; import android.widget.SimpleCursorAdapter; public class AddressBook extends ListActivity { public static final String ROW_ID = "row_id"; // Intent extra key private ListView contactListView; // the ListActivity's ListView private CursorAdapter contactAdapter; // adapter for ListView // called when the activity is first created @Override public void onCreate(Bundle savedInstanceState) &gt; { super.onCreate(savedInstanceState); // call super's onCreate contactListView = getListView(); // get the built-in ListView contactListView.setOnItemClickListener(viewContactListener); // map each contact's name to a TextView in the ListView layout String[] from = new String[] { "name" }; int[] to = new int[] { R.id.contactTextView }; contactAdapter = new SimpleCursorAdapter(AddressBook.this, R.layout.contact_list_item, null, from, to); setListAdapter(contactAdapter); // set contactView's adapter } // end method onCreate @Override protected void onResume() { super.onResume(); // call super's onResume method // create new GetContactsTask and execute it new GetContactsTask().execute((Object[]) null); } // end method onResume @Override protected void onStop() { Cursor cursor = contactAdapte…
has answer: http://stackoverflow.com/a/22799964
tagged with: java
type: Question
tagged with: addressbook
tagged with: adt
has answer: http://stackoverflow.com/a/22800334
score: 0
answer count: 2
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/34767539

http://stackoverflow.com/q/22694602
tagged with: web
has title: What does it mean that Apache Sling "more REST" than Spring-mvc?
tagged with: rest
answer count: 3
has answer: http://stackoverflow.com/a/22695943
has body: Sometimes vaguely I hear that Apache Sling more REST than Spring-mvc from my colleagues. I don't have possibilities to know about it from them. I have enough experience with Spring-mvc and I am novice in Apache Sling. Can anyone explain the above quote? P.S. I want to see the list of non-REST features of these products. for example: Spring-mvc allow to use session attributes and it is contradicts REST principe - to be stateless.
favorite count: 0
has answer: http://stackoverflow.com/a/22699495
downvote count: 0
type: UnansweredQuestion
score: 6
tagged with: spring-mvc
tagged with: sling
tagged with: java
type: Question
has answer: http://stackoverflow.com/a/22709570
upvote count: 6

http://stackoverflow.com/q/22800120
type: UnansweredQuestion
tagged with: semaphore
has answer: http://stackoverflow.com/a/22800239
tagged with: multithreading
has title: Bounded Buffer deadlock
has body: I tried to write a simple bounded buffer in Java, but the program seems deadlocked after the first few operations. public BoundedBuffer(int size){ buffer = new LinkedList&lt;E&gt;(); this.empty = new Semaphore(size); this.full = new Semaphore(0); this.mutex = new Semaphore(1); } public void produce(E element) throws InterruptedException { this.empty.acquire(); this.mutex.acquire(); this.buffer.add(element); this.mutex.release(); this.full.release(); } public E consume() throws InterruptedException{ this.full.acquire(); this.mutex.acquire(); E elem = this.buffer.remove(0); this.mutex.release(); this.full.release(); return elem; } Those are my produce and consume methods and they should avoid deadlock. However the program always hangs. Am I missing something? EDIT: Also added my constructor.
type: Question
tagged with: java
score: 0
answer count: 1
has comment: http://stackoverflow.com/comment/34768192

http://stackoverflow.com/q/22712458
has answer: http://stackoverflow.com/a/22712552
type: Question
answer count: 2
has comment: http://stackoverflow.com/comment/34609950
has body: I have to execute multiple threads asynchronously in Java. What is the best method to execute this?
favorite count: 0
has comment: http://stackoverflow.com/comment/34610677
downvote count: 4
upvote count: 0
score: -4
tagged with: multithreading
possible better answer: http://stackoverflow.com/a/22712552
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/22712574
accepted answer: http://stackoverflow.com/a/22712574
tagged with: java
has title: How to execute multiple threads asynchronously in Java

http://stackoverflow.com/q/22674632
has answer: http://stackoverflow.com/a/22674705
tagged with: java
type: Question
answer count: 1
has title: Progressing through ArrayList strings on a JLabel
tagged with: arraylist
score: 0
tagged with: jlabel
type: UnansweredQuestion
has body: If I have a class, containing an ArrayList of questions for a quiz, how would I get a JLabel (contained in a seperate class) to progress through each question as its display, as each person answers a question correctly. To clarify, -JLabel displays first string from ArrayList -Person answers question correctly -JLabel then displays the second string in ArrayList My ArrayList code is import java.util.*; public class Questions { public static void main(String[] args) { ArrayList&lt;String&gt; SPOquestions = new ArrayList&lt;String&gt;(); // adding the sports questions for the quiz SPOquestions.add("Who won the 2005 Formula One World Championship?"); SPOquestions.add("Which team has the most Formula One Constructors titles?"); SPOquestions.add("In what year did Roger Federer win his first 'Grand Slam'?"); SPOquestions.add("How many 'Grand Slams' has Rafael Nadal won?"); SPOquestions.add("Who has scored the most amount of goals in the Premier League?"); SPOquestions.add("Who has won the most World Cups in football?"); SPOquestions.add("How many MotoGP titles does Valentino Rossi hold?"); SPOquestions.add("Who was the 2013 MotoGP champion?"); SPOquestions.add("Who won the 2003 Rugby World Cup?"); SPOquestions.add("In rugby league, how many points are awarded for a try?"); SPOquestions.add("Who is the youngest ever snooker World Champion?"); SPOquestions.add("In snooker, what is the highest maximum possible break?"); SPOquestions.add("How many majors has Tiger Woods won?"); SPOquestions.add("In golf, what is the tournament between the USA and Europe called?"); SPOquestions.add("How many World Championships has darts player Phil Taylor won?"); SPOquestions.add("What is the maximum possible amount of points a player can earn from throwing three darts?"); SPOquestions.add("How many gold medals did Michael Phelps win at the 2008 Beijing Olympics?"); SPOquestions.add("Who won the 2012 Olympic 100 metres mens race?"); SPOquestions.add("Which of these events are not a part of th…

http://stackoverflow.com/a/22700852
has comment: http://stackoverflow.com/comment/34589982
has comment: http://stackoverflow.com/comment/34589689
has body: Because you are specifically asking for the order of the points from the RotatedRect data structure, that order is predictable and never changes (unless you update the library and the developers somehow needed to change that code -> very unlikely). The order I got is quite odd and is the following: point[0] - bottom left point[1] - top left point[2] - top right point[3] - bottom right You can see in OpenCV source code how that list of points from the RotatedRect is created, based on its center and angle: public void points(Point pt[]) { double _angle = angle * Math.PI / 180.0; double b = (double) Math.cos(_angle) * 0.5f; double a = (double) Math.sin(_angle) * 0.5f; pt[0] = new Point( center.x - a * size.height - b * size.width, center.y + b * size.height - a * size.width); pt[1] = new Point( center.x + a * size.height - b * size.width, center.y - b * size.height - a * size.width); pt[2] = new Point( 2 * center.x - pt[0].x, 2 * center.y - pt[0].y); pt[3] = new Point( 2 * center.x - pt[1].x, 2 * center.y - pt[1].y); } EDIT (after comments): If you realize that the corner order depends from the angle. It is easier to get the order based on the Pythagorean formula like it was said before by Sunil. Depending which sign the variables a and b will have, the order will be different. Those signs depend from the cos() and sin() results which in turn depend from the angle. So you have 4 combinations of signs (+a, +b), (-a ,-b), (+a, -b), (-a, +b). These will give, if my theory stands, the 4 different point orders. You can get the top-left corner by getting all points distance to (0,0). You will either get one minimum or 2 (equal) minimum distances. If you get 2 minimums, you chose one as the top-left rectangle corner: the one with smaller x coordinate is what makes more sense in my opinion and according to your drawing. The same process can be used for the other rectangle corners. // Distance (x1, y1) to (x2, y2) = abs( sqrt( (x2-x1)^2 + (y2-y1)^2 ) ) // Note:This is a quite l…
type: Answer
has comment: http://stackoverflow.com/comment/34589433
downvote count: 0
has comment: http://stackoverflow.com/comment/34589637
has comment: http://stackoverflow.com/comment/34609785
score: 1
has comment: http://stackoverflow.com/comment/34589569
has comment: http://stackoverflow.com/comment/34589883
answers question: http://stackoverflow.com/q/22696539
has comment: http://stackoverflow.com/comment/34589362
upvote count: 1
has comment: http://stackoverflow.com/comment/34590072

http://stackoverflow.com/comment/34670994
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/22746331
has text: I think you should a bit change the logic of the player2 method, and i think you should do if (button[num].isEnabled()) continue; after int num = rNum.nextInt(8);
score: 0

http://stackoverflow.com/comment/34759499
has text: None at the moment. I don't really know how to go about it.
comment on: http://stackoverflow.com/q/22794836
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/a/22651837
score: 0
type: Answer
has body: String theory is different than other Objects. As we all know to represent a object it's reference is necessary, which resides in stack. Means for a simple object only Stack and Heap are enough. But in String case there is one more concept of String Literal Pool. So you can't implement it explicitly.
answers question: http://stackoverflow.com/q/22651726

http://stackoverflow.com/comment/34545773
type: QuestionComment
comment on: http://stackoverflow.com/q/22676704
has text: read this page. [link]http://stackoverflow.com/questions/15885991/override-equals-method-only-of-a-java-object
score: 0
type: Comment

http://stackoverflow.com/comment/34602606
type: Comment
comment on: http://stackoverflow.com/a/22694870
type: AnswerComment
has text: Thanks for this suggestion! Unfortunately it doesn't change anything :(
score: 0

intellij-13
tag name: intellij-13
tags question: http://stackoverflow.com/q/22775255
tags question: http://stackoverflow.com/q/22790781
type: Tag
tags question: http://stackoverflow.com/q/22678588

http://stackoverflow.com/comment/34688543
comment on: http://stackoverflow.com/a/22716976
has text: Thanks for your reply. Another developer who is much more experienced with spring, setup the config for this app. It class based config and the cacheManager used appears to be `org.springframework.cache.ehcache.EhCacheCacheManager;` I cant find any mention of `ConcurrentMapCacheFactoryBean` in the app.
score: 0
type: AnswerComment
type: Comment

http://stackoverflow.com/comment/34754233
comment on: http://stackoverflow.com/q/22792509
score: 0
type: Comment
type: QuestionComment
has text: @ryvantage TBH, it kind of is an opinion-based question because there is no real answer (unless the actual authors chime in). We're simply speculating.

http://stackoverflow.com/comment/34658386
comment on: http://stackoverflow.com/a/22699585
type: Comment
has text: what do you mean by "I login with that id". Do yo think you manipulated `request.getSession().getId()` and set a value as 2 ? Please understand this - `request.getSession().getId()` : returns a string containing the unique identifier assigned to this session. The identifier is assigned by the servlet container and is implementation dependent. Having said that, do you still say that you logged in as id =2 ?
score: 0
type: AnswerComment

http://stackoverflow.com/comment/34972197
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/22853549
type: Comment
has text: This makes sense, but why would you install the RSA JSSE provider in your production environment and not use it (since you're visibly forcing the use of the Oracle/Sun JSSE provider here)? Note that your hostname verifier and trust manager are insecure too.

http://stackoverflow.com/q/22798825
has title: Java -- convert from number of weekdays to number of days
tagged with: java
has answer: http://stackoverflow.com/a/22798910
has answer: http://stackoverflow.com/a/22798922
possible better answer: http://stackoverflow.com/a/22798910
upvote count: 5
has body: This is similar to Calculating dates given two dates excluding weekend but a different problem. The question is "I was given a task N weekdays ago. How many days ago was this?" On a Friday, 3 weekdays ago is 3 days ago. On a Monday, 3 weekdays ago is 5 days ago. I can write a very simple solution by iterating. However, it strikes me that it should be possible to do this as an O(1) operation. A close but wrong answer is N + (7/5)N. Any tips?
linked to: http://stackoverflow.com/q/8171968
type: AnsweredQuestion
downvote count: 0
favorite count: 0
accepted answer: http://stackoverflow.com/a/22798922
type: Question
answer count: 2
tagged with: date-arithmetic
score: 5

http://stackoverflow.com/q/22747035
type: AnsweredQuestion
has body: So I changed my code to double arrays instead one one. But it keeps on telling me that Houses[] cant convert to House. And I cant seem to find the problem. I want this code to work as double arrays instead of one array. package ghetto; import java.math.*; import ghetto.Houses; import ghetto.House; import ghetto.Marker; import ghetto.HouseType; import ghetto.Grids; import ghetto.Ghetto; public class Houses { public int size; public House[][] houses; public Houses(int size, int blue, int red) { if (size == 0) return; this.houses = new House[size][size]; House.size = size; for (int i = 0; i &lt; size; i++) { for (int j = 0; j &lt; size; j++) this.houses[i][j] = new House(i, j, HouseType.Vacant); } // Create Blue if (blue != 0) { for (int totalBlue = 0; totalBlue &lt; blue;) { int choiceRow = (int) (Math.random() * size); int choiceCol = (int) (Math.random() * size); if (this.houses[choiceRow][choiceCol].who == HouseType.Vacant) { this.houses[choiceRow][choiceCol].who = HouseType.Blue; System.out.println("Blue house at " + choiceRow + " " + choiceCol); totalBlue = totalBlue + 1; } } } // Create Red if (red != 0) { for (int totalRed = 0; totalRed &lt; red;) { int choiceRow = (int) (Math.random() * size); int choiceCol = (int) (Math.random() * size); if (this.houses[choiceRow][choiceCol].who == HouseType.Vacant) { this.houses[choiceRow][choiceCol].who = HouseType.Red; System.out.println("Red house at " + choiceRow + " " + choiceCol); totalRed = totalRed + 1; } } } } public HouseType getHouseType(int row, int col) { System.out.println("house[" + row + "][" + col + "]= " + this.houses[row][col].who); return this.houses[row][col].who; // return HouseType.Red; } public void step() { for (int i = 0; i &lt; size; i++) { for (int j = 0; j &lt; size; j++) { // Who are my neighbors House[][] ns = neighbors(houses[i][j]); // How many are red, blue int countRed = 0; int countBlue = 0; for (int n = 0; n &lt; 8; n++) { if (ns[j][j].who == HouseType.Red) { countRed = countRed + 1; } if…
score: -2
possible better answer: http://stackoverflow.com/a/22747416
tagged with: java
has comment: http://stackoverflow.com/comment/34672344
has comment: http://stackoverflow.com/comment/34672657
has comment: http://stackoverflow.com/comment/34672483
has comment: http://stackoverflow.com/comment/34671987
type: Question
has title: convert from one array to double
answer count: 2
downvote count: 2
has comment: http://stackoverflow.com/comment/34672114
favorite count: 0
has comment: http://stackoverflow.com/comment/34672443
has comment: http://stackoverflow.com/comment/34672472
has comment: http://stackoverflow.com/comment/34672249
accepted answer: http://stackoverflow.com/a/22747410
has comment: http://stackoverflow.com/comment/34672029
has comment: http://stackoverflow.com/comment/34672031
upvote count: 0
has answer: http://stackoverflow.com/a/22747410
has answer: http://stackoverflow.com/a/22747416

http://stackoverflow.com/comment/34739588
score: 0
type: Comment
type: QuestionComment
has text: @Yuvaraja please check my edit. print list gives perfect values without duplicate.
comment on: http://stackoverflow.com/q/22783980

http://stackoverflow.com/q/22743286
score: -1
has title: Why Giving Null?
answer count: 3
possible better answer: http://stackoverflow.com/a/22743312
upvote count: 0
has answer: http://stackoverflow.com/a/22743309
has answer: http://stackoverflow.com/a/22743312
favorite count: 0
has body: Okaii so i wrote the two classes , did the main too (Still testing, not done yet ) , after running it , it gives null in the output , which means the default value.. why ? Location class ( With setters and getters ) public class Location { public String city; public String street; public Location() { } public Location(String city, String street) { this.city = city; this.street = street; } @Override public String toString(){ return "City Is : " + city + " \nStreet Is : " + street; } } And this is the composition in property class : (Also with setters and getters ) public Location location = new Location(); public static int counter = 0; public Property(int ID, Location location) { this.ID = ID; this.location = new Location(); counter++; } public String toString() { return "\nID is : " + ID + "\nLocation is : \n" + location.toString(); } And the output is : Enter Propery ID : 123 Enter Property City and Street : test test1 Do you want to Enter more Property Data ? no Choose One of the Options from the following menu : 1- List all properties. For each property display its id and location 2- List all properties locations. For each property display only the location 3- List all the ids of all properties that are in a certain given city (read the city) 4- Given a property id change its location city (read the id and the new value of city) 5- Display the location of a property given its id if it is found in the array (read the id) 6- Display the number of properties 7- Exit 1 Property 1 ID is : 123 Location is : City Is : null Street Is : null
has answer: http://stackoverflow.com/a/22743320
tagged with: composition
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/22743309
tagged with: java
tagged with: output
downvote count: 1
type: Question

http://stackoverflow.com/comment/34669154
type: Comment
type: QuestionComment
has text: What is your issue? Is listeners are not working? do you want to rotate images after some specific time interval? Please summarize you question.
comment on: http://stackoverflow.com/q/22745313
score: 0

http://stackoverflow.com/comment/34499377
has text: I guess that would be implementation specific, and is a coding style preference. If memory were a big issue, then only adding when you need to would obviously be the optimal option(checking if null within the loop).
type: Comment
score: 0
comment on: http://stackoverflow.com/a/22650471
type: AnswerComment

http://stackoverflow.com/comment/76210704
has text: if you find the example files go to this answer https://stackoverflow.com/questions/17633537/java-7-ee-tutorial-examples/44612105#44612105
comment on: http://stackoverflow.com/q/22807055
type: Comment
type: QuestionComment
score: 0

http://stackoverflow.com/comment/34585581
type: AnswerComment
comment on: http://stackoverflow.com/a/22695424
has text: Yeah? Why is yours faster?
type: Comment
score: 1

http://stackoverflow.com/q/22714915
answer count: 2
has answer: http://stackoverflow.com/a/22719901
has title: Write An Annotation to Constrain Class/Method Naming in Java?
favorite count: 0
type: UnansweredQuestion
tagged with: annotations
upvote count: 1
score: 1
tagged with: java
tagged with: naming
type: Question
has answer: http://stackoverflow.com/a/22715107
downvote count: 0
has body: I'm trying to find a way to use annotation to constrain namings in Java. Might be something looks like this: @Getter public String getXxx(); And when the method name does not meet the convention, for example not started with "get", the compiler will throw some error. So that during the coding progress in IDE, such like eclipse, the developer will be able to notice. I'm getting some ideas from this article, but it's too long and complex for me. Any simpler examples or directions would be very nice.

http://stackoverflow.com/a/22715686
has comment: http://stackoverflow.com/comment/95379973
downvote count: 0
has comment: http://stackoverflow.com/comment/34616200
type: Answer
has comment: http://stackoverflow.com/comment/34615855
has comment: http://stackoverflow.com/comment/34616040
has comment: http://stackoverflow.com/comment/34616082
score: 3
has body: That is easy. Positive double's are ordered at bit level just the way longs are. So converting it to a long and increasing it and then back to a double does the trick: public static double nextDouble(double d) { if (d != d) return d; if (d == Double.MAX_VALUE) return Double.POSITIVE_INFINITY; if (d == Double.NEGATIVE_INFINITY) return d; if (d == Double.POSITIVE_INFINITY) return d; d += 0.0; int dir = d &lt; 0.0 ? -1 : 1; return Double.longBitsToDouble(Double.doubleToLongBits(d) + dir); } The same works for negative values. If you want to get the closest double that is bigger, then decrease the long representation. In response to the alternative Math.nextUp(), here is the source code for that method: public static double nextUp(double d) { if( isNaN(d) || d == Double.POSITIVE_INFINITY) return d; else { d += 0.0d; return Double.longBitsToDouble(Double.doubleToRawLongBits(d) + ((d &gt;= 0.0d)?+1L:-1L)); } } This is equivalent with my code, that does the extra checks for infinity.
has comment: http://stackoverflow.com/comment/83428389
has comment: http://stackoverflow.com/comment/34616949
accepted answer of: http://stackoverflow.com/q/22715536
type: AcceptedAnswer
answers question: http://stackoverflow.com/q/22715536
has comment: http://stackoverflow.com/comment/34616016
has comment: http://stackoverflow.com/comment/34617211
has comment: http://stackoverflow.com/comment/34616048
has comment: http://stackoverflow.com/comment/34615990
upvote count: 3
has comment: http://stackoverflow.com/comment/34615996
has comment: http://stackoverflow.com/comment/34616390

http://stackoverflow.com/q/22787406
has comment: http://stackoverflow.com/comment/47657969
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/49229650
answer count: 0
upvote count: 3
tagged with: java
tagged with: javafx
tagged with: multithreading
tagged with: swing
type: Question
score: 3
downvote count: 0
has body: I am running a JavaFX application in which I have created a SwingNode in order to load a graph that I created using the Jung visualisation. I place a GraphZoomScrollPane into a SwingNode and then load this SwingNode into a FlowPane. This does work however there is sometimes quite a long delay before it appears on the page and it sometimes affects the other content loading (i.e. the other content will turn black for a while and then reload). And sometimes I get a thread Exception which states its not running on the FX application thread but when I clean the project this goes away. Below is the code where I create the SwingNode and place it in the FlowPane. final SwingNode swingNode = new SwingNode(); createAndSetSwingContent(swingNode, test); graphPane.getChildren().add(swingNode); private void createAndSetSwingContent(final SwingNode swingNode, final ArrayList&lt;String&gt; wordList) { SwingUtilities.invokeLater(new Runnable() { @Override public void run() { try { swingNode.setContent(new WordNetGraphs().WordNetGroupGraphs(wordList)); } catch (JWNLException ex) { Logger.getLogger(WordNetPairPageController.class.getName()).log(Level.SEVERE, null, ex); } } }); } If anyone knows of a better way of doing this I would be very grateful.
favorite count: 0
has title: Threading issues in JavaFX

http://stackoverflow.com/q/22679594
answer count: 2
downvote count: 1
favorite count: 0
possible better answer: http://stackoverflow.com/a/22698597
has answer: http://stackoverflow.com/a/22698597
tagged with: hsqldb
has body: I am using hsqldb 2.3.2 in server memory mode. I am experiencing a situation where I insert some information to hsqldb and the heap space used (even after GC) by HSQLDB is about 3 to 4 larger than if I kept it in a plain HashMap/LinkedList in java heap. Here is code that inserts multiple records into a in-memory hsqldb server: Connection c = DriverManager.getConnection("jdbc:hsqldb:hsql://localhost","sa",""); c.setAutoCommit(false); PreparedStatement ps = c.prepareStatement("set database sql syntax ora true"); ps.execute(); ps.close(); ps = c.prepareStatement("create table t (x long)"); ps.execute(); ps.close(); c.close(); String x = "insert into t values(?)"; c = DriverManager.getConnection("jdbc:hsqldb:hsql://localhost","sa",""); c.setAutoCommit(false); ps = c.prepareStatement(x); for(int i=0;i&lt;1000*1000*10000;i++){ long z = new Random().nextLong(); ps.setLong(1, z); ps.addBatch(); if(i%1000==0){ ps.executeBatch(); ps.clearParameters(); ps.clearBatch(); ps.close(); ps = null; ps = c.prepareStatement(x); } c.commit(); c.close(); if(i%100000 == 0){ System.out.println(i);//print number of rows inserted c.commit(); c.close(); c = DriverManager.getConnection("jdbc:hsqldb:hsql://localhost","sa",""); c.setAutoCommit(false); ps = c.prepareStatement(x); } } I track the server HSQLDB process using JVisutalVM and I run the code above up until a OutOfMemory occurrs I tried different heap sizes &amp; I stopped the code above - what is disturbing is I always see that I have inserted about 13,800,000 rows - in server with 3GB available heap - and the heap is full after terminating the code above and performing GC 0 the heap takes 2500MB - which means that every row takes up about 180 bytes - a single long takes 8 bytes - so that is 22 time more heavier. This is of course only a test and real tables don't usually have only one field - but the reason I explored this was that when I try to copy 1GB of memory from oracle to HSQLDB - in HSQLDB it ends up holding 4GB! (The table st…
type: AnsweredQuestion
has title: Hsqldb - memory overuse?
score: 1
type: Question
has answer: http://stackoverflow.com/a/22734117
accepted answer: http://stackoverflow.com/a/22734117
tagged with: java
tagged with: h2
upvote count: 2

http://stackoverflow.com/q/22799407
has answer: http://stackoverflow.com/a/73900191
tagged with: dependency-injection
score: 26
tagged with: assisted-inject
tagged with: dagger
has answer: http://stackoverflow.com/a/53719372
downvote count: 0
possible better answer: http://stackoverflow.com/a/55597444
favorite count: 0
has title: Looking for an example for Dagger assisted injection
accepted answer: http://stackoverflow.com/a/22801097
has body: From dagger-discuss@: I have a class that gets some dependencies from the object graph, and other dependencies from a caller at runtime. public class ImageDownloader { // Get these dependencies from the injector. private final HttpClient httpClient; private final ExecutorService executorService; // Get these from the caller. private final URL imageUrl; private final ImageCallback callback; ... } I came up with a solution, where I define a Factory, public class ImageDownloader { ... public static class Factory { private final HttpClient httpClient; private final ExecutorService executorService; @Inject public Factory(HttpClient httpClient, ExecutorService executorService) { this.httpclient = httpClient; this.executorService = executorService; } public ImageDownloader create(URL imageUrl, ImageCallback callback) { return new ImageDownloader(httpClient, executorService, iamgeUrl, callback); } } ... } Now, instead of injecting ImageDownloader in the client's constructor, I simply inject ImageDownloader.Factory and call its create() method. As you can see, that's quite verbose and long. It also has a bunch of duplication and boilerplate. There're some obstacles to annotating the fields themselves with @Inject, so let's ignore this possibility for now. The Square people have come up with an interesting solution, using providers. Define a Factory interface, public class ImageDownloader { ... public interface Factory { ImageDownloader create(URL imageUrl, ImageCallback callback); } } and then provide it in a module, public class ImageModule { ... @Provides public ImageModule.Factory provideImageModuleFactory( final Provider&lt;HttpClient&gt; httpClientProvider, final Provider&lt;ExecutorService&gt; executorServiceProvider) { return new ImageDownloader.Factory() { public ImageDownloader create(URL imageUrl, ImageCallback callback) { return new ImageDownloader(httpClientProvider.get(), executorServiceProvider.get(), imageUrl, callback); } } ... } (again, from dagger-discuss@)…
linked to: http://stackoverflow.com/q/29175014
answer count: 4
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/22801097
tagged with: java
upvote count: 26
has answer: http://stackoverflow.com/a/55597444
type: Question

http://stackoverflow.com/a/22759866
has comment: http://stackoverflow.com/comment/34695629
has body: You should put your bundles in the standard location: src/main/resources If you follow this convention, your messageSource bean should be defined like this: <property name="basename" value="message" /> With message_en_GB.properties in the same folder as your spring.xml.
score: 2
downvote count: 0
upvote count: 2
answers question: http://stackoverflow.com/q/22759594
type: Answer

http://stackoverflow.com/comment/34500334
score: 0
type: AnswerComment
has text: @lilz4life [example](http://stackoverflow.com/questions/17477891/how-do-i-use-cardlayout-for-my-java-program-for-login-and-menu-items/17479575#17479575)
comment on: http://stackoverflow.com/a/22650926
type: Comment

jasper-reports
tags question: http://stackoverflow.com/q/22724675
tags question: http://stackoverflow.com/q/22732656
tags question: http://stackoverflow.com/q/22705663
tags question: http://stackoverflow.com/q/22778593
tag name: jasper-reports
tags question: http://stackoverflow.com/q/22762910
tags question: http://stackoverflow.com/q/22664360
type: Tag
tags question: http://stackoverflow.com/q/22660173

http://stackoverflow.com/comment/34651239
has text: Put your classes in packages. Never in the default package. The try again, and check the tomcat logs. And while you're at it, respect the Java naming conventions: classes start with an uppercase letter.
comment on: http://stackoverflow.com/q/22735014
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/a/22771530
type: Answer
accepted answer of: http://stackoverflow.com/q/22771179
score: 2
downvote count: 0
answers question: http://stackoverflow.com/q/22771179
upvote count: 2
type: AcceptedAnswer
has body: As suggested by others, consider using ProcessBuilder. Code: ProcessBuilder processBuilder = new ProcessBuilder("cmd.exe", "/C", "start"); processBuilder.directory(new File("C:\\")); try { processBuilder.start(); } catch (IOException e) { e.printStackTrace(); }

http://stackoverflow.com/comment/34615855
has text: While clever, that has a very nasty boundary case. However, a few masks and tests and it will work. -1 becomes +1 if you take the time to show those.
type: Comment
comment on: http://stackoverflow.com/a/22715686
score: 0
type: AnswerComment

http://stackoverflow.com/comment/34680145
has text: Let's see your controller.
comment on: http://stackoverflow.com/q/22751356
type: Comment
type: QuestionComment
score: 0

http://stackoverflow.com/q/22685422
tagged with: casting
has body: Is there any way to do a kind of static cast between an int[] and byte[] ? What i want is just to get a reference to the int[] as a byte[] without making any numeric conversions between them and, if it is possible, without having to make a copy.
tagged with: arrays
accepted answer: http://stackoverflow.com/a/22685540
has answer: http://stackoverflow.com/a/22685513
score: 0
answer count: 3
has title: Java casting int[] to byte[] without conversions
possible better answer: http://stackoverflow.com/a/22685511
has answer: http://stackoverflow.com/a/22685511
has answer: http://stackoverflow.com/a/22685540
type: AnsweredQuestion
tagged with: java
type: Question

http://stackoverflow.com/comment/38370513
comment on: http://stackoverflow.com/q/22786968
has text: @littleLouito I actually lucked out and got the source generating these files to provide a `.csv` version instead which I had already written a convertor into `POI` for.
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/a/22684919
has body: JavaParser does not resolve imports (this isn't usually considered its job, anyway). You have to manually step through the import statements and search if the Keyword belongs to them. Keep in mind that Java implicitly does a import java.lang.*, otherwise you won't resolve types such as String. Spring Roo has a JavaParserUtils class containing a method getJavaType(CompilationUnitServices compilationUnitServices, ClassOrInterfaceDeclaration cid). The class is not designed for usage outside of Roo, but you can use as a template for solving your problem.
answers question: http://stackoverflow.com/q/22684264
score: 0
type: Answer

http://stackoverflow.com/comment/34643666
score: 2
has text: @skiwi: I disagree in that it is a valid question that requires programming technique to solve. The key is not to rely on the hardware-specific key press frequency, to use a Swing Timer to create your own frequency.
comment on: http://stackoverflow.com/q/22730715
type: QuestionComment
type: Comment

http://stackoverflow.com/comment/34680241
score: 0
type: Comment
has text: Also, what have you tried for testing a `List` returned object?
type: QuestionComment
comment on: http://stackoverflow.com/q/22751356

manifest
tags question: http://stackoverflow.com/q/22773390
tag name: manifest
type: Tag
tags question: http://stackoverflow.com/q/22755238

http://stackoverflow.com/comment/34680387
comment on: http://stackoverflow.com/a/22751446
type: Comment
has text: @user3479350 Yes that would explain that error, as `nextInt()` also just consumes the int but leaves the line ending, then `nextLine()` reads an empty string (the remainder of the line) of length 0, then `.charAt(0)` is consequently out of range. Incidentally, you probably also want to check to make sure the string has at least one character in it before attempting to access `.charAt(0)`; even after you fix your issues, you don't want it to crash if the user just types "enter" without entering anything.
type: AnswerComment
score: 0

http://stackoverflow.com/q/22707670
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/34604343
tagged with: adb
has body: I have a problem with the adb. I have the adb drivers installed and even in the device manager my phone is shown when connected. But when I want to use my phone to test my apps via USB Debugging it doesn't work (USB debugging is activated). I also used the command prompt to execute "adb devices" but no devices are shown.
has comment: http://stackoverflow.com/comment/34601961
has comment: http://stackoverflow.com/comment/34601480
score: 1
tagged with: java
has comment: http://stackoverflow.com/comment/34604233
tagged with: eclipse
type: Question
has title: ADB doesn't work...Eclipse doesn't detect my device
has comment: http://stackoverflow.com/comment/34601377
downvote count: 0
has answer: http://stackoverflow.com/a/22707768
answer count: 2
upvote count: 1
tagged with: android
has comment: http://stackoverflow.com/comment/34601477
has comment: http://stackoverflow.com/comment/34601438
has answer: http://stackoverflow.com/a/22708316
favorite count: 0
tagged with: driver

http://stackoverflow.com/comment/34755700
score: 2
comment on: http://stackoverflow.com/q/22793444
has text: web-socket or ajax polling is the answer
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/34696586
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/22760565
has text: Yes, and what is the question/problem?
score: 1

http://stackoverflow.com/a/22800584
answers question: http://stackoverflow.com/q/22800422
upvote count: 2
type: Answer
score: 2
downvote count: 0
has body: Change your: age = input.nextInt(); To a: age = Integer.parseInt(input.nextLine()); The reason "nextInt()" doesn't work correctly is because it leaves an empty space in the queue that gets picked out at the next "nextLine()" Also you should always use .equals("some string") when comparing two strings. I hope this fixes your bug :) Also as "Hovercraft Full Of Eels" pointed out if you do need to repeat the while loop, the scanner will be closed and therefore will cause an error.

http://stackoverflow.com/comment/34564241
comment on: http://stackoverflow.com/q/22684783
has text: NEVER do a set[collectionname] on a managed entity, that is trouble bound to happen. You shouldn't allow your collections to be externally modifiable. Why aren't you just saving (merging) the passed in `UserEntity`?
score: 0
type: QuestionComment
type: Comment

http://stackoverflow.com/comment/50382510
score: 13
comment on: http://stackoverflow.com/q/22725537
has text: The funny thing is that JDK-8050820 actually refers to this question in its description!
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/34740285
type: Comment
score: 1
comment on: http://stackoverflow.com/a/22784738
type: AnswerComment
has text: @Duncan: Thanks, added that as a comment for something to consider.

http://stackoverflow.com/comment/34639177
type: Comment
comment on: http://stackoverflow.com/a/22713031
score: 0
type: AnswerComment
has text: Please do see the main question thread for the clarification. Due to the comment restriction in size i cant able to give you the clarification here. I edited my main question there. Thank you

http://stackoverflow.com/comment/34761118
type: QuestionComment
score: 2
has text: `int posComma = line.indexOf(',', posSemi); String check = line.substring(posComma+1);` What if you enter `abc,d,`
comment on: http://stackoverflow.com/q/22796385
type: Comment

spring-test-dbunit
type: Tag
tag name: spring-test-dbunit
tags question: http://stackoverflow.com/q/22796147

http://stackoverflow.com/comment/137910213
type: AnswerComment
has text: Filter the cookie and set it in a variable for further access
score: 0
comment on: http://stackoverflow.com/a/22804563
type: Comment

http://stackoverflow.com/comment/34521672
type: QuestionComment
comment on: http://stackoverflow.com/q/22663387
has text: yes definitely index is 0 based but i want to get third and fifth column values that can i tried but they can access fourth column i need third column
score: 0
type: Comment

http://stackoverflow.com/q/22770123
tagged with: eclipse
tagged with: grails
tagged with: groovy
has comment: http://stackoverflow.com/comment/37017823
downvote count: 0
favorite count: 0
type: UnansweredQuestion
tagged with: code-formatting
has body: I'm attempting to configure version 3.4.0 of the Eclipse-based Groovy/Grails Tool Suite (GGTS) to format both Java and Groovy code. From what I've read, it seems that Groovy inherits almost all of the rules from the configured Java formatter. I've configured a project-specific formatter for Java code via Preferences -> Java -> Code Style -> Formatter -> Configure Project Specific Settings. When I open any .java files in my Grails project and press CTRL+SHIFT+F, the code is formatted beautifully. When I open any .groovy files in my Grails project (from either src/groovy or grails-app) and press CTRL+SHIFT+F, very little happens. GGTS seems to remove unnecessary semicolons and trailing whitespace, but does not appear to make any substantial formatting changes (e.g. whitespace around parentheses and braces, newline rules around braces, etc.). Am I fundamentally misunderstanding the Groovy formatting in GGTS? Does it need to be invoked via some other method other than the aforementioned keyboard shortcut? Any suggestions would be greatly appreciated. For what it's worth, my GGTS environment is a clean installation--no additional plugins, custom editors, etc.
score: 3
answer count: 0
upvote count: 3
tagged with: java
has title: How can I configure GGTS to format Groovy code based on project formatters?
type: Question
has comment: http://stackoverflow.com/comment/37033432
has comment: http://stackoverflow.com/comment/34716616

http://stackoverflow.com/a/22709294
upvote count: 1
type: Answer
has body: You could manually add your own version of RequestMappingHandlerMapping to your application context and set its patternMatcher property using setPathMatcher(PathMatcher pathMatcher) with your own implementation that will correct the issue you're having.
downvote count: 0
score: 1
has comment: http://stackoverflow.com/comment/34788638
answers question: http://stackoverflow.com/q/22707136
has comment: http://stackoverflow.com/comment/34792321

http://stackoverflow.com/comment/34540961
type: Comment
comment on: http://stackoverflow.com/a/22673800
has text: hmm...but...sry, i don't understand at all :) I will try to create something like tail (now i have hadtail as one element. Logic from the middle of your post (Element lista1tail = lista1.getElement(lista1.size() - 1); lista1tail.next = lista2.head; lista2.head.previous = lista1tail;) don't work. It runs infinitely showing null,null,null...
score: 0
type: AnswerComment

http://stackoverflow.com/a/22759400
upvote count: 1
has body: Threads Are Started With Thread.Start() And Look on Thread Life Cycle
answers question: http://stackoverflow.com/q/22759281
downvote count: 0
type: Answer
score: 1

http://stackoverflow.com/comment/34705013
score: 0
has text: You could add a condition like this in your while : while(!mouseReleased)
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/22765071

http://stackoverflow.com/comment/34505384
has text: myserver2 can't be resolved. Does it need to be in /etc/hosts?
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/22654128
score: 0

http://stackoverflow.com/q/22709240
downvote count: 1
type: Question
tagged with: apache
has comment: http://stackoverflow.com/comment/34605146
answer count: 1
has comment: http://stackoverflow.com/comment/34604405
has answer: http://stackoverflow.com/a/22709434
linked to: http://stackoverflow.com/q/21480634
favorite count: 0
tagged with: android-asynctask
has title: Extracting data from Json object by http GET
has body: I am working on android app and I want to know how to get data from Json object by using http GET the (the http request url is APIary) It's my first time to use Json and httpRequests so I don't know the syntax needed for this That's my HttpRequest class I'm using : public abstract class HttpRequest extends AsyncTask&lt;String, String, String&gt; { private HttpClient httpClient; private HttpRequestBase request; private boolean hasError = false; private String errorMessage = null; private boolean hasBody = false; private int statusCode; public HttpRequest(){ httpClient = new DefaultHttpClient(); } /** * This method is called from the subclasses to pass the request method used to this class * @param request , The request class passed from the subclass */ void setMethod(HttpRequestBase request){ this.request = request; } /** * Adds a header to the current request * @param header , header key * @param value , header value */ public void addHeader(String header,String value){ this.request.addHeader(header, value); } /** * @return false if the status code was anything other than 2XX after executing the request , true otherwise */ public boolean hasError() { return hasError; } /** * A getter for the error message * @return String the error message returned from the request if any */ public String getErrorMessage() { return errorMessage; } /** * This is the method responsible for executing the request and handling the response * @return String , The response body , null in case of errors */ @Override protected String doInBackground(String... args) { if(hasBody){ this.request.addHeader("content-type", "application/json"); } ResponseHandler&lt;String&gt; handler = new BasicResponseHandler(); HttpResponse x = null; try{ x = httpClient.execute(this.request); this.statusCode = x.getStatusLine().getStatusCode(); return handler.handleResponse(x); }catch(ClientProtocolException e ){ hasError = true; errorMessage = e.getMessage(); return null; } catch (IOException e) { e.printStackTr…
tagged with: android
type: AnsweredQuestion
score: 0
tagged with: java
tagged with: http://stackoverflow.com/tag/json
accepted answer: http://stackoverflow.com/a/22709434
linked to: http://stackoverflow.com/q/9605913
upvote count: 1

http://stackoverflow.com/comment/72149547
type: Comment
has text: To make it parametrizable, add `int timeout();` into the annotation body and you can set it with `@SlowRequest(timeout=<whatever>)`. In the watcher, you have to query for it: `description.getAnnotation(SlowRequest.class).timeout()`.
score: 1
comment on: http://stackoverflow.com/a/35039655
type: AnswerComment

android-actionbar
type: Tag
tags question: http://stackoverflow.com/q/22702967
tags question: http://stackoverflow.com/q/22677146
tags question: http://stackoverflow.com/q/22660907
tags question: http://stackoverflow.com/q/22665571
tag name: android-actionbar
tags question: http://stackoverflow.com/q/22791027

http://stackoverflow.com/q/22761356
type: UnansweredQuestion
has body: This article describes problems and solution how to use GWT and Hibernate together. I just wonder whether there are newer ways to implement the example from the article, because it is from 2009? Or are there other ORM avaible which works better with GWT?
score: 2
answer count: 0
upvote count: 2
tagged with: java
tagged with: hibernate
tagged with: orm
has title: How to use GWT and ORM together
type: Question
tagged with: gwt
tagged with: database
downvote count: 0
favorite count: 0

http://stackoverflow.com/a/67545878
has body: java.time The legacy date-time API (java.util date-time types and their formatting type, SimpleDateFormat) is outdated and error-prone. It is recommended to stop using it completely and switch to java.time, the modern date-time API*. Solution using the modern API: import java.time.DayOfWeek; import java.time.LocalDate; import java.time.ZoneId; import java.time.format.TextStyle; import java.util.Locale; public class Main { public static void main(String[] args) { // To use JVM's timezone, simply remove the argument or use // ZoneId.systemDefault() as the argument LocalDate date = LocalDate.now(ZoneId.of("America/New_York")); // As enum DayOfWeek dw = date.getDayOfWeek(); System.out.println(dw); // Value System.out.println(dw.ordinal()); // Ordinal // As String String dayName = dw.getDisplayName(TextStyle.FULL, Locale.ENGLISH); System.out.println(dayName); // As int int day = dw.getValue(); System.out.println(day); } } Output: SATURDAY 5 Saturday 6 Learn more about the modern date-time API* from Trail: Date Time. * For any reason, if you have to stick to Java 6 or Java 7, you can use ThreeTen-Backport which backports most of the java.time functionality to Java 6 & 7. If you are working for an Android project and your Android API level is still not compliant with Java-8, check Java 8+ APIs available through desugaring and How to use ThreeTenABP in Android Project.
score: 1
answers question: http://stackoverflow.com/q/22763370
downvote count: 0
type: Answer
upvote count: 1

http://stackoverflow.com/comment/34761330
comment on: http://stackoverflow.com/q/22796419
has text: Did you try changing your context to AlertDialog.Builder PUHelpBuilder = new AlertDialog.Builder(getActivity())?
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/34737033
type: QuestionComment
comment on: http://stackoverflow.com/q/22783010
score: 0
type: Comment
has text: And keep in mind that the name "nanoTime" is deceptive. Depending on your operating system it will give different precision between several tens to several hundreds of nanoseconds.

http://stackoverflow.com/a/22708849
type: Answer
has comment: http://stackoverflow.com/comment/34604270
upvote count: 1
has body: replace your for loop with below, for (heightCounter = 0; heightCounter &lt; height; heightCounter++) { for (widthCounter = 0; widthCounter &lt; width; widthCounter++) { if (heightCounter == 0 || heightCounter == height - 1) System.out.print(builder); else if (widthCounter &gt;= 1 &amp;&amp; widthCounter &lt; width - 1) //Use widthCounter instead of heightCounter here System.out.print(" "); else System.out.print(builder); } System.out.println(); }
score: 1
accepted answer of: http://stackoverflow.com/q/22708617
type: AcceptedAnswer
downvote count: 0
answers question: http://stackoverflow.com/q/22708617

http://stackoverflow.com/q/22721844
type: Question
has answer: http://stackoverflow.com/a/22721891
has body: I am making a game in the jMonkey Engine 3 and my world generation code was a bit bulky so I planned to move it to a new class called Generator but when I finally got everything worked out and ran my program, I got a NullPointerException in the place where I tried to use the method from the other class. I have had such bad luck with NullPointerException in the past but this is the worst one yet. The code worked when it was in the main class file. I will give you the code for both classes below as well as the error. Please note that I am not including the package declaration or the imports to save space. Class one: Main: public class Main extends SimpleApplication implements ActionListener { private static final Logger logger = Logger.getLogger(Main.class.getName()); private BulletAppState bulletAppState; private CharacterControl playerControl; private Vector3f walkDirection = new Vector3f(); private boolean[] arrowKeys = new boolean[4]; private CubesSettings cubesSettings; private BlockTerrainControl blockTerrain; private Node terrainNode = new Node(); private Generator gen; public static void main(String[] args){ Logger.getLogger("").setLevel(Level.FINE); AppSettings s = new AppSettings(true); Main app = new Main(); try { s.load("com.bminus"); } catch(BackingStoreException e) { logger.log(Level.SEVERE, "Could not load configuration settings.",e); } try { s.setIcons(new BufferedImage[]{ImageIO.read(new File("assets/Textures/icon.gif"))}); } catch (IOException e) { Logger.getLogger(Main.class.getName()).log(Level.SEVERE, "Icon file missing",e); } s.setRenderer(AppSettings.LWJGL_OPENGL2); s.setBitsPerPixel(24); s.setFrameRate(-1); s.setFullscreen(false); s.setResolution(640,480); s.setSamples(0); s.setVSync(true); s.setFrequency(60); s.setTitle("The Third Power Pre-Alpha 1.1.0"); try { s.save("com.bminus"); } catch(BackingStoreException e) { logger.log(Level.SEVERE, "Could not save configuration settings.",e); } app.setShowSettings(false); app.setSettings(s); app.star…
has comment: http://stackoverflow.com/comment/34730341
tagged with: nullpointerexception
downvote count: 0
answer count: 1
tagged with: jmonkeyengine
favorite count: 0
accepted answer: http://stackoverflow.com/a/22721891
has title: Trying to reference a method from one class to another = NullPointerException
type: AnsweredQuestion
score: 1
tagged with: java
has comment: http://stackoverflow.com/comment/34646703
upvote count: 1

http://stackoverflow.com/a/22719239
answers question: http://stackoverflow.com/q/22719126
score: 2
downvote count: 0
upvote count: 2
has body: Imagine writing null.equals(null) Would you expect it to work? This doesn't work for the same reason. As other stated, you can use reference compare (==) for this, since there is only 1 null.
type: Answer

http://stackoverflow.com/q/22783744
tagged with: email
type: AnsweredQuestion
tagged with: java
tagged with: apache-axis
has title: java string new line not working when sending with email
type: Question
has body: Let's say I want to send an email using org.apache.axis.client.Call and the body message of the mail has a format like : bodyMsg="Name:Justin\nSurname:Biber\nPosition:artist\nField1:1234\nField2:eqweq"; but when I receive the mail there is no the new line for each field. For example, I want to receive : Name:Justin Surname:Biber Position:artist Field1:1234 Field2:eqweq and I am receiving this : Name:Justin Surname:BiberPosition:artist Field1:1234 Field2:eqweq A snippet of my code is something like that : org.apache.axis.client.Call _call = createCall(); _call.setOperation(_operations[0]); _call.setUseSOAPAction(true); _call.setSOAPActionURI(""); _call.setEncodingStyle(null); _call.setProperty(org.apache.axis.client.Call.SEND_TYPE_ATTR, Boolean.FALSE); _call.setProperty(org.apache.axis.AxisEngine.PROP_DOMULTIREFS, Boolean.FALSE); _call.setSOAPVersion(org.apache.axis.soap.SOAPConstants.SOAP11_CONSTANTS); _call.setOperationName(new javax.xml.namespace.QName("http://example.com/", "createEmail")); setRequestHeaders(_call); setAttachments(_call); try { java.lang.Object _resp = _call.invoke(new java.lang.Object[] {new java.lang.Long(arg0), arg1, arg2, bodyMsg}); } catch(Exception ex) {} Any suggestion?
has comment: http://stackoverflow.com/comment/34738043
answer count: 1
score: 0
has answer: http://stackoverflow.com/a/22783835
accepted answer: http://stackoverflow.com/a/22783835

http://stackoverflow.com/comment/34580311
type: AnswerComment
has text: Not really sure. What do you have on line 47?
score: 0
type: Comment
comment on: http://stackoverflow.com/a/22648870

http://stackoverflow.com/a/23244534
has comment: http://stackoverflow.com/comment/35569724
type: Answer
upvote count: 1
downvote count: 1
has comment: http://stackoverflow.com/comment/35598131
has body: On your machine navigate to your SDK folder then \tools\templates\activities Copy the BlankActivities folder and paste it into the same directory. Rename BlankActivities_copy to EmptyActivities Go to https://android-review.googlesource.com/#/c/88890/4 Under the Files section there is a list of links. Each link directs you to the xml that needs to be added to the new EmptyActivities folder you created. Copy the xml from the right pane to the path\file at the top of the left pane(the link was also the path). If the file already exists delete the contents and replace. If the file doesn’t exist, create it and copy the xml into the file. Repeat for each of the links. Close and reopen Eclipse. If you have any of the files open in an editor Eclipse will crash. hope this will solve your problem
answers question: http://stackoverflow.com/q/22735041
score: 0

http://stackoverflow.com/q/22687648
has title: communication between java server and javascript
has comment: http://stackoverflow.com/comment/34564908
type: UnansweredQuestion
score: 1
tagged with: java
has body: I have multithreaded chatting java server which can handle number of clients (java). They can simultaneous talk with each other. They are connected through network socket. Besides their own conversation words, my purpose is to display the conversation words they do in web browser through web application. I am thinking about JavaScript but couldn't figure out how to implement javascript for web application because I will need object or data to pass to javascript side from server( java) side. Following is the multithreaded server and this works fine with multiple clients. public class GoodChatServer { ……… public static void main(String[] args) throws Exception { System.out.println("The chat server is running."); ServerSocket listener = new ServerSocket(PORT); try { …. } } finally { ….. } } private static class Handler extends Thread { ………. this.socket = socket; } public void run() { try { in = new BufferedReader(new InputStreamReader( socket.getInputStream())); out = new PrintWriter(socket.getOutputStream(), true); while (true) { out.println("SUBMITNAME"); name = in.readLine(); if (name == null) { .. } synchronized (names) { if (!names.contains(name)) { names.add(name); break; }
tagged with: web-applications
upvote count: 1
type: Question
tagged with: javascript
has comment: http://stackoverflow.com/comment/34588632
has comment: http://stackoverflow.com/comment/34576378
downvote count: 0
answer count: 1
has comment: http://stackoverflow.com/comment/34596799
favorite count: 0
has answer: http://stackoverflow.com/a/22690930
has comment: http://stackoverflow.com/comment/34570436

http://stackoverflow.com/comment/34595949
type: AnswerComment
score: 0
type: Comment
has text: @user3467373 Give me a second, I'll update the answer.
comment on: http://stackoverflow.com/a/22704133

http://stackoverflow.com/a/22726488
upvote count: 1
has comment: http://stackoverflow.com/comment/34636052
has body: The official Sun/Oracle implementation of HashMap does the following. With this statement sequence: map.put(foo1, "bar1"); map.put(foo2, "bar2"); If foo2 and foo1 have the same hashCode(), and either (foo2 == foo1) or (foo2.equals(foo1)) then: the existing key (foo1) will be retained, but its mapped value will be changed to "bar2" Aside: (foo2 == foo1) does not imply (foo2.equals(foo1)), because not all equals() implementations perform the '==' test -- even though they should. Also, (foo2.equals(foo1)) does not imply (foo1.equals(foo2))!
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/34636070
type: Answer
score: 1
answers question: http://stackoverflow.com/q/22726220
accepted answer of: http://stackoverflow.com/q/22726220

http://stackoverflow.com/q/22656157
has title: determine file type/extension of uploaded file in java
type: Question
has answer: http://stackoverflow.com/a/22656273
score: 0
has answer: http://stackoverflow.com/a/22678574
has answer: http://stackoverflow.com/a/22656333
has body: i am trying to figure out a way to determine the file type of a file which i upload in my struts2 application. my application can read CSV and XML files and perform operations depending on what type of file was uploaded. i am taking the file as an instance of "File" class. the file is never copied onto the system. i want to know how to determine the type/content of the uploaded file. i tried the following piece of code to see if i get the file type: String extension = FilenameUtils.getExtension(file.getAbsolutePath); logging extension gave me the extension as "tmp". what can i do to get the file extension?
has answer: http://stackoverflow.com/a/22656399
has answer: http://stackoverflow.com/a/22656232
answer count: 5
type: UnansweredQuestion
tagged with: java

http://stackoverflow.com/comment/34574488
has text: 1) Format your code. 2) Don't you think it would help to tell us what the errors are, or are we just supposed to guess?
type: Comment
type: QuestionComment
score: 3
comment on: http://stackoverflow.com/q/22692912

http://stackoverflow.com/a/47550115
type: Answer
answers question: http://stackoverflow.com/q/22738161
has body: you should add Jdbc driver jar file to the jdbc connector in mule manually and then run it.Also you can make sure to test the connection is successful or not by using TestConnection option there.
score: 0

http://stackoverflow.com/comment/34807074
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/22784502
has text: Do you use the old libgdx project structure or the new one with gradle? If you have a `build.gradle` file, run `gradle dist` and there should be a jar file in `project/desktop/build/libs` if the build succeeded.
score: 0

http://stackoverflow.com/comment/34562455
type: Comment
score: 0
comment on: http://stackoverflow.com/q/22686586
has text: `CurryBiConsumer` needs to be a functional interface
type: QuestionComment

http://stackoverflow.com/a/22761171
has comment: http://stackoverflow.com/comment/34740266
has comment: http://stackoverflow.com/comment/34739533
has comment: http://stackoverflow.com/comment/34739858
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/34739710
has comment: http://stackoverflow.com/comment/34706048
has comment: http://stackoverflow.com/comment/34746261
has comment: http://stackoverflow.com/comment/34745510
accepted answer of: http://stackoverflow.com/q/22760985
type: Answer
has comment: http://stackoverflow.com/comment/34746380
score: 2
answers question: http://stackoverflow.com/q/22760985
has comment: http://stackoverflow.com/comment/34745326
upvote count: 2
has comment: http://stackoverflow.com/comment/34740337
has body: You need to define another bean like so: @Service(value="myServiceDefault") public class MyServiceImpl implements MyService{ .. } Then change your initial code for the test profile to: @Service(value="myService") @Profile("test") @Primary public class MyServiceImpl implements MyService{ ... } What this does is register an implementation for all profiles to use and then when the test profile is active is uses the other implementation because of the @Primary annotation If you are using Spring 4 you could come up with even more elaborate configuration strategies using the @Conditional annotation
has comment: http://stackoverflow.com/comment/34704712

http://stackoverflow.com/q/22658385
type: Question
has comment: http://stackoverflow.com/comment/34512995
has answer: http://stackoverflow.com/a/22726104
has comment: http://stackoverflow.com/comment/34512757
tagged with: java
has comment: http://stackoverflow.com/comment/34513055
score: 5
has comment: http://stackoverflow.com/comment/34512986
linked to: http://stackoverflow.com/q/113511
linked to: http://stackoverflow.com/q/13387742
downvote count: 0
favorite count: 0
linked to: http://stackoverflow.com/q/16069106
answer count: 9
upvote count: 5
has answer: http://stackoverflow.com/a/22658497
has answer: http://stackoverflow.com/a/22658475
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/22660787
has body: I have a School class: public class School { private String name; private int id; private boolean isOpen; public String getName() { return name; } public void setName(String name) { this.name = name; } public int getId() { return id; } public void setId(int id) { this.id = id; } public boolean isOpen() { return isOpen; } public void setOpen(boolean isOpen) { this.isOpen = isOpen; } } Then I created two instances of School, and compare the equality of the two instances: public static void main(String[] args) { //school1 School school1 = new School(); school1.setId(1); school1.setName("schoolOne"); //school2 School school2 = new School(); school2.setId(1); school2.setName("schoolOne"); //result is false , why? System.out.println("school1 == school2 ? " + school1.equals(school2)); } Even though I set the same id and name to school1 &amp; school2 instances, but school1.equals(school2) returns false, why?
has answer: http://stackoverflow.com/a/22658493
has title: Why this two simple objects are not equal?
has answer: http://stackoverflow.com/a/22658554
has answer: http://stackoverflow.com/a/22658796
has answer: http://stackoverflow.com/a/22658412
has answer: http://stackoverflow.com/a/22658407

http://stackoverflow.com/a/22684691
has comment: http://stackoverflow.com/comment/34560430
type: Answer
has comment: http://stackoverflow.com/comment/34559382
score: 0
has body: Do you mean something like this: File: patterns tucky* Fried Chi* Unix Apple Nikon File: words Kentucky Fried Chicken Nikon Then searching like this: grep -f patterns words Kentucky Fried Chicken Nikon Or with -o grep -o -f patterns words tucky Fried Chi Nikon
answers question: http://stackoverflow.com/q/22684339

http://stackoverflow.com/q/22704650
has answer: http://stackoverflow.com/a/22757939
has answer: http://stackoverflow.com/a/22704682
accepted answer: http://stackoverflow.com/a/22757939
score: 0
tagged with: linux
answer count: 2
tagged with: file-io
tagged with: file-upload
tagged with: openshift
type: AnsweredQuestion
has title: Uploading Image path in Linux Hosting Server (Java)
tagged with: java
has body: I am working on an application in which users are allowed to upload Image files. I am follow ing the approach of saving the file in a directory and saving its name in database for retrieval. inputStream = file.getInputStream(); BufferedImage imBuff = ImageIO.read(inputStream); imBuff = Scalr.resize(imBuff, 200); File dir = new File("/opt/uploads/contactImages"); if(!dir.exists()){ dir.mkdirs(); } ImageIO.write(imBuff, "png", new File("/opt/uploads/contactImages")); Hence with the above code my files are getting uploaded in opt/uploads/contactImages folder and is working fine in my local environment. But in production I have hosted my war on openshift server. The images are not getting created there, may be because I dont have the root access to create such directory? What should be the possible approach to solve this issue?
possible better answer: http://stackoverflow.com/a/22704682
type: Question

http://stackoverflow.com/comment/45458045
comment on: http://stackoverflow.com/a/22739407
type: Comment
has text: @HovercraftFullOfEels (shrugs) ..Go figure. ;)
score: 1
type: AnswerComment

http://stackoverflow.com/q/22691422
answer count: 1
has answer: http://stackoverflow.com/a/22692123
favorite count: 0
has comment: http://stackoverflow.com/comment/34572062
has comment: http://stackoverflow.com/comment/34571966
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/34572349
downvote count: 0
score: 1
tagged with: java
has body: I need to create the JMenu which should have: The submenu items The checkbox. Like this: Is there any easy way to create it or I have to learn the core first merge the JCheckBoxMenuItem and JMenu classes? PS: Yes, I know that I can try it myself and I'll create it after ~2 days of coding. I've just asked for the easy way or the turnkey solution.
tagged with: swing
tagged with: jmenu
has comment: http://stackoverflow.com/comment/34572130
has title: JMenu with checkbox and submenu
type: Question
has comment: http://stackoverflow.com/comment/34572237
has comment: http://stackoverflow.com/comment/34571846
accepted answer: http://stackoverflow.com/a/22692123
upvote count: 1

http://stackoverflow.com/comment/34586418
comment on: http://stackoverflow.com/q/22699122
has text: @MadProgrammer One thing at a time :) Lets not confuse OP with regex yet. It seems (s)he started to learn Java recently.
type: Comment
score: 0
type: QuestionComment

http://stackoverflow.com/a/22683176
answers question: http://stackoverflow.com/q/22682979
type: Answer
has body: Try that
score: 0

actionlistener
tags question: http://stackoverflow.com/q/22805415
tags question: http://stackoverflow.com/q/22746280
tags question: http://stackoverflow.com/q/22750372
tags question: http://stackoverflow.com/q/22729510
tags question: http://stackoverflow.com/q/22777952
tags question: http://stackoverflow.com/q/22748547
tags question: http://stackoverflow.com/q/22698698
tags question: http://stackoverflow.com/q/22683155
tags question: http://stackoverflow.com/q/22668701
tags question: http://stackoverflow.com/q/22683800
tags question: http://stackoverflow.com/q/22766001
tags question: http://stackoverflow.com/q/22743652
tags question: http://stackoverflow.com/q/22650694
tags question: http://stackoverflow.com/q/22735671
tags question: http://stackoverflow.com/q/22710570
tags question: http://stackoverflow.com/q/22696976
tags question: http://stackoverflow.com/q/22649706
type: Tag
tag name: actionlistener
tags question: http://stackoverflow.com/q/22648359
tags question: http://stackoverflow.com/q/22793619
tags question: http://stackoverflow.com/q/22712655

http://stackoverflow.com/a/22772059
has body: Actually you're making it really hard For booble sort: Also I guess you're making it very difficult, you can sort them and print them like this: ... for(int i = 0; i &lt; (names.length - 1); i++){ for(int j = i; j &lt; (names.length - 1); j++){ if(names[j].compareToIgnoreCase(names[i]) &gt; 0){ String aux = names[i]; names[i] = names[j]; names[j] = aux; } } } for(int i = 0; i &lt; names.length; i++){ System.out.println(names[i]); } for(int i = 0; i &lt; (names.length - 1); i++){ for(int j = i; j &lt; (names.length - 1); j++){ if(names[j].compareToIgnoreCase(names[i]) &lt; 0){ String aux = names[i]; names[i] = names[j]; names[j] = aux; } } } for(int i = 0; i &lt; names.length; i++){ System.out.println(names[i]); } ... Hope this helps
type: Answer
answers question: http://stackoverflow.com/q/22771981
score: 0

http://stackoverflow.com/comment/34750009
score: 0
type: QuestionComment
comment on: http://stackoverflow.com/q/22790196
type: Comment
has text: It’s worth looking at the actual `students` array’s content rather than the text file. Are you aware of the fact that binary search requires a *sorted* array as its input?

http://stackoverflow.com/comment/34500043
has text: any way to remove all panels instead of individually doing it
score: 0
type: Comment
comment on: http://stackoverflow.com/a/22650921
type: AnswerComment

http://stackoverflow.com/a/22755776
score: 0
type: Answer
has body: Check below line of code and replace it. InputStream is = getAssets().open("ic_launcher.png");
answers question: http://stackoverflow.com/q/22755710

http://stackoverflow.com/comment/34703752
score: 0
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/22764232
has text: What I want is to get the line of word when having a search on the text using REGEX. Just imagine that those text above was written on XML format. So, If I want to get the "John Doe", The targeting node is Demo->Name. Something like that, but I want it on REGEX.

http://stackoverflow.com/comment/34606426
has text: @Fractaliste already exists in the db before the request?
score: 0
comment on: http://stackoverflow.com/q/22709891
type: QuestionComment
type: Comment

http://stackoverflow.com/comment/34609003
type: Comment
score: 0
comment on: http://stackoverflow.com/q/22711822
type: QuestionComment
has text: when benchmarking try running it e.g. 100000 times and meassure this.

http://stackoverflow.com/comment/34666627
score: 0
type: Comment
type: QuestionComment
has text: Split the string by spaces, parse each part to int and add them together
comment on: http://stackoverflow.com/q/22744143

http://stackoverflow.com/comment/34693681
score: 0
type: Comment
has text: Print your request and response headers, could be useful.
type: QuestionComment
comment on: http://stackoverflow.com/q/22758460

http://stackoverflow.com/a/22725953
has comment: http://stackoverflow.com/comment/34635069
has comment: http://stackoverflow.com/comment/34635103
answers question: http://stackoverflow.com/q/22725893
has comment: http://stackoverflow.com/comment/34635226
has comment: http://stackoverflow.com/comment/34635327
has comment: http://stackoverflow.com/comment/34635417
has comment: http://stackoverflow.com/comment/34635305
has comment: http://stackoverflow.com/comment/34635490
has comment: http://stackoverflow.com/comment/34635381
upvote count: 7
type: Answer
has comment: http://stackoverflow.com/comment/34635148
has body: So my understanding of an anonymous class is this: public class SomeObject { public static void main(String[] args) { ArrayList list = new ArrayList(); list.add(new SomeObject()); } } There is no anonymous class there. The class SomeObject has a name ... therefore it is not anonymous. In fact, it is just a normal (non-nested, non-inner, non-anonymous) Java class. I saw the term anonymous inner class before, but at that time, I didn't know what a regular anonymous class was. There is no such thing as a "regular anonymous class". All Java anonymous classes are "inner". As the JLS says: "An inner class is a nested class that is not explicitly or implicitly declared static. Inner classes include local (§14.3), anonymous (§15.9.5) and non-static member classes (§8.5)." So, anonymous inner classes have to do with inheritance. Anonymous inner classes do involve inheritance, but that's not what makes them "inner". See above. I meant the "list.add(I meant the "list.add(new SomeObject());". All this time, I thought the object you added to the ArrayList, was called an anonymous class since we didn't name it.);". All this time, I thought the object you added to the ArrayList, was called an anonymous class since we didn't name it. You are incorrect. An object is not a class1. The new SomeObject() is creating an object, not a class. But that's just normal. Objects / instances don't have names ... as far as the JLS is concerned. Now variables and fields have names ... but variables are not objects / instances or classes. They are bindings between a name and a slot that can hold a reference to an object (if that's what the type declaration allows). 1 - except in the case of instances of java.lang.Class ... and even then the object is not actually the class / type from a theoretical standpoint. Or is it called simply an anonymous object and I had two mixed up? Nope. Objects don't have names. All Java objects are "anonymous". It is not a useful distinction to make. (And see above whe…
has comment: http://stackoverflow.com/comment/34635767
downvote count: 0
has comment: http://stackoverflow.com/comment/34634959
score: 7

http://stackoverflow.com/comment/34658598
has text: @JigarJoshi: yes, twice!
comment on: http://stackoverflow.com/q/22739539
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/34629427
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/22722861
type: Comment
has text: Thanks, this is very close to what I want. However, hashing still seems like a workaround, when I would like to access directly by reference.

http://stackoverflow.com/a/22758557
has comment: http://stackoverflow.com/comment/34693017
type: Answer
upvote count: 1
score: 1
downvote count: 0
has body: Spring Framework and other similar projects are used to organize large projects and when used correctly can vastly simplify the architecture and reduce the co-dependency of objects within those large projects. They are generally only useful for large projects or web projects though, the gains you will get from them really don't start to kick in until you start doing more complex things.
answers question: http://stackoverflow.com/q/22758321

list
type: Tag
tags question: http://stackoverflow.com/q/22792357
tags question: http://stackoverflow.com/q/22654255
tags question: http://stackoverflow.com/q/22736539
tags question: http://stackoverflow.com/q/22741687
tags question: http://stackoverflow.com/q/22694628
tags question: http://stackoverflow.com/q/22689772
tags question: http://stackoverflow.com/q/22720300
tags question: http://stackoverflow.com/q/22757764
tags question: http://stackoverflow.com/q/22656166
tags question: http://stackoverflow.com/q/22664607
tags question: http://stackoverflow.com/q/22673633
tag name: list
tags question: http://stackoverflow.com/q/22735076
tags question: http://stackoverflow.com/q/22674805
tags question: http://stackoverflow.com/q/22674587
tags question: http://stackoverflow.com/q/22768663
tags question: http://stackoverflow.com/q/22798002
tags question: http://stackoverflow.com/q/22649050
tags question: http://stackoverflow.com/q/22666373
tags question: http://stackoverflow.com/q/22659654
tags question: http://stackoverflow.com/q/22697673
tags question: http://stackoverflow.com/q/22665070
tags question: http://stackoverflow.com/q/22739807
tags question: http://stackoverflow.com/q/22727013
tags question: http://stackoverflow.com/q/22713907
tags question: http://stackoverflow.com/q/22728929
tags question: http://stackoverflow.com/q/22651226
tags question: http://stackoverflow.com/q/22686011
tags question: http://stackoverflow.com/q/22796009

http://stackoverflow.com/a/22747993
score: 7
upvote count: 7
downvote count: 0
answers question: http://stackoverflow.com/q/22747855
has body: Bubble sort runs in quadratic time, so for each zero you add, the sorting will take 100 times as long. I would guess you can sort 10,000 numbers in the blink of an eye, but it might take a few seconds for 100,000, and therefore at least a few minutes for 1,000,000.
type: Answer

http://stackoverflow.com/q/22667872
downvote count: 0
has comment: http://stackoverflow.com/comment/34529874
has answer: http://stackoverflow.com/a/22668395
type: Question
score: 2
has answer: http://stackoverflow.com/a/22668668
type: AnsweredQuestion
tagged with: java
tagged with: contain
upvote count: 2
has comment: http://stackoverflow.com/comment/34529944
has comment: http://stackoverflow.com/comment/34530797
tagged with: arrays
tagged with: string
favorite count: 0
tagged with: element
possible better answer: http://stackoverflow.com/a/22668373
has title: See if String Contains An Element in an Array
accepted answer: http://stackoverflow.com/a/22668395
has answer: http://stackoverflow.com/a/22668373
has answer: http://stackoverflow.com/a/22668072
has body: I am trying to go through an array of Operators to see if one of the operators is located in the String. For example: String[] OPERATORS = { "&lt;", "&lt;=", ... }; String line = "a &lt;= b &lt; c "; How would I go about going through a loop that checks to see if an operator is in the string? Also, say my method found that "&lt;" is located in the string at "&lt;= " However, I am looking for the actual string " &lt;= ". How would I go about accounting for that?
answer count: 4

http://stackoverflow.com/a/22771521
score: 8
has comment: http://stackoverflow.com/comment/34716635
type: Answer
has comment: http://stackoverflow.com/comment/34717496
has comment: http://stackoverflow.com/comment/34718053
has comment: http://stackoverflow.com/comment/34716795
has comment: http://stackoverflow.com/comment/34716592
has comment: http://stackoverflow.com/comment/34716844
has comment: http://stackoverflow.com/comment/34717914
has comment: http://stackoverflow.com/comment/34716830
has comment: http://stackoverflow.com/comment/34717100
downvote count: 1
has body: TL;DR: You've already told the method what to return. The finally block happens after you've done that. Additionally, reference variables are just pointers to objects, and while the finally block can't change the reference itself, it can certainly change the object that the reference points to. Long answer: There are two things going on here: First, you've already told the method what value to return. The JLS states it fairly simply, from 14.20.2 (emphasis mine): A try statement with a finally block is executed by first executing the try block. That is, the try block executes completely before the finally block is run. Also, from 14.7: ... execution of such a return statement first evaluates the Expression. The implication is that any and all effects the try block had (including specifying the value that the method should return) are complete, and that the value to be returned has been completely evaluated and is now "set in stone", so to speak. Let's concentrate on this first. Here, we look at a slightly modified version of your primitive example. The original example you posted isn't a great example, because the initial value 10 of the integer plus the 10 in the finally block also happens to equal 20, which clouds what is truly happening. So let's consider this instead: protected int setOne(){ int value = 5; try{ value = 20; return value; }finally{ value = value + 10; } } The return of this method is 20. Not 15, not 30, but 20. Why? Because in the try block, you set value = 20, then you tell the method to return 20; value is evaluated in the return statement, and its value at that time is 20. Nothing the finally block does can change the fact that you've already told the method to return 20. Ok, easy. Now the second thing that is happening, in your other examples, is that reference variables point to objects. That is, they are essentially primitive integer variables that hold the memory address of an object. They follow the same rules as primitive types above! Bef…
upvote count: 9
answers question: http://stackoverflow.com/q/22771471
has comment: http://stackoverflow.com/comment/34716674
has comment: http://stackoverflow.com/comment/34716720
has comment: http://stackoverflow.com/comment/34716602

http://stackoverflow.com/comment/34588999
score: 0
type: Comment
type: QuestionComment
has text: This may be NetBean's problem. Have you tried clean and re-build the project? Restarting NetBeans?
comment on: http://stackoverflow.com/q/22700642

browser
tags question: http://stackoverflow.com/q/22728231
tags question: http://stackoverflow.com/q/22765387
tags question: http://stackoverflow.com/q/22768689
tags question: http://stackoverflow.com/q/22788961
tag name: browser
type: Tag
tags question: http://stackoverflow.com/q/22665939

http://stackoverflow.com/comment/34571192
comment on: http://stackoverflow.com/q/22691232
score: 0
type: Comment
type: QuestionComment
has text: you could resort to enums and their `valueOf(String)` to be used with switches

http://stackoverflow.com/q/22803088
tagged with: themes
has answer: http://stackoverflow.com/a/22803904
score: 0
answer count: 1
type: UnansweredQuestion
has title: How to set Reindeer.BLACK style for whole project in Vaadin 7?
tagged with: vaadin7
tagged with: gwt
has body: How to set Reindeer.BLACK style for whole project in Vaadin 7? I don't wanna set style name Reindeer.LAYOUT_BLACK for every layouts in my application.
tagged with: java
tagged with: vaadin
type: Question

doubly-linked-list
tags question: http://stackoverflow.com/q/22673150
type: Tag
tag name: doubly-linked-list
tags question: http://stackoverflow.com/q/22705418

http://stackoverflow.com/comment/34705535
type: AnswerComment
has text: If you're using Java 7, you can use the handy new [`Files.newBufferedReader`](http://docs.oracle.com/javase/7/docs/api/java/nio/file/Files.html#newBufferedReader%28java.nio.file.Path,%20java.nio.charset.Charset%29) method to skip most of the boilerplate code used to actually get the reader objects... I'd use `StandardCharsets.UTF_8` as the second arg personally.
type: Comment
comment on: http://stackoverflow.com/a/22764983
score: 0

http://stackoverflow.com/q/22744058
has comment: http://stackoverflow.com/comment/34668541
has comment: http://stackoverflow.com/comment/34666468
accepted answer: http://stackoverflow.com/a/22745677
has comment: http://stackoverflow.com/comment/34668244
has title: fill an ASCII Image with Floodfill
has comment: http://stackoverflow.com/comment/34668567
downvote count: 2
type: AnsweredQuestion
tagged with: recursion
score: -2
tagged with: java
has answer: http://stackoverflow.com/a/22745677
type: Question
tagged with: flood-fill
has comment: http://stackoverflow.com/comment/34668650
has body: Hi I'd like to fill an ASCII Image with the Floodfill-alg. I always get error messages and I dont know why. Here is my Main method with the input Image: public static void main(String[] args){ Scanner sc = new Scanner("read 12\n+++++++++++++\n++++++++++#++\n++++++++++#++\n++++++++++#++\n++++++++++#++\n++++++++++#++\n++++++++++#++\n++++++++++#++\n++++++++++#++\n++++++++++#++\n++++++++++#++\n++++++++++#--\nfill 2 2 d"); String read, numberst; String [] image; int number = 0, count = 0; Boolean error = false; read = sc.next(); numberst = sc.next(); if ((read + numberst).matches("read[0-9]+")) { number = Integer.parseInt(numberst); } else { error = true; } image = new String[number]; System.out.println("image"); while (sc.hasNextLine() &amp;&amp; (error == false) &amp;&amp; (count &lt;= number - 1)) { image[count] = sc.next(); //System.out.println(image[count] + " " + count); count++; if (image[0].length() != image[count - 1].length()) { error = true; System.out.println("INPUT MISMATCH"); } } System.out.println("fill"); while(sc.hasNextLine() &amp;&amp; (error == false) &amp;&amp; sc.hasNext()) { String fill = "", xstr = "", ystr = "", cstr; fill = sc.next(); if (sc.hasNext()) { xstr = sc.next(); } else { error = true; System.out.println("INPUT MISMATCH"); } if (sc.hasNext() &amp;&amp; error == false){ ystr = sc.next(); } else { error = true; System.out.println("INPUT MISMATCH"); } if (sc.hasNext() &amp;&amp; error == false){ cstr = sc.next(); if ((fill + xstr + ystr + cstr).matches("fill[0-9]+[0-9]+.")) { int x = Integer.parseInt(xstr), y = Integer.parseInt(ystr); char c = cstr.charAt(0); if (x &lt;= image[0].length() &amp;&amp; y &lt;= number) { fill(image, x, y, c); } else { error = true; System.out.println("OPERATION FAILED"); } //System.out.println(fill + x + y + c); } else { error = true; System.out.println("INPUT MISMATCH"); } } else { error = true; System.out.println("INPUT MISMATCH"); } //System.out.println(error); } if (error == false) { for (int i = 0; i &lt;…
upvote count: 0
answer count: 1
favorite count: 0

http://stackoverflow.com/a/22788967
type: Answer
has comment: http://stackoverflow.com/comment/34770901
score: 2
has comment: http://stackoverflow.com/comment/34771615
upvote count: 2
answers question: http://stackoverflow.com/q/22786215
has comment: http://stackoverflow.com/comment/34773700
downvote count: 0
has comment: http://stackoverflow.com/comment/34818725
has body: String properties (or key names) in the Datastore cannot exceed 500 characters. This means that there is no point to include a longer string in the list of arguments that you pass to the IN query: you know in advance that this string will not have any matches. UPDATE If you store BlobKey in your entity property, make sure that you pass a BlobKey as a parameter, and not the String representation of that key. If necessary, convert strings into BlobKey: BlobKey blobKey = new BlobKey(blobKeyString);
has comment: http://stackoverflow.com/comment/34849044
has comment: http://stackoverflow.com/comment/34819248
has comment: http://stackoverflow.com/comment/34819812
has comment: http://stackoverflow.com/comment/34821138

http://stackoverflow.com/comment/34522285
comment on: http://stackoverflow.com/a/22663628
score: 1
type: AnswerComment
has text: The error message you posted means that the creation of the InitialContext failed. If you executed the same code in the Tomcat it would succeed.
type: Comment

http://stackoverflow.com/comment/34831017
has text: No. It is not an app provided by OEM. It is a 3rd party app available in Play Store. It is still unclear to me Why this restriction is implemented only on microSd card and NOT on the internal storage. There will be "potentially sensitive user data" in the Internal memory also and I wonder why this restriction is not applied to Internal memory. Do we see any advantage by imposing WRITE restriction only on micro SD card?
type: Comment
comment on: http://stackoverflow.com/a/22817403
score: 1
type: AnswerComment

http://stackoverflow.com/comment/34538877
has text: did you try to stop it using the --stop command?
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/22671927

http://stackoverflow.com/comment/34654924
comment on: http://stackoverflow.com/q/22737415
has text: You catch the _real_ Exception and call a `System.out.println(...)`. It would be necessary if you call an `exception.printStackTrace()` inside your catch-block
score: 1
type: Comment
type: QuestionComment

http://stackoverflow.com/q/22745983
answer count: 1
score: 1
favorite count: 0
accepted answer: http://stackoverflow.com/a/22746110
upvote count: 1
has title: Java collection Equality and Contains option
type: AnsweredQuestion
has body: i have a collection i created of type Service Collection&lt;Service&gt; collection = serviceMap.values(); My data that is returned by the collection is of type param. Service first = collection.iterator().next(); Set&lt;Param&gt; firstInputParam = first.getInputParamSet(); Set&lt;Param&gt; firstOutputParam = first.getOutputParamSet(); An example of the outputs of firstInputParam and firstOutputParam: first.getInputParamSet: [J] first.getOutputParamSet: [C] My goal and my issue is that i need to find a way to compare if the following outputParam is in the set of second.getInputParamSet. For example i.getInputParamSet contains: Input ParamSet: [E, C] ive tried the following if (i.getInputParamSet().equals(first.getOutputParamSet())){ &amp; if (i.getInputParamSet().contains(first.getOutputParamSet())){ but neither of these two methods have worked can anyone assist me. Thank you!
linked to: http://stackoverflow.com/q/27581
tagged with: java
type: Question
downvote count: 0
has answer: http://stackoverflow.com/a/22746110

http://stackoverflow.com/q/22776916
has title: Xbee API - Packet Listener seems not to work
upvote count: 1
downvote count: 1
accepted answer: http://stackoverflow.com/a/22990453
type: AnsweredQuestion
tagged with: java
type: Question
score: 0
has answer: http://stackoverflow.com/a/22990453
tagged with: xbee
answer count: 1
favorite count: 0
has body: I have a class that is trying to read packet from other Xbees connected with Arduino board. Here is the class: public class XbeeReceiver2 { private XBee xbee; private int[] payloadToSend; private int[] payloadReceived; private Queue&lt;XBeeResponse&gt; queue = new ConcurrentLinkedQueue&lt;XBeeResponse&gt;(); public XBeeResponse response; private final static Logger LOGGER = Logger.getLogger(XbeeReceiver2.class .getName()); public XbeeReceiver2(){ xbee = new XBee(); } public void openXbeeConnection(String portNumber){ try { xbee.open(portNumber, 9600); xbee.addPacketListener(new PacketHandler()); } catch (XBeeException e) { System.out.println("" + portNumber + " - connection problems"); e.printStackTrace(); } }; public void readPacket(){ System.out.println(queue.isEmpty()); while((response = queue.poll()) != null){ try { response = xbee.getResponse(); LOGGER.info("received response " + response.toString()); if (response.getApiId() == ApiId.ZNET_RX_RESPONSE){ ZNetRxResponse rx = (ZNetRxResponse) response; payloadReceived = rx.getData(); } } catch (XBeeException e) { // TODO Auto-generated catch block e.printStackTrace(); } } }; public void closeXbeeConnection(){ xbee.close(); }; private class PacketHandler implements PacketListener{ @Override public void processResponse(XBeeResponse response) { //if (response instanceof XBeeResponse){ queue.offer(response); //} } } } In the main program, I have the following piece of code: XbeeReceiver2 xbeeReceiver = new XbeeReceiver2(); xbeeReceiver.openXbeeConnection("COM23"); xbeeReceiver.readPacket(); When I run it, however, the readPacket() method will get stuck at the beginning of the loop, since there is any instance of XbeeResponse stored in the queue. However, when I change the while condition in readPacket() method from while((response = queue.poll()) != null) to while(true), then it works. This means I am getting the response, but I do not think that using while(true) is the good solution as I read on some pages. Therefore…

http://stackoverflow.com/comment/34698698
has text: Thank you, I tried that now.. but still its not working. I even created a new java file and tried printing out "hello". just hello it did not work. I even restarted eclipse. yet again its giving the same error.
type: AnswerComment
comment on: http://stackoverflow.com/a/22761675
score: 0
type: Comment

http://stackoverflow.com/q/22651225
has comment: http://stackoverflow.com/comment/34502260
type: Question
type: AnsweredQuestion
tagged with: bufferedwriter
has answer: http://stackoverflow.com/a/22651390
tagged with: java
has comment: http://stackoverflow.com/comment/34500902
answer count: 1
score: 0
has body: I was wondering if it's possible to send a single string with newline characters using BufferedWriter. For context I need to send the following string over the network: String message = "LOOKREPLY\nX...X\n.....\n.....\n.....\nX...X" socketOutput = new BufferedWriter(new OutputStreamWriter(socket.getOutputStream())); socketOutput.write(message + "\n"); But this sends 6 messages over the network because of the newline characters. I could re-build it on the client side but was wondering if there's a neater/simpler approach.
has title: Buffered Writer - Writing strings with "\n" inside
has comment: http://stackoverflow.com/comment/34500950
accepted answer: http://stackoverflow.com/a/22651390

http://stackoverflow.com/q/22666762
answer count: 1
favorite count: 0
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/33248026
upvote count: 4
downvote count: 0
tagged with: java
has comment: http://stackoverflow.com/comment/34572635
has title: Timed out compiling Play 2.x - Java app (15 minutes) | Heroku and Play Framework
tagged with: git
type: Question
tagged with: heroku
tagged with: timeout
has comment: http://stackoverflow.com/comment/34607728
score: 4
tagged with: playframework
has body: I'm tryingo to deploy my app done in Play Framework 2.2.2 to Heroku using "git push heroku master". In my app directory are all the project files and directories created using play. -.idea -.idea_modules -.settings -app -conf -logs -project -public -target -test -web -build.sbt This is what i get: [info] Resolving org.seleniumhq.selenium#selenium-parent;2.32.0 ... [info] Resolving org.seleniumhq.selenium#selenium-safari-driver;2.32.0 . [info] Resolving org.seleniumhq.selenium#selenium-parent;2.32.0 ... ! Timed out compiling Play 2.x - Java app (15 minutes) ! See https://devcenter.heroku.com/articles/slug-compiler#time-limit To git@heroku.com:warm-escarpment-8855.git ! [remote rejected] master -&gt; master (pre-receive hook declined) error: failed to push some refs to 'git@heroku.com:warm-escarpment-8855.git' I also don't know how to use .slugignore, where to place it, witch files are important or not. Can someone help me? Thanks in advance!

http://stackoverflow.com/comment/34619569
score: 0
type: Comment
comment on: http://stackoverflow.com/a/22713320
has text: Yes i try it, it's running since 2 hours ... I don't know if it is normal. I use sqlite with python
type: AnswerComment

http://stackoverflow.com/comment/34525761
score: 0
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/22665050
has text: Are you talking about the java build path in particular project?

http://stackoverflow.com/a/22787071
type: Answer
downvote count: 0
score: 17
has comment: http://stackoverflow.com/comment/86100917
upvote count: 17
has comment: http://stackoverflow.com/comment/71886696
answers question: http://stackoverflow.com/q/22787032
has body: You can qualify the static variable with the class name to differentiate it: Helper.listener = listener;

http://stackoverflow.com/comment/40744003
type: QuestionComment
score: 1
comment on: http://stackoverflow.com/q/22658750
has text: what proxy address needs to be added?
type: Comment

http://stackoverflow.com/comment/34714125
comment on: http://stackoverflow.com/q/22767961
has text: I do not see any icon when I click 'x'. It minimizes but vanishes from the task bar. The application will still be running.
score: 0
type: QuestionComment
type: Comment

http://stackoverflow.com/comment/34578703
comment on: http://stackoverflow.com/q/22694884
has text: Ok, thanks @ZouZou. I wasn't entirely certain what that method did. Why is there no `Stream::size` ?
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/34578069
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/22694596
has text: I think we might need to see the constructor for `Position`
score: 0

http://stackoverflow.com/q/22671941
has title: Run a function only once and force to return value within specific time
tagged with: timertask
type: Question
answer count: 2
upvote count: 0
has comment: http://stackoverflow.com/comment/34546503
has comment: http://stackoverflow.com/comment/34537801
favorite count: 0
score: -1
tagged with: timer
type: UnansweredQuestion
tagged with: multithreading
tagged with: swing
downvote count: 1
has answer: http://stackoverflow.com/a/22672187
has comment: http://stackoverflow.com/comment/34537264
has answer: http://stackoverflow.com/a/22672042
has body: I have a function say Foo()...My requirement to run some function for specific time and force it to return value within that given time.For eg if i run this function for 100 ms then no matter how many numbers are added in List listofnumbers whitin 100ms it should return those values.I have seen Timer as one solution but Timer or TimerTask has API to schedule task once every some seconds.What i want is to run function only and return whatever value it has wihtin given time. foo() { List lisof numbers for(int i=0;i&lt;somenumber;i++) { listofnumbers.add(i); } return listofnumbers }
tagged with: java

http://stackoverflow.com/q/22709367
type: UnansweredQuestion
tagged with: android
has comment: http://stackoverflow.com/comment/34604913
has title: Android : FragmentPagerAdapter don't saved the state of Fragment?
has comment: http://stackoverflow.com/comment/34607829
tagged with: fragmentpageradapter
upvote count: 1
tagged with: android-sqlite
has answer: http://stackoverflow.com/a/22709989
has comment: http://stackoverflow.com/comment/34605089
has comment: http://stackoverflow.com/comment/34604788
has comment: http://stackoverflow.com/comment/34605331
tagged with: android-fragments
score: 1
tagged with: java
type: Question
has comment: http://stackoverflow.com/comment/34605179
has body: I have a problem with the FragmentPagerAdapter . I can not save the state of the Fragment and then there is the view that within the Fragment . Whenever I use the swipe left and right , the Fragment is recreated by overriding the method getItem ( int position ) in the static class that extends the FragmentPagerAdapter . public static class GraphicsCollectionPagerAdapter extends FragmentPagerAdapter { final int NUM_ITEMS = 3; // number of tabs public GraphicsCollectionPagerAdapter(FragmentManager fm) { super(fm); fragmentList = new AnalyzeFragmentPageListWithDate(); fragment1 = new AnalyzeFragmentPage1(); fragment2 = new AnalyzeFragmentPage2(); } @Override public Fragment getItem(int position) { //Log.i(TAG, "getItem() -&gt; New fragment at position " + position); switch (position) { case 0: return fragmentList; case 1: return fragment1; case 2: return fragment2; } return null; } @Override public int getCount() { return 3; } @Override public CharSequence getPageTitle(int position) { switch (position) { case 0: return "Fragm1"; case 1: return "Fragm2"; case 2: return "Fragm3"; } return "OBJECT " + (position + 1); } } Within the method OnCreateView of each instance of the Fragment there are several steps to the SQLite database and this causes a saturation of the Database Connection Pool. The warning found whenever change dynamically fragment is: "W / SQLiteConnectionPool (1111 ) : A SQLiteConnection object for database ' / data / data / com.myapp / databases / mydb ' was leaked ! Please fix your application to end transactions in progress properly and to close the database When it is no longer needed . " I already tried to use the FragmentStatePagerAdapter without success. Could you kindly tell me how to proceed ? I do not want the Fragment is regenerated each time, causing problems to the database. Have you got an example for save Fragment/View sate? I have not found any suggestion for now . thank you very much
answer count: 2
downvote count: 0
favorite count: 0
has answer: http://stackoverflow.com/a/25536528

http://stackoverflow.com/comment/34578494
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/22694628
has text: It sounds like a List is not really the container you're looking for. Try having a look at Sets.
score: 0

http://stackoverflow.com/q/22733374
tagged with: textarea
answer count: 1
has comment: http://stackoverflow.com/comment/34647894
has comment: http://stackoverflow.com/comment/34650727
favorite count: 0
has answer: http://stackoverflow.com/a/22735621
tagged with: textfield
has title: How do you append both pre-established text and user responses into a text area in Java?
tagged with: append
type: AnsweredQuestion
score: 1
tagged with: java
has comment: http://stackoverflow.com/comment/34648035
upvote count: 1
accepted answer: http://stackoverflow.com/a/22735621
has body: I will do my best to explain-- I am trying to make a choose-your-own-adventure type game while using a TextField and a TextArea, where what is written in the TextField is appended into the TextArea (this I know how to do via ActionListener). However, I need to have the TextArea start with a pre-written 'intro', which asks the user at the end if they want to continue or not. Therefore, I need it to be able to scan the user's response ('yes' or 'no') and choose the appropriate selection of pre-written text to follow. I don't want to overwrite what is already in the TextArea, I want to add to it. I suppose what I'm confused about it how I'm supposed to lay out the entire file so that it functions properly, because the different choices for the adventure span different methods. Having "String text = textField.getText();" only within the actionPerformed method means I can't use 'text' elsewhere, but moving that line up with my other variables tells me it can't reference the field before it's defined. I am fairly new to Java and am working on this as a project for a non-programming school course. I've been through many iterations thus far and this is what seems to be my final attempt, as I've remade it repeatedly and don't have much time left. :(
type: Question
downvote count: 0
has comment: http://stackoverflow.com/comment/34648102

http://stackoverflow.com/comment/34749008
has text: I'm talking of the filename, not the file's content.
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/22775885
score: 3

http://stackoverflow.com/comment/34772708
has text: @Raptor. Don't cut out the imports of code!
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/22802970

http://stackoverflow.com/comment/34771534
score: 1
comment on: http://stackoverflow.com/a/22802111
has text: Hi i have use your code line and it's working for me.Thank you so much.I had little mistake.
type: AnswerComment
type: Comment

http://stackoverflow.com/comment/34559931
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/22684828
type: Comment
has text: Could you please explain me how does that work? It looks so confusing to me. Thank you once again

http://stackoverflow.com/a/22648789
upvote count: 1
answers question: http://stackoverflow.com/q/22648735
type: Answer
downvote count: 0
has body: Check that the gallery is refreshed; it doesn't refresh often. You can call a request to refresh using something like this: ((BaseAdapter) yourGalleryView.getAdapter()).notifyDataSetChanged()
score: 1
has comment: http://stackoverflow.com/comment/34496561
has comment: http://stackoverflow.com/comment/34499090

http://stackoverflow.com/a/22799814
upvote count: 1
has comment: http://stackoverflow.com/comment/34767868
has comment: http://stackoverflow.com/comment/34767801
score: 1
answers question: http://stackoverflow.com/q/22799785
has comment: http://stackoverflow.com/comment/34767888
downvote count: 0
type: Answer
has body: public static void main(String []args){ List&lt;Integer&gt; list = new ArrayList&lt;Integer&gt;(Arrays.asList(20, 5, 7, 9)); List&lt;Integer&gt; list2 = new ArrayList&lt;Integer&gt;(); for(int i=0; i&lt; list.size(); i++){ if (i % 2 == 1) { continue; } list2.add(list.get(i) + (list.size() &gt; i + 1 ? list.get(i+1) : 0 )); } for(Integer it : list2) { System.out.println(it); } } }

http://stackoverflow.com/a/73900191
answers question: http://stackoverflow.com/q/22799407
score: 0
type: Answer
has body: As of Dagger 2.31 from January 2021, Dagger now natively supports assisted injection, which is recommended over the Square and Auto options. Those other options still work, but may require extra setup compared to the native option. For your case you'd need to define the factory interface using @AssistedFactory, and then specify in the constructor which arguments come from it: public class ImageDownloader { @AssistedFactory public interface Factory { ImageDownloader create(URL imageUrl, ImageCallback callback); } @AssistedInject public Factory( HttpClient httpClient, ExecutorService executorService, @Assisted URL imageUrl, @Assisted ImageCallback callback) { // ... } } Your Module wouldn't need to be involved, and note the absence of @Inject in comparison to @AssistedInject. As in the docs also linked above, there are options when two arguments of the same type are supplied via the factory.

http://stackoverflow.com/comment/34611310
score: 0
comment on: http://stackoverflow.com/a/22713035
type: Comment
has text: getting same issue, like when i tried your code my self into my code: The method getPaddedNumber(int) in the type CameraLauncherActivity is not applicable for the arguments (String)
type: AnswerComment

http://stackoverflow.com/a/22774550
score: 1
answers question: http://stackoverflow.com/q/22771134
has body: I've figured it out. It happens that updating multiple entities at varying times through the loop isn't a good idea, so you should create a method for updating every entity at once.
accepted answer of: http://stackoverflow.com/q/22771134
has comment: http://stackoverflow.com/comment/34722239
upvote count: 1
type: AcceptedAnswer
type: Answer
has comment: http://stackoverflow.com/comment/34726853
downvote count: 0

http://stackoverflow.com/comment/34552801
type: Comment
has text: how do I fix it then?
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/22680236

http://stackoverflow.com/comment/34728902
type: AnswerComment
comment on: http://stackoverflow.com/a/22778497
has text: does it apply when request goes through Spring servlet dispatcher and `<mvc:resource` ?
score: 0
type: Comment

http://stackoverflow.com/a/22778357
answers question: http://stackoverflow.com/q/22777774
downvote count: 2
type: Answer
score: -2
has body: Use Kundera. Run simple JPQL to get multiple results.
upvote count: 0

http://stackoverflow.com/comment/34761257
comment on: http://stackoverflow.com/q/22702836
score: 1
has text: Post product and part source code
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/34609155
score: 0
type: Comment
has text: You have a very long string? You should receive a `java.lang.OutOfMemoryError: Java heap space` error if it can't append all the Strings. Maybe your terminal can't/won't display very long strings. You can use the method length() to see what is the actual length of the StringBuilder.
type: AnswerComment
comment on: http://stackoverflow.com/a/22711479

http://stackoverflow.com/comment/34670371
type: QuestionComment
score: 1
has text: @JasonC I don't think this is a duplicate. The referenced question is about runtime access and I think APT is about build time access to annotations.
comment on: http://stackoverflow.com/q/22745837
type: Comment

subclipse
type: Tag
tag name: subclipse
tags question: http://stackoverflow.com/q/22735340
tags question: http://stackoverflow.com/q/22777254

http://stackoverflow.com/comment/34687762
type: Comment
has text: Yes, seems like ns issue. Try constructing your context with the package name instead of a single class. I.e. JAXBContext.newInstance(MetadatatType.class.getPackage().getName()).
comment on: http://stackoverflow.com/a/22741127
type: AnswerComment
score: 0

http://stackoverflow.com/comment/34665155
type: AnswerComment
score: 0
type: Comment
has text: This worked ! i had it as a method.. now it's the variable in the constructor, thanks !
comment on: http://stackoverflow.com/a/22743309

http://stackoverflow.com/comment/34522589
comment on: http://stackoverflow.com/q/22663430
score: 0
type: Comment
type: QuestionComment
has text: ok.. but my ques is why I m getting the NullPointerException on test.java constructor.

http://stackoverflow.com/q/22799878
accepted answer: http://stackoverflow.com/a/22799948
has title: Reading Manifest File Inside of Jar with Servlet
type: Question
tagged with: ant
tagged with: java
tagged with: manifest.mf
tagged with: servlets
answer count: 1
tagged with: jar
has answer: http://stackoverflow.com/a/22799948
has body: I think I'm making a simple mistake, but perhaps you guys can help me out. I have a Jetty webserver. I have deployed a servlet under: {Jetty-Folder}/webapps/BotServlet/WEB-INF --------/lib/Server_BotServlet.jar --------/web.xml So the servlet inside of Server_BotServlet starts up appropriate and I can access it through the appropriate url. My problem is now the manifest file inside of Server_BotServlet.jar. Server_BotServlet.jar ----&gt; /META-INF/MANIFEST.MF The Manifest file is added using an ANT script in eclipse and forms: Manifest-Version: 1.0 Ant-Version: Apache Ant 1.8.4 Built-Date: 2014-04-01 18:53:54 Built-Version: 2014-04-01 18:53:54 Problem: I am unable to read the manifest file using the following code in the webserver: InputStream inputStream = getServletConfig().getServletContext().getResourceAsStream("/META-INF/MANIFEST.MF"); if(inputStream == null) {System.out.println("Input stream is null1");} try { Manifest manifest = new Manifest(inputStream); Attributes attributes = manifest.getMainAttributes(); versionString = attributes.getValue("Built-Version"); } catch(Exception e) { e.printStackTrace(); versionString = "N/A"; } What happens is the InputStream always ends up equaling null. In another case, I had it print out getServletContext().getContextPath and it shows me "/BotServlet/" as it should. Correct me if I am wrong, but when a jar is loaded at runtime, it gets "run" from the contextpath? Or am I going about deploying these jar's incorrectly as the getResourceAsStream() does not seem to see the jar file appropriately. I am using the method as described here.
score: 0
linked to: http://stackoverflow.com/q/615493
type: AnsweredQuestion

http://stackoverflow.com/comment/34575627
has text: Thanks..it works, but can I ask you why I need to add InputType.TYPE_CLASS_TEXT |? BTW I also need to add InputType.TYPE_CLASS_TEXT | if i want numeric EditText?
type: Comment
score: 0
comment on: http://stackoverflow.com/a/22693542
type: AnswerComment

http://stackoverflow.com/comment/34590541
type: Comment
comment on: http://stackoverflow.com/q/22701418
score: 6
has text: Have you initialized `myotherarray`?
type: QuestionComment

http://stackoverflow.com/comment/34669039
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/22745397
has text: put `SecondLayout` class here

http://stackoverflow.com/comment/34718644
score: 0
comment on: http://stackoverflow.com/a/22772507
has text: absolutely, if you are using java it is not very difficult and exist so much examples in the web.
type: AnswerComment
type: Comment

http://stackoverflow.com/comment/34546261
score: 0
type: QuestionComment
comment on: http://stackoverflow.com/q/22676743
type: Comment
has text: android:onclick on the button associated with that line, as you can see in one of the xlm files above.

http://stackoverflow.com/a/22672729
answers question: http://stackoverflow.com/q/22672263
downvote count: 0
has body: Since Spring 3.1 it isn't recommended to use PropertyPlaceholderConfigurer for such task. For more info see its JavaDoc From other side, show, please, your connector-config.properties and the code of RequestGenerator to have more info about an issue.
type: Answer
upvote count: 3
has comment: http://stackoverflow.com/comment/58910858
score: 3

http://stackoverflow.com/a/64353738
type: Answer
has body: If you don't use Guava or Kotlin, here's a solution based on @skiwi and @Neuron answers. users.stream().collect(single(user -&gt; user.getId() == 1)); or users.stream().collect(optional(user -&gt; user.getId() == 1)); where single and optional are statically imported functions returning corresponding collectors. I reasoned it would look more succinct if the filtering logic had been moved inside the collector. Also nothing would break in the code if you happened to delete the string with .filter. The gist for the code https://gist.github.com/overpas/ccc39b75f17a1c65682c071045c1a079
answers question: http://stackoverflow.com/q/22694884
score: 0

http://stackoverflow.com/q/22747010
answer count: 4
has comment: http://stackoverflow.com/comment/34672034
accepted answer: http://stackoverflow.com/a/22747084
has comment: http://stackoverflow.com/comment/34671984
upvote count: 1
has body: So I created an array with random numbers, i printed and counted the repeated numbers, now I just have to create a new array with the same numbers from the first array but without any repetitions. Can't use ArrayList by the way. What I have is. public static void main(String[] args) { Random generator = new Random(); int aR[]= new int[20]; for(int i=0;i&lt;aR.length;i++){ int number=generator.nextInt(51); aR[i]=number; System.out.print(aR[i]+" "); } System.out.println(); System.out.println(); int countRep=0; for(int i=0;i&lt;aR.length;i++){ for(int j=i+1;j&lt;aR.length-1;j++){ if(aR[i]==aR[j]){ countRep++; System.out.println(aR[i]+" "+aR[j]); break; } } } System.out.println(); System.out.println("Repeated numbers: "+countRep); int newaR[]= new int[aR.length - countRep]; } Can someone help? EDIT: Can't really use HashSet either. Also the new array needs to have the correct size.
type: AnsweredQuestion
score: 1
tagged with: java
has comment: http://stackoverflow.com/comment/34672684
type: Question
has title: Creating an Array with the same numbers from an old one but without repetitions
has answer: http://stackoverflow.com/a/22747417
tagged with: arrays
downvote count: 0
has answer: http://stackoverflow.com/a/22747230
has answer: http://stackoverflow.com/a/22747084
favorite count: 0
has comment: http://stackoverflow.com/comment/34672106
has comment: http://stackoverflow.com/comment/34672087
possible better answer: http://stackoverflow.com/a/22747230
has answer: http://stackoverflow.com/a/22747664

k-means
tags question: http://stackoverflow.com/q/22706327
type: Tag
tag name: k-means

http://stackoverflow.com/q/22688729
tagged with: unmarshalling
has title: Unmarshaling class that extends abstract generic class
answer count: 1
has body: My hierarchy of classes: @XmlAccessorType(XmlAccessType.FIELD) public abstract class GenericItem { @XmlElement(name = "Id", required = true) private String itemId; ////other fields } @XmlAccessorType(XmlAccessType.FIELD) public class Item extends GenericItem { @XmlElement(name = "AreaType", required = true) private String areaType; ///other fields } @XmlAccessorType(XmlAccessType.FIELD) public abstract class GenericData&lt;T extends GenericItem&gt;{ @XmlElement(name = "Item") private List&lt;T&gt; itemList; public List&lt;T&gt; getItemList() { return itemList; } public void setItemList(List&lt;T&gt; itemList) { this.itemList = itemList; } ////other fields } @XmlRootElement(name = "Data") @XmlAccessorType(XmlAccessType.FIELD) public class Data extends GenericData&lt;Item&gt; { ////other fields } When I try to unmarahal XML-document that looks like &lt;Data&gt; &lt;Item/&gt; &lt;Item/&gt; &lt;/Date&gt; I have error javax.xml.bind.UnmarshalException - with linked exception: [com.sun.istack.SAXParseException2;Unable to create an instance of GenericItem] JAXBContext jc = JAXBContext.newInstance(Data.class, GenericData.class,Item.class, GenericItem.class); Unmarshaller unmarshaller = jc.createUnmarshaller(); --error here--&gt; JAXBElement&lt;Data&gt; jb = unmarshaller.unmarshal(xmlStreamReader, Data.class); Please, I need help :(
tagged with: generics
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/34566637
type: Question
tagged with: java
tagged with: jaxb
has answer: http://stackoverflow.com/a/22689912
accepted answer: http://stackoverflow.com/a/22689912
score: 0

http://stackoverflow.com/q/22718671
has body: I was asked this recently, and I couldn't figure out the best way. We are trying to replicate Google's search results where the search terms are bolded (using a b tag) in the results. Input Terms Output The search is cool {sea} The search is cool Originally, I thought this was pretty easy: String results(String input, String[] terms) { for(String term : terms) { input = input.replace(term, "" + term + ""); } return input; } However, this isn't correct. For example: Input Terms Output The search is cool {sea, search} The search is cool I struggled to figure out the best way to approach this. Obviously we can no longer find and replace immediately. I played around with using a Map<Integer,String> where the key is the term and the value is the index returned by input.indexOf(term), but this seemed potentially unnecessary. Any improvements? public String results(String input, String[] terms) { Map<Integer, String> map = new HashMap<Integer,String>(); for(String term : terms) { int index = input.indexOf(term); if(index >= 0)//if found { String value = map.get(index); if(value == null || value.length() < term.length())//use the longer term map.put(index, term); } } for(String term: map.values()) { input = input.replace(term, "" + term + ""); } return input; }
has answer: http://stackoverflow.com/a/22719303
has answer: http://stackoverflow.com/a/22719921
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/34621452
tagged with: java
type: Question
score: 0
answer count: 2
has comment: http://stackoverflow.com/comment/34621490
tagged with: string
has title: Find and replace String with a substring result
tagged with: dictionary

http://stackoverflow.com/q/22788950
has comment: http://stackoverflow.com/comment/34747731
favorite count: 0
has title: recognition first letter in input stream
possible better answer: http://stackoverflow.com/a/22789217
has answer: http://stackoverflow.com/a/22789217
tagged with: input
type: AnsweredQuestion
has body: hello i have this method which is serving my input stream. private String getMessage(InputStream in) throws IOException { StringBuilder sb = new StringBuilder(); int pom; while((pom = in.read()) != -1){ char znak = (char) pom; sb.append(znak); if (sb.toString().contains("\r\n")) { String result = sb.toString(); result = result.replace("\r\n", ""); return result; } } return null; } I would like to recognize if the first written letter is 'I' or not. If it is not 'I' i want to terminate the input. How can i get the first letter and immediately test it?
score: 1
tagged with: java
upvote count: 1
has answer: http://stackoverflow.com/a/22792045
type: Question
answer count: 2
downvote count: 0
accepted answer: http://stackoverflow.com/a/22792045

http://stackoverflow.com/comment/34752426
score: 0
type: Comment
comment on: http://stackoverflow.com/a/22791349
type: AnswerComment
has text: @user2051194 You're not using `android:actionBarStyle` in your root theme.

http://stackoverflow.com/comment/34545458
type: AnswerComment
comment on: http://stackoverflow.com/a/22676557
type: Comment
has text: +1. Also worth noting that the OP should be using `break` after their case statements.
score: 2

http://stackoverflow.com/comment/34777173
comment on: http://stackoverflow.com/a/22805367
score: 0
type: AnswerComment
type: Comment
has text: yeah I guess static nested classes are present... my mistake..

http://stackoverflow.com/comment/70947039
type: AnswerComment
comment on: http://stackoverflow.com/a/22778104
has text: In that first example, even if `input` is passed as non-null, the call to `.orElse` means that the constructor expression (the `new ArrayList`) will always happen. I don't see any rule that the argument to the function call is allowed to be _not_ evaluated. So if the runtime optimizer isn't smart enough about `orElse` semantics to skip evaluating its argument, it's going to create an ArrayList with default capacity, and then immediately mark it as garbage. (Granted, all this is just an example, so this doesn't really matter.)
type: Comment
score: 0

http://stackoverflow.com/q/22672858
answer count: 2
has answer: http://stackoverflow.com/a/79463757
accepted answer: http://stackoverflow.com/a/22789569
score: 2
favorite count: 0
upvote count: 2
tagged with: spring
type: AnsweredQuestion
tagged with: java
has answer: http://stackoverflow.com/a/22789569
has body: I am attempting to query Microsoft Active Directory Application Mode (ADAM) using Spring LDAP 1.3.2. I am using the ODMManager to search ADAM. I am getting the error javax.naming.SizeLimitExceededException: [LDAP: error code 4 - Sizelimit Exceeded]; remaining name '/' at com.sun.jndi.ldap.LdapCtx.mapErrorCode(LdapCtx.java:3119) at com.sun.jndi.ldap.LdapCtx.processReturnCode(LdapCtx.java:3013) at com.sun.jndi.ldap.LdapCtx.processReturnCode(LdapCtx.java:2820) It is not clear from the documentation how I can use the PagedResultsDirContextProcessor to process ODMManager searches. Any help greatly appreciated.
type: Question
has title: SPRING LDAP - ODManager query returning size limit exceeded
downvote count: 0
possible better answer: http://stackoverflow.com/a/79463757
tagged with: ldap

http://stackoverflow.com/a/22673775
upvote count: 1
has comment: http://stackoverflow.com/comment/34540990
score: 1
has comment: http://stackoverflow.com/comment/34540723
has body: Of course there are alternatives to an ArrayList, such as a LinkedList or some other implementation. But neither of those are slow in any way, especially when you are just adding single objects at a time. What I'm saying is that the source of your lags is probably not the addition of Bullet instances to a list. Do you have any other things that happen at that time? Is your list synchronized? Any other locking? Do your bullets include an image file that might be loaded from your disk everytime you create a Bullet instance? (disk I/O is slow, don't load stuff while playing)
has comment: http://stackoverflow.com/comment/34540799
downvote count: 0
has comment: http://stackoverflow.com/comment/34540680
type: Answer
answers question: http://stackoverflow.com/q/22673695

http://stackoverflow.com/comment/34499668
type: Comment
comment on: http://stackoverflow.com/a/22649835
score: 1
type: AnswerComment
has text: A typical image will be at least 500x300. One needs to get that down to about 100x60 to be able to print the image.

http://stackoverflow.com/comment/34706595
has text: `Object.equals` doesn't apply here, but yes, you are right about the time of day.
score: 0
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/22765452

http://stackoverflow.com/comment/34619567
score: 0
type: Comment
type: QuestionComment
has text: I took the liberty of incorporating these results in your question and formatting them as code for readability. Can you also show how you're initializing the `ideM` value in the Java code?
comment on: http://stackoverflow.com/q/22672172

http://stackoverflow.com/comment/35316649
type: AnswerComment
score: 0
type: Comment
comment on: http://stackoverflow.com/a/22707535
has text: I explained multiple times what I am doing and what do I need. Your answer was "Sorry, it can't be done. It is hard to explain.". If you give answers here, at least make them clear or if you can't explain, why do you give answers at all. If you are having problems with English language, go to French web sites.

http://stackoverflow.com/q/22691718
downvote count: 2
answer count: 3
upvote count: 1
tagged with: string
has body: I have a YYYYMM date in String format. I want to split it into YYYY and MM and replace the existing YYYY with a new year and concatenate it back in Java. For example, I have 201201. I want to split it into 2012 and 01 and change 2012 to 2000 and finally get 200001. How do I do it? I googled it but everyone seemed to have a - or a * in between. Or if anyone knows a better way to do it (maybe change it into a Date and modify the year), I am all ears. Any help would be appreciated! Thanks
favorite count: 0
possible better answer: http://stackoverflow.com/a/22691847
has title: Splitting a Java String
has comment: http://stackoverflow.com/comment/34572144
type: AnsweredQuestion
tagged with: java
has comment: http://stackoverflow.com/comment/34572077
has comment: http://stackoverflow.com/comment/34572006
has answer: http://stackoverflow.com/a/22691936
accepted answer: http://stackoverflow.com/a/22691936
type: Question
has answer: http://stackoverflow.com/a/22692200
has answer: http://stackoverflow.com/a/22691847
score: -1
tagged with: date
has comment: http://stackoverflow.com/comment/34572024

http://stackoverflow.com/comment/34587673
score: 0
type: Comment
comment on: http://stackoverflow.com/a/22699816
has text: i need to sub string the word "LOV_TYPE" only .. not the whole sentence after "2:" .. and there is no spaces after this word "LOV_TYPE" .. only new line and new sentence
type: AnswerComment

http://stackoverflow.com/a/22674818
accepted answer of: http://stackoverflow.com/q/22674587
answers question: http://stackoverflow.com/q/22674587
score: 0
type: AcceptedAnswer
type: Answer
has body: Few comments that might help : // add line to end of list incorrect.get(token); // &lt;- change this to incorrect.add(token) To iterate thru list use : for (String item : incorrect) { System.out.printlnt(item); } Also, you don't need to reinitialize your list as you do multiple times by incorrect = new ArrayList&lt;String&gt;(); If you'd like to clear it, you could use incorrect.clear() As you are not interested in Random access (i.e. via index), perhaps you could use LinkedList instead of ArrayList

http://stackoverflow.com/a/22708367
downvote count: 0
has body: The JVM can probably figure out that they are the same calculation and perform it only once. But even if it didn't, a multiplication takes less than a nanosecond on any modern CPU so you won't notice the difference, especially while printing, which takes several orders of magnitude more time than that... Now from a readability perspective, using well named variable is generally a good thing so go with option 2.
answers question: http://stackoverflow.com/q/22708281
has comment: http://stackoverflow.com/comment/34602799
type: Answer
has comment: http://stackoverflow.com/comment/34603018
score: 5
upvote count: 5

http://stackoverflow.com/comment/34539935
comment on: http://stackoverflow.com/a/22673117
has text: Okay I understand where you're coming from but I don't need suggestions on how to tidy my code up and I need to make 3 different languages that's why I have 3 instances of bundles all I want to know is how to make the language in my JComboBox change and that's it
score: 0
type: AnswerComment
type: Comment

http://stackoverflow.com/a/22781544
has comment: http://stackoverflow.com/comment/34895496
has body: JSP page <%@ page language="java" contentType="text/html; charset=ISO-8859-1" pageEncoding="ISO-8859-1"%> Insert title here Deepak Servlet package test; import java.io.IOException; import javax.servlet.ServletException; import javax.servlet.annotation.WebServlet; import javax.servlet.http.HttpServlet; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; /** * Servlet implementation class Test */ @WebServlet("/Test") public class Test extends HttpServlet { private static final long serialVersionUID = 1L; /** * Default constructor. */ public Test() { // 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 System.out.println(request.getParameter("id")); } /** * @see HttpServlet#doPost(HttpServletRequest request, HttpServletResponse response) */ protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { // TODO Auto-generated method stub } }
has comment: http://stackoverflow.com/comment/34864303
has comment: http://stackoverflow.com/comment/34840977
type: Answer
has comment: http://stackoverflow.com/comment/34735399
answers question: http://stackoverflow.com/q/22781295
accepted answer of: http://stackoverflow.com/q/22781295
score: 0
type: AcceptedAnswer

http://stackoverflow.com/comment/34793747
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/22813288
has text: Why did they ask? Good question. They asked because they are studying for a test (as stated in the first line of the question). The question is an exercise. Clearly this makes your solution even more silly than if it were a practical problem.
score: 1

http://stackoverflow.com/a/22738669
downvote count: 0
answers question: http://stackoverflow.com/q/22737926
upvote count: 2
accepted answer of: http://stackoverflow.com/q/22737926
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/34657237
has body: This isn't possible in the general case; IP addresses and MAC addresses have a many-to-many relationship (most interfaces have multiple IP addresses, and a single IP address can be bound to multiple MACs, though this latter is usually in a load-balancing scenario). The InARP protocol is available on Frame Relay, but is not applicable to Ethernet. The closest you can get--and this is unreliable for a number of reasons--is to broadcast ping the subnet the target computer is on after giving it time to wake up. You can then inspect the ARP cache on the local computer to find a matching entry.
has comment: http://stackoverflow.com/comment/34657242
type: Answer
score: 2

http://stackoverflow.com/comment/34687439
has text: [How to generate random unique numbers?](http://stackoverflow.com/a/15916950/2024761) - This should be a decent read and probably you can then convert the `Set/List` to an array and sort it using `Arrays.sort()`.
type: QuestionComment
score: 1
comment on: http://stackoverflow.com/q/22755367
type: Comment

http://stackoverflow.com/comment/34556004
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/22682114
has text: @mangusta no local variables are initialized automatically in java see link http://docs.oracle.com/javase/tutorial/java/nutsandbolts/datatypes.html

http://stackoverflow.com/comment/34647738
comment on: http://stackoverflow.com/a/22733320
score: 0
type: AnswerComment
has text: Yes, I am starting to see that now. I thought <FullDeck> would refer back to the array in FullDeck.java. Let me rework this and try again. Thank you.
type: Comment

http://stackoverflow.com/q/22666694
type: UnansweredQuestion
has body: I'm new to ArcGIS Android framework. Recently, I tried to retrieve the Layer's ID by calling getID() for the purpose of referencing markers that are drawn on the map. Sometimes the ID will give me a negative value like, -215125644. With that, I could not get the Layer's ID. Does it indicate an error while creating the Layer or is it perfectly normal to have a negative value Layer ID? If there's an error for retrieving negative value, how can I resolve it?
score: 1
tagged with: java
type: Question
upvote count: 1
has title: ArcGIS Android Layer receiving negative value ID
favorite count: 0
tagged with: android
answer count: 0
downvote count: 0

http://stackoverflow.com/comment/34625331
has text: a `java.util.Map` or better a `Multimap` (see guava one for example)?
type: Comment
type: QuestionComment
score: 1
comment on: http://stackoverflow.com/q/22720725

http://stackoverflow.com/comment/34669609
has text: A search for `eclipse java tutorial` gets many potentially useful results. I suggest looking for one whose style you like, and following it.
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/22745762

http://stackoverflow.com/q/22800242
has body: I'm creating a simple app with two NumberPickers used to select a certain number of minutes and seconds. There isn't too much code so I will post it here: public class MainActivity extends Activity implements OnClickListener { private static final String TAG = "Interval Trainer"; private CountDownTimer countDownTimer; private boolean timerHasStarted = false; private Button startButton; public TextView text; private final long interval = 1 * 1000; //Create NumberPickers NumberPicker numberPicker1 = (NumberPicker) findViewById(R.id.numberPicker1); NumberPicker numberPicker2 = (NumberPicker) findViewById(R.id.numberPicker2); @Override protected void onCreate(Bundle savedInstanceState) { Log.i(TAG,"Entering onCreate()"); super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); startButton = (Button) this.findViewById(R.id.button); startButton.setOnClickListener(this); text = (TextView) this.findViewById(R.id.timer); //Set min and max values for NumberPickers numberPicker1.setMaxValue(100); numberPicker1.setMinValue(0); numberPicker2.setMaxValue(59); //This is the seconds picker numberPicker2.setMinValue(0); Log.i(TAG,"Exiting onCreate()"); } @Override public void onClick(View v) { //Calculate total time from NumberPickers in seconds long startTime = (numberPicker1.getValue() * 60) + numberPicker2.getValue(); //Create CountDownTimer with values from NumberPickers countDownTimer = new MyCountDownTimer(startTime, interval); text.setText(text.getText() + String.valueOf(startTime / 1000)); //should be removed if(!timerHasStarted) { countDownTimer.start(); timerHasStarted = true; startButton.setText("STOP"); } else { countDownTimer.cancel(); timerHasStarted = false; startButton.setText("RESTART"); } //Disable the NumberPickers after 'Start' is pressed numberPicker1.setEnabled(false); numberPicker2.setEnabled(false); } public class MyCountDownTimer extends CountDownTimer { public MyCountDownTimer(long startTime, long interval) { super(startTime, interval); }…
tagged with: crash
answer count: 2
has answer: http://stackoverflow.com/a/22800371
accepted answer: http://stackoverflow.com/a/22800371
score: 0
tagged with: android
has answer: http://stackoverflow.com/a/22800272
tagged with: timer
has title: App is crashing before it starts
type: AnsweredQuestion
tagged with: java
possible better answer: http://stackoverflow.com/a/22800272
tagged with: numberpicker
type: Question

sparkle
tag name: sparkle
type: Tag
tags question: http://stackoverflow.com/q/22662681

http://stackoverflow.com/comment/34727194
type: QuestionComment
comment on: http://stackoverflow.com/q/22777550
type: Comment
has text: Daysarray variable is null
score: 1

http://stackoverflow.com/comment/125860480
type: Comment
has text: no it doesn't. Answer by @obourgain works for non nested variables
comment on: http://stackoverflow.com/a/22718169
score: 0
type: AnswerComment

http://stackoverflow.com/a/22776090
has body: ListNode n = first.next; //n is a reference to first.next n = x; // n is no longer a reference to first.next n is a local variable for the method. So whatever you do to n, it does not affect to the first and last global references. So every time whenver you call the method, n is null because first.next is always null. So do the assignment as first.next = x; // instead of n = x;
has comment: http://stackoverflow.com/comment/34724657
has comment: http://stackoverflow.com/comment/34724736
type: Answer
score: 3
upvote count: 3
has comment: http://stackoverflow.com/comment/34724786
type: AcceptedAnswer
downvote count: 0
accepted answer of: http://stackoverflow.com/q/22776017
answers question: http://stackoverflow.com/q/22776017

http://stackoverflow.com/a/22713141
score: 0
has body: It seems like a good option would be to do the following instead: Calendar now = Calendar.getInstance(); cb.and( cb.lessThanOrEqualTo(kampanjeArtikkelPriser.get(KampanjeArtikkelPris_.overstyrtSalgsprisPeriodeFra), now), cb.greaterThanOrEqualTo(kampanjeArtikkelPriser.get(KampanjeArtikkelPris_.overstyrtSalgsprisPeriodeTil), now) )
type: Answer
has comment: http://stackoverflow.com/comment/34611083
answers question: http://stackoverflow.com/q/22712863

http://stackoverflow.com/q/22713992
favorite count: 0
has title: Access members of a non public class from outside the package using java reflection
has body: There is a non-public class A in package1.I want to access the members of this class from another class B in package2. I have made an instance of class A using the constructor.how would I access the fields and methods in class A? package package1; class A { Integer i; } package package2; class B { public void accessClassA() { Class aClass = Class.forName("package1.A"); Constructor&lt;?&gt; con = aClass.getDeclaredConstructor(); con.setAccessible(true); //code to access fields of class A } }
upvote count: 3
downvote count: 1
score: 2
type: AnsweredQuestion
tagged with: reflection
tagged with: java
type: Question
answer count: 1
has answer: http://stackoverflow.com/a/22952973
accepted answer: http://stackoverflow.com/a/22952973

http://stackoverflow.com/a/22780725
has comment: http://stackoverflow.com/comment/34732935
has comment: http://stackoverflow.com/comment/34733034
has comment: http://stackoverflow.com/comment/34733945
score: 0
has comment: http://stackoverflow.com/comment/34734929
has comment: http://stackoverflow.com/comment/34735427
has comment: http://stackoverflow.com/comment/34735092
answers question: http://stackoverflow.com/q/22780664
has comment: http://stackoverflow.com/comment/34732838
type: Answer
has body: Well, the simplest thing to do is to read the file line by line and have a counter to make sure that when you read 100 lines, write it into a file with opening and closing bigxml tag and continue iteration. A simple nested loop should do the trick. Do something like while(scanner.hasNextLine()){ // Here open a new file for(int i=0;i&lt;100;i++){ String s = scanner.nextLine(); // write string into the file } // Close the file }
has comment: http://stackoverflow.com/comment/34735641

hashcode
tags question: http://stackoverflow.com/q/22685997
tag name: hashcode
tags question: http://stackoverflow.com/q/22701608
tags question: http://stackoverflow.com/q/22772550
tags question: http://stackoverflow.com/q/22672690
tags question: http://stackoverflow.com/q/22683634
type: Tag
tags question: http://stackoverflow.com/q/22740252
tags question: http://stackoverflow.com/q/22772874

http://stackoverflow.com/q/22732288
favorite count: 0
has answer: http://stackoverflow.com/a/22732399
has body: I'm learning Java and I have a simple problem but I'm stuck. I need to search a string for the text "bob", except the "o" can be any character. Is there a wildcard character I can use, or another simpler method? Thanks in advance
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/34646084
has comment: http://stackoverflow.com/comment/34646019
downvote count: 1
tagged with: java
has title: Is there a wildcard character I can use to solve this?
score: -1
type: Question
answer count: 2
upvote count: 0
has answer: http://stackoverflow.com/a/22732436

http://stackoverflow.com/comment/34777047
score: 2
comment on: http://stackoverflow.com/q/22805341
has text: First Try -> Any error ? --> its wrong, No error -> then its right
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/34638305
type: AnswerComment
has text: You can use `calendar.getTimeInMillis()` to skip the `Date` conversion.
type: Comment
comment on: http://stackoverflow.com/a/22727893
score: 1

http://stackoverflow.com/comment/34802959
type: QuestionComment
type: Comment
score: 0
has text: Sorry, all this sounds far too complex to easily point out where the performance is actually lost. The TexturePaint itself as well as the "scaling" that you mentioned several times are possible reasons. You may consider a profiler. When you send a mail to the address below, I'll possibly have a look at it, but can **NOT** promise anything.
comment on: http://stackoverflow.com/q/22802772

http://stackoverflow.com/q/22788269
has answer: http://stackoverflow.com/a/22792349
tagged with: apache-kafka
tagged with: java
type: Question
answer count: 2
tagged with: spring-mongo
has title: threads are blocked at the time of loading class via ClassUtils.java
score: 0
has body: My application listen on kafka topic and dump data into cassandra. Threads loads some information from mongo too. Lag in kafka topic getting increased. I have seen that mostly threads are blocked while loading some class. I am attaching my thread_dump below. "KafkaConsumer-49" prio=10 tid=0x00007f1178fdd000 nid=0x78e0 waiting for monitor entry [0x00007f1155fb5000] java.lang.Thread.State: BLOCKED (on object monitor) at java.lang.ClassLoader.loadClass(ClassLoader.java:403) - waiting to lock &lt;0x00000006c0655b58&gt; (a java.lang.Object) at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:308) at java.lang.ClassLoader.loadClass(ClassLoader.java:356) at org.springframework.util.ClassUtils.forName(ClassUtils.java:258) at org.springframework.data.convert.SimpleTypeInformationMapper.resolveTypeFrom(SimpleTypeInformationMapper.java:56) at org.springframework.data.convert.DefaultTypeMapper.readType(DefaultTypeMapper.java:103) at org.springframework.data.convert.DefaultTypeMapper.getDefaultedTypeToBeUsed(DefaultTypeMapper.java:144) at org.springframework.data.convert.DefaultTypeMapper.readType(DefaultTypeMapper.java:121) at org.springframework.data.mongodb.core.convert.MappingMongoConverter.read(MappingMongoConverter.java:186) at org.springframework.data.mongodb.core.convert.MappingMongoConverter.read(MappingMongoConverter.java:176) at org.springframework.data.mongodb.core.convert.MappingMongoConverter.read(MappingMongoConverter.java:172) at org.springframework.data.mongodb.core.convert.MappingMongoConverter.read(MappingMongoConverter.java:75) at org.springframework.data.mongodb.core.MongoTemplate$ReadDbObjectCallback.doWith(MongoTemplate.java:1840) at org.springframework.data.mongodb.core.MongoTemplate.executeFindMultiInternal(MongoTemplate.java:1536) at org.springframework.data.mongodb.core.MongoTemplate.doFind(MongoTemplate.java:1336) at org.springframework.data.mongodb.core.MongoTemplate.doFind(MongoTemplate.java:1322) at org.springframework.data.mongodb.core.Mon…
has answer: http://stackoverflow.com/a/24170858
tagged with: classloader
type: UnansweredQuestion

codahale-metrics
tag name: codahale-metrics
type: Tag
tags question: http://stackoverflow.com/q/22794665

http://stackoverflow.com/a/22788955
has body: Google provides a "starter kit" and you can always make plain HTTP requests with HttpClient or using AsyncHTTP. Nevertheless if you are migrating out of Parse and you want to write server-side logic easily maybe you are interested in Backbeam (disclaimer: I work there). You can write server-side logic without the need to re-deploy all the time and using it from your Android code is very easy. Backbeam is similar to Parse but maybe you are interested because we are going to release an Open Source version this year. If you have further questions we will be glad to assist you :)
type: Answer
answers question: http://stackoverflow.com/q/22732995
score: 0

http://stackoverflow.com/comment/34544479
has text: Are you using eclipse?
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/22675839

http://stackoverflow.com/comment/34582693
comment on: http://stackoverflow.com/a/22697214
score: 0
type: AnswerComment
has text: Assuming that it would work, how do you deploy multiple apps in tomcat , if all the wars should be renamed to root.war
type: Comment

http://stackoverflow.com/q/22760124
answer count: 2
downvote count: 0
has answer: http://stackoverflow.com/a/22853549
favorite count: 0
possible better answer: http://stackoverflow.com/a/22761007
has answer: http://stackoverflow.com/a/22761007
type: AnsweredQuestion
score: 1
accepted answer: http://stackoverflow.com/a/22853549
tagged with: java
has title: java.net.SocketException: Software caused connection abort: recv failed when using different jre security
upvote count: 1
has body: I am getting the following exception while trying to connect to a web service using HttpsURLConnection running on a host in the same network.Firewall is off. Interesting part is that if I run the following code through my default java JRE 1.7 environment in eclipse, everything works fine. But if I use these functions in a product code which has its own jre folder, it throws the following exception - Caused by: java.net.SocketException: Software caused connection abort: recv failed at java.net.SocketInputStream.socketRead0(Native Method) at java.net.SocketInputStream.read(SocketInputStream.java:173) at java.net.SocketInputStream.read(SocketInputStream.java:122) at com.rsa.sslj.x.aP.c(Unknown Source) at com.rsa.sslj.x.aP.a(Unknown Source) at com.rsa.sslj.x.aP.a(Unknown Source) at com.rsa.sslj.x.aP.h(Unknown Source) at com.rsa.sslj.x.cy.startHandshake(Unknown Source) at sun.net.www.protocol.https.HttpsClient.afterConnect(HttpsClient.java:563) at sun.net.www.protocol.https.AbstractDelegateHttpsURLConnection.connect(AbstractDelegateHttpsURLConnection.java:185) at sun.net.www.protocol.http.HttpURLConnection.getInputStream(HttpURLConnection.java:1300) at sun.net.www.protocol.https.HttpsURLConnectionImpl.getInputStream(HttpsURLConnectionImpl.java:254) I noticed that the list of security providers is different in the java.security file. Here's that list - security.provider.1=com.rsa.jsafe.provider.JsafeJCE security.provider.2=com.rsa.jsse.JsseProvider security.provider.3=sun.security.provider.Sun security.provider.4=sun.security.rsa.SunRsaSign security.provider.5=com.sun.net.ssl.internal.ssl.Provider security.provider.6=com.sun.crypto.provider.SunJCE security.provider.7=sun.security.jgss.SunProvider security.provider.8=com.sun.security.sasl.Provider security.provider.9=org.jcp.xml.dsig.internal.dom.XMLDSigRI security.provider.10=sun.security.smartcardio.SunPCSC security.provider.11=sun.security.mscapi.SunMSCAPI These are my functions - private InputStream Get(URL url,String …
type: Question
tagged with: ssl
tagged with: security

http://stackoverflow.com/a/22698518
downvote count: 0
score: 1
has comment: http://stackoverflow.com/comment/34586482
answers question: http://stackoverflow.com/q/22697118
has comment: http://stackoverflow.com/comment/34586527
upvote count: 1
has comment: http://stackoverflow.com/comment/34590488
type: Answer
has body: Parsing xml by hand is a painful waste of time. If will be much easier to just create a temp file with a wrapping tag and use an xml parser, like this: Path inputFile = Paths.get("input.xml"); Path tempFile = Paths.get("temp.xml"); Path outputFile = Paths.get("output.xml"); // make a temp file with fixed xml formatting Files.write(tempFile, "&lt;root&gt;".getBytes()); for (String line : Files.readAllLines(inputFile, StandardCharsets.UTF_8)) { Files.write(tempFile, line.getBytes(), StandardOpenOption.APPEND); } Files.write(tempFile, "&lt;/root&gt;".getBytes(), StandardOpenOption.APPEND); // parse xml and build output string DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance(); DocumentBuilder builder = factory.newDocumentBuilder(); Document doc = builder.parse(tempFile.toFile()); StringBuilder sb = new StringBuilder(); NodeList parents = doc.getElementsByTagName("parentnode"); for (int i = 0; i &lt; parents.getLength(); i++) { NodeList children = parents.item(i).getChildNodes(); for (int j=0; j&lt;children.getLength(); j++) { sb.append(children.item(j).getTextContent() + " "); } } // clean up temp file Files.delete(tempFile); // write output file Files.write(outputFile, sb.toString().getBytes());

http://stackoverflow.com/comment/34684076
comment on: http://stackoverflow.com/q/22753235
type: Comment
score: 0
type: QuestionComment
has text: I am trying to remove punctuation and make all uppercase to lowercase

http://stackoverflow.com/q/22779055
type: AnsweredQuestion
score: 1
tagged with: java
has body: I am using annotation based configuration in my spring project. I inject classes using @Autowired and these classes are annotated with appropriate annotations like @Service, @Component, @Repository, @Controller. I have 2 questions here: Whether I can get an instance of BeanFactory of spring somehow? Can I get a list of all those beans that are managed by spring?
downvote count: 1
type: Question
tagged with: dependency-injection
has answer: http://stackoverflow.com/a/22779164
accepted answer: http://stackoverflow.com/a/22779164
answer count: 1
has title: list of all spring managed beans
favorite count: 0
upvote count: 2
tagged with: spring
tagged with: spring-mvc

http://stackoverflow.com/comment/34661725
type: AnswerComment
comment on: http://stackoverflow.com/a/22741360
score: 0
type: Comment
has text: So these are used instead of constructor? Its written that this is alternate option to use constructor with same name and signature.

http://stackoverflow.com/q/22807611
answer count: 1
has title: LibGdx : Keep one spriteBatch as singleton in Game? Or one spriteBacth per Screen?
linked to: http://stackoverflow.com/q/22121694
tagged with: java
accepted answer: http://stackoverflow.com/a/22807818
tagged with: libgdx
upvote count: 5
downvote count: 0
type: AnsweredQuestion
has body: In LibGdx SpriteBatch doc. it's mentionned that A SpriteBatch is a pretty heavy object so you should only ever have one in your program. But i'm confused a little ! I want to know if i have to maintain one SpriteBatch in all the Game(as singleton) or have one SpriteBatch per Screen as shown in several tutorials that i find till now. I also want to know if is a good idea to keep a SpriteBatch as singleton. Thank you in advance.
tagged with: spritebatch
favorite count: 0
type: Question
score: 5
tagged with: android
has answer: http://stackoverflow.com/a/22807818

http://stackoverflow.com/comment/34599999
score: 0
has text: groupId and artifactId and version are same ?
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/22706245

http://stackoverflow.com/q/22675135
type: Question
has answer: http://stackoverflow.com/a/22675327
score: -2
tagged with: java
downvote count: 2
answer count: 1
favorite count: 0
tagged with: file-io
has body: import java.util.Scanner; import java.io.File; import java.io.FileNotFoundException; public class logBook { public static void main(String[] args) throws FileNotFoundException { File inputFile = new File("C:\\Users\\Nick Tate\\Desktop\\Log.txt"); try{ Scanner in = new Scanner(inputFile); while(in.hasNextLine()) { in.useDelimiter(";"); String clientName = in.next(); String serviceCost = in.next(); String serviceSold = in.next(); String serviceDate = in.next(); double cost = Double.parseDouble(serviceCost.trim()); System.out.print(clientName); System.out.printf("%8.2f", cost); System.out.print(serviceSold); System.out.print(serviceDate); } in.close(); } catch(FileNotFoundException e){ e.printStackTrace(); } } } Output: - John 25.00 Dinner Aug 12 2013 - Bob 200.00 Conference Sep 11 2013 - Clara 450.00 Lodging Oct 25 2013 - Jamie 900.00 Lodging Oct 28 2013 - Rachel 89.00 Dinner Nov 11 2013 - Richard 1000.00 Conference Dec 17 2013 - Nick 2500.00 Dinner Jan 05 2014 So far I have successfully read in each item from my file and also parsed the appropriate variables. I now need to total the cost of the separate service categories (i.e Dinner, Conference, etc.). How should I go about doing this? I was thinking to add in if() clause checking each service such as if(serviceSold.equals("Dinner") { int sum = 0 dinnerTotal = sum++ } But then how would I add the corresponding price to that category? Any guidance? I ultimately need to write these totals to another file named outputLogBook.text.
has title: How do I total up services and total cost of services from a file?
upvote count: 0
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/34574775

http://stackoverflow.com/a/22649069
has comment: http://stackoverflow.com/comment/34499119
upvote count: 3
type: AcceptedAnswer
downvote count: 0
has body: This is remarkably straightforward. You'll want to write a custom Comparator for this, and enforce its comparison logic to behave the way you want with respect to your two separate "fields". The motivation here is that these fields are lexicographically compared to one another for the date portion, as well as the alphabetical string portion. If you find that the date comparison isn't giving you accurate results (and it may not; I'm not sure of any cases that it wouldn't work off hand, though), then convert it to a Date and compare that in-line. Collections.sort(entries, new Comparator&lt;String&gt;() { @Override public int compare(String left, String right) { String[] leftFragments = left.split("[|]"); String[] rightFragments = right.split("[|]"); if(leftFragments[0].compareTo(rightFragments[0]) == 0) { return leftFragments[1].compareTo(rightFragments[1]); } else { return leftFragments[0].compareTo(rightFragments[0]); } } });
score: 3
type: Answer
has comment: http://stackoverflow.com/comment/34496912
accepted answer of: http://stackoverflow.com/q/22648967
answers question: http://stackoverflow.com/q/22648967

http://stackoverflow.com/comment/34611288
type: QuestionComment
score: 0
has text: @InnocentKiller where you defined Const.prevNext , plus you are not assigning prevNext before starting activity plus overriding prevNext OnCreate which will lose prev value
type: Comment
comment on: http://stackoverflow.com/q/22712674

http://stackoverflow.com/a/22663350
type: Answer
has comment: http://stackoverflow.com/comment/34522173
has body: If there is no current session, open a new session like this protected Session getSession() { Session session = null; try { session = getSessionFactory().getCurrentSession(); } catch (HibernateException e) { System.out.println("Current session is NULL..opening new session"); session = getSessionFactory().openSession(); } return session; }
has comment: http://stackoverflow.com/comment/34540080
answers question: http://stackoverflow.com/q/22662928
score: 0
has comment: http://stackoverflow.com/comment/34521459

http://stackoverflow.com/a/22799535
type: Answer
score: 0
has body: The ones that can hold higher numbers use more memory. Using more memory is bad. One int verses one byte is not a big difference right now. But if you write big programs in the future, the used memory adds up. Also you said double in the title. A double is not like an int. It does hold a number, but it can have decimal places (eg. 2.36), unlike a int which can only hold numbers like 8.
answers question: http://stackoverflow.com/q/22799249

http://stackoverflow.com/q/22795036
tagged with: swing
possible better answer: http://stackoverflow.com/a/22795358
type: AnsweredQuestion
score: 3
has answer: http://stackoverflow.com/a/22795358
tagged with: java
has body: I have been looking for a way to add a vertical scroll bar to a JPanel that in turn is added to a CardLayout panel. I looked up all the posts around here that were concerned with implementing a scrollable JPanel but I couldn't figure out how to implemented it with this specific CardLayout. Oracle doesn't give an example that I could use either. Perhaps I don't use the right configuration for the JWindow or any other component that Im using. I have placed below a stripped-down version of my program for which I'd like to implement a vertical scroll bar. My question is how to implement JPanelScrollable class at the bottom of the code so that it can become scrollable ? import javax.swing.*; import java.awt.*; import java.net.URL ; public class Program2 extends JFrame { public Program2() { super("Flash CC"); Container2 container = new Container2(); setSize(700, 800); setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); setLocationRelativeTo(null); setFocusable( true ) ; add(container); setVisible(true) ; } public static void main(String[] args) { Program2 prog = new Program2(); } } class Container2 extends JPanel { private CardLayout cardLayout = new CardLayout() ; private JPanel1 jPanelFirst = new JPanel1() ; private JPanel2 jPanelSecond = new JPanel2() ; private JPanelScrollable jPanelThird = new JPanelScrollable() ; //Constructor Container2() { this.setLayout( cardLayout ) ; this.setFocusable( true ) ; JScrollPane scrollFrame = new JScrollPane(jPanelThird); this.add( jPanelFirst, "first card" ) ; this.add( jPanelSecond, "second card" ) ; this.add( scrollFrame , "third card" ) ; cardLayout.show( this, "third card" ) ; } } class JPanel1 extends JPanel { } class JPanel2 extends JPanel { } class JPanelScrollable extends JPanel { // here many, many, many elemnts will go // and a vertical scroll barr is needed to view'm all. JPanelScrollable() { this.setOpaque( true ) ; this.setLayout( null ) ; for(int i=0; i&lt;30; i++) { JButton b = new JButton("Button" + i) ; b.setBounds(0, (…
type: Question
accepted answer: http://stackoverflow.com/a/22795425
tagged with: cardlayout
tagged with: layout
tagged with: user-interface
downvote count: 0
answer count: 3
has title: Scrollable JPanel in a CardLayout?
favorite count: 0
has answer: http://stackoverflow.com/a/22795425
upvote count: 3
has answer: http://stackoverflow.com/a/22795603

http://stackoverflow.com/q/22745637
tagged with: nls-sort
tagged with: oracle-database
tagged with: internationalization
type: AnsweredQuestion
tagged with: java
has title: Oracle dynamic NLS_SORT with openjpa
type: Question
has body: i have a application where every user can choose a language in usersettings. Now i want set this language for NLS_SORT. I could send this "language" within every order-by query but i think that is not a good solution. I want set it after user login, but i didn't find any solution for this via google. Can someone help me with it or give me a better alternative for this? I thought every multilanguage application should have this problem, but i found insufficient informations and solutions about it. Thank you for your time.
score: 0
tagged with: jpa
answer count: 1
has answer: http://stackoverflow.com/a/22753782
accepted answer: http://stackoverflow.com/a/22753782

http://stackoverflow.com/comment/34762835
comment on: http://stackoverflow.com/q/22790716
has text: Oh, I see now. If you want both the Name and Email "groups" to each have their own border, then I'd suggest 2 separate panels, each with it's own TitledBorder, then placing these 2 panels on a 3rd outer panel.
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/q/22710557
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/34607107
has comment: http://stackoverflow.com/comment/34606887
has comment: http://stackoverflow.com/comment/34612919
tagged with: spring-mvc
tagged with: java
tagged with: http://stackoverflow.com/tag/json
has comment: http://stackoverflow.com/comment/34606698
downvote count: 1
type: Question
has answer: http://stackoverflow.com/a/39288501
has body: I am trying to make a very simple flow using Spring, jQuery, Ajax and Json. But I am not able to send a POST request to Spring controller. Also my eclipse shows compilation error when I am trying to use consumes and produces in @RequestMapping. I am not using maven. It is a simple dynamic web project in eclipse. I am using spring 3.0.5 jars. HTML page. <FORM> Please enter your text: Username Password Controller: package demo.controller; import org.springframework.stereotype.Controller; import org.springframework.web.bind.annotation.RequestBody; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMethod; import org.springframework.web.servlet.ModelAndView; import demo.model.Login; @Controller public class HelloWorldController { Login users; @RequestMapping("/hello") public ModelAndView helloWorld() { String message = "Hello World, Spring 3.0!"; System.out.println("Inside controller"); return new ModelAndView("hello", "message", message); } /** * Handles POST request */ @RequestMapping(value = "/add",method = RequestMethod.POST ,consumes = "application/json") public String processJson(@RequestBody String requestBody){ return "Handled application/json request "; } } I am getting the following compilation error: The attribute consumes is undefined for the annotation type RequestMapping web.xml <?xml version="1.0" encoding="UTF-8"?> Spring3MVC spring org.springframework.web.servlet.DispatcherServlet 1 spring *.html spring-servlet.xml <?xml version="1.0" encoding="UTF-8"?> <beans xmlns="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:p="http://www.springframework.org/schema/p" xmlns:context="http://www.springframework.org/schema/context" xmlns:mvc="http://www.springframework.org/schema/mvc" xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.0.xsd http://www.springframework.org/sche…
upvote count: 0
tagged with: jquery
score: -1
tagged with: ajax
answer count: 2
has title: Not able to send a POST request to Spring controller using Jquery, Ajax and Json
has answer: http://stackoverflow.com/a/22710883
has comment: http://stackoverflow.com/comment/34612890
favorite count: 0

http://stackoverflow.com/q/22741548
answer count: 1
tagged with: jsp
type: UnansweredQuestion
tagged with: http://stackoverflow.com/tag/html
tagged with: parameters
has body: I have a table setup like ID Name Gender 1 John M 2 Jane F Where the IDs are hyperlinks taking me to a servlet. I want to know was the number of the link the user clicked to get to the servlet, any idea how to achieve that? I tried putting a name inside the tag and then using request.getParameter("name") that but it always returns a null. The table is on a .jsp file.
has title: Getting info from a link
tagged with: java
has answer: http://stackoverflow.com/a/22741663
type: Question
tagged with: servlets
score: 0

http://stackoverflow.com/q/22797997
has answer: http://stackoverflow.com/a/22799528
accepted answer: http://stackoverflow.com/a/22799528
tagged with: java
tagged with: scrollpane
type: Question
tagged with: resize
has title: Scroll Pane Activating When Frame Is Large
has comment: http://stackoverflow.com/comment/34764316
score: 0
has comment: http://stackoverflow.com/comment/34765721
has body: I am creating a JFrame application that contains a menu, toolbar, table, and button panel. I want to use a scroll pane as the top-level container so that if the user resizes the application the buttons, etc. don't just fall off the screen. Here is my constructor code for the main frame: JPanel mainPanel = new JPanel(); // borderlayout, north=toolbar, center=table, south=buttton panel mainPanel.setLayout(new BorderLayout()); mainPanel.setBorder(BorderFactory.createEmptyBorder()); mainPanel.add(new MainToolBar(inventoryActions, false), BorderLayout.NORTH); InventoryTable inventoryTable = new InventoryTable(); JScrollPane tableScrollPane = new JScrollPane(new JTable()); mainPanel.add(new JScrollPane(tableScrollPane), BorderLayout.CENTER); mainPanel.add(tableScrollPane, BorderLayout.CENTER); inventoryTable.adjustColumnWidths(); mainPanel.add(new InventoryActionsButtonPanel(inventoryActions), BorderLayout.SOUTH); JScrollPane mainScrollPane = new JScrollPane(); mainScrollPane.setBorder(BorderFactory.createEmptyBorder()); mainScrollPane.setViewportView(mainPanel); getContentPane().add(mainScrollPane, BorderLayout.CENTER); As you can see.. I am using a JPanel to contain the toolbar, table (nested in another scroll pane), and button panels. I then put this panel inside the main scroll pane. Finally, I add the main scroll pane to the content pane. The initial size of my application is 800x600. When I run it everything looks fine. Here is a screenshot: When I resize the frame, however, the scroll panel "activates" way before the frame gets small as you can see here: Any idea as to why my scroll panel is showing the scroll bars while the frame is still that big? Is there some preferred size that I have to set? Thank you. Note, if I comment out the line of code that adds the scroll pain to the main panel (center) or if I use another swing component, such as a JButton, it doesn't behave as before: //mainPanel.add(tableScrollPane, BorderLayout.CENTER); Here is a screenshot:
answer count: 1
tagged with: scrollbars
tagged with: jframe
type: AnsweredQuestion

http://stackoverflow.com/a/22798210
has body: I just upgraded to netty4.0.18.jar and things started working for me. I don't know what was the issue with netty4.0.17.jar, but it's working with netty4.0.18.jar
upvote count: 4
type: AcceptedAnswer
downvote count: 0
score: 4
accepted answer of: http://stackoverflow.com/q/22794326
answers question: http://stackoverflow.com/q/22794326
type: Answer

http://stackoverflow.com/a/22813277
answers question: http://stackoverflow.com/q/22795455
has comment: http://stackoverflow.com/comment/41693476
type: Answer
has comment: http://stackoverflow.com/comment/84712164
has comment: http://stackoverflow.com/comment/39682264
downvote count: 1
has comment: http://stackoverflow.com/comment/96223665
has body: I have solved my problem by setting transitive attribute for my aar dependency: compile ('com.somepackage:LIBRARY_NAME:1.0.0@aar'){ transitive=true }
has comment: http://stackoverflow.com/comment/54118167
has comment: http://stackoverflow.com/comment/42806612
has comment: http://stackoverflow.com/comment/42812824
has comment: http://stackoverflow.com/comment/137395797
score: 92
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/22795455
upvote count: 93

http://stackoverflow.com/q/22668741
tagged with: string
favorite count: 0
has answer: http://stackoverflow.com/a/22670365
has answer: http://stackoverflow.com/a/22668878
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/22668913
has answer: http://stackoverflow.com/a/22669415
has body: Trying to remove all of the characters that are in String S2 from S1. Example would be: S1 = Mississippi River, S2 = is. Return would be S1 and it would be Mpp Rver. public static String removeLetters(String S1, String S2){ for(int i=0;i&lt;S1.length();i++){ for(int j=0;j&lt;S2.length();j++){ if(S2.charAt(i) == S1.charAt(j)) S1.charAt(j) = ""; //this does not work but essentially what i want. } } } I have tried String S1 = S1.removeAll and S1 = S1.remove The problem is that remove all takes a String String param and .remove takes a char char, neither of which works. I've fought this for a day, can't get it, any help for noobz? :) thank you all greatly as always.
tagged with: java
downvote count: 2
has title: Removing a charAt[i] from a String
upvote count: 1
type: Question
score: -1
has comment: http://stackoverflow.com/comment/34531534
tagged with: comparison
has answer: http://stackoverflow.com/a/22668937
has answer: http://stackoverflow.com/a/22668864
linked to: http://stackoverflow.com/q/5373431
has answer: http://stackoverflow.com/a/22668817
answer count: 7

http://stackoverflow.com/comment/34572910
type: Comment
has text: [The documentation](https://sites.google.com/site/gson/gson-user-guide#TOC-Serializing-and-Deserializing-Generic-Types) seems to cover this.
score: 0
type: QuestionComment
comment on: http://stackoverflow.com/q/22689622

http://stackoverflow.com/a/22715895
score: 1
answers question: http://stackoverflow.com/q/22715839
upvote count: 1
type: Answer
has body: This is normal. You are returning a double in scientific notation. The println method in this case will print out the equivalent of String.valueOf(yourDoubleValue) Real literals are implicitly interpreted as primitive doubles unless specified otherwise. To force interpretation to float you need to append f to your literals, although it won't change the fact that your result will be printed in scientific notation and with possible loss of precision: System.out.println(0.9623f - 0.9619f); Output 4.0000677E-4 I suspect what you ultimately want to print is: System.out.println(new BigDecimal("0.9623").subtract(new BigDecimal("0.9619")).toPlainString()); Output 0.0004 More on BigDecimal here.
downvote count: 0

http://stackoverflow.com/q/22714917
has answer: http://stackoverflow.com/a/22717246
tagged with: arrays
tagged with: bytebuffer
answer count: 1
downvote count: 0
score: 1
favorite count: 0
accepted answer: http://stackoverflow.com/a/22717246
has comment: http://stackoverflow.com/comment/34620596
has body: I have ByteBuffer buf = ByteBuffer.allocateDirect(500); Then I use buf.put(byte) a couple of times, say 20. I save it to sql blob via the underlying array, i.e. by calling buf.array(). However, the length of buf.array() is 500. How to get an array (byte[]) of length 20 that can be passed to other (read-only) functions? (without copying, of course.)
has comment: http://stackoverflow.com/comment/34620161
type: AnsweredQuestion
tagged with: java
has title: how to get array from ByteBuffer, but only up to its position?
upvote count: 1
type: Question
has comment: http://stackoverflow.com/comment/34621305

http://stackoverflow.com/q/22713653
has title: parameters in lucene queries in neo4j repositories with SDN?
score: 0
answer count: 1
tagged with: neo4j
tagged with: lucene
has body: I need to be able to search for substrings in a text field, via a parameterised repository method, in neo4j 1.9.5 Ideally I want to be able to call getInteractionsByTermAndDateRange(String term, long startMillis, long endMillis and get back every WRInteraction where the 'content' field contains 'term', with the pubMillis value within the specified range( 'content' is specified as a FULLTEXT index in the WRInteraction object declaration) First attempt: @Query("START n=node:WRInteraction('content:*{0}*') " + " WHERE " + " n.pubMillis &gt;= {1} AND n.pubMillis &lt;= {2}" + " RETURN " + " n") Iterable&lt;WRInteraction&gt; getInteractionsByTermAndDateRange(String term, long startMillis, long endMillis); This throws Caused by: org.apache.lucene.queryParser.ParseException: Cannot parse 'content:*{0}*': Encountered " "}" "} "" at line 1, column 11. Was expecting one of: "TO" ... &lt;RANGEEX_QUOTED&gt; ... &lt;RANGEEX_GOOP&gt; ... at org.apache.lucene.queryParser.QueryParser.parse(QueryParser.java:211) ~[lucene-core-3.6.2.jar:3.6.2 1423725 - rmuir - 2012-12-18 19:45:40] at org.neo4j.index.impl.lucene.IndexType.query(IndexType.java:300) ~[neo4j-lucene-index-1.9.5.jar:1.9.5] Second try -- pass the whole lucene query via the parameter: @Query("START n=node:WRInteraction('content:{0}') " + " WHERE " + " n.pubMillis &gt;= {1} AND n.pubMillis &lt;= {2}" + " RETURN " + " n") doesn't fare any better... what's the pattern I should be using here? The key requirement is to be able to pass a substring to a repository method as a parameter, and return any WRInteractions where that substring is present int he 'content' field. Should be easy, right? Thanks
tagged with: spring-data-neo4j
tagged with: cypher
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/22714200
type: Question
has answer: http://stackoverflow.com/a/22714200
tagged with: java

http://stackoverflow.com/a/22800184
has comment: http://stackoverflow.com/comment/34816091
upvote count: 3
has comment: http://stackoverflow.com/comment/34768167
answers question: http://stackoverflow.com/q/22800096
has comment: http://stackoverflow.com/comment/34775725
has body: In general the lambda form is more idiomatic for single-statement loops, whereas the non-lambda makes more sense for multi-statement loops. (This ignores composing into a more functional style if possible). One more style you didn't mention is the method reference: foos.forEach(System.out::println); EDIT: As you're looking for a more general answer; you might find that since lambdas are new in Java, the List.forEach method is less used in practice. In response to "So why is non-lambda more idiomatic for multi-statement?", it's more the reverse, that multi-statement lambdas are not idiomatic in most languages. Lambdas tend to be used for composition, so if I was to take the example from your question and compose it into a functional style: // Thanks to @skiwi for fixing this code foos.stream().filter(foo -&gt; bars.get(foo) != null).forEach(System.out::println); In the above example, using multi-statement lambdas would make it harder to read rather than easier.
score: 3
has comment: http://stackoverflow.com/comment/34768153
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/34774256
has comment: http://stackoverflow.com/comment/34768196
type: Answer
accepted answer of: http://stackoverflow.com/q/22800096

http://stackoverflow.com/comment/34590817
type: AnswerComment
score: 0
type: Comment
comment on: http://stackoverflow.com/a/22701511
has text: make it `/user/*` or even deeper based on your requirement

http://stackoverflow.com/q/22704202
score: 0
tagged with: android
type: AnsweredQuestion
has body: I've got a GoogleMap, generated by a SupportMapFragment class. Sometimes, I have another fragment as an overlay, with some details about specific places. However, I can control the GoogleMap through the fragment with the details. How would I pause the GoogleMap / Stop it from being able to be controlled. What functions / flow interruption / other techniques am I looking for? Thanks in advance!
has title: Pause GoogleMap SupportMapFragment / Stop it from being able to be controlled
type: Question
tagged with: android-fragments
tagged with: java
tagged with: google-maps
has answer: http://stackoverflow.com/a/22704300
answer count: 1
accepted answer: http://stackoverflow.com/a/22704300

http://stackoverflow.com/comment/35047542
score: 0
type: Comment
type: AnswerComment
comment on: http://stackoverflow.com/a/22786142
has text: I am getting this error: Something horrible happened. If the below message states that the SAML 2 SSO Profile is not configured for you, then either you haven't uploaded your metadata yet or your SP's entityID has not yet been properly configured. For more information, you can check out the IdP's error log. The Common Errors page for the IdP at the Shibboleth Wiki may help you debug the problem. Error Message: SAML 2 SSO profile is not configured for relying party https://10.0.2.14/shibboleth....how to resolve it?

http://stackoverflow.com/q/22759978
tagged with: android
upvote count: 6
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/22762119
tagged with: android-progressbar
tagged with: java
score: 6
tagged with: webview
type: Question
accepted answer: http://stackoverflow.com/a/22762119
has title: Android Timeout webview if it takes longer than a certain time to load
downvote count: 0
answer count: 1
favorite count: 0
has body: I Want to timeout my webview if it takes a long time to load showing an error message. I'm using setWebViewClient because I need to use the public void onReceivedSslError (WebView view, SslErrorHandler handler, SslError error). I've been looking around and saw I can use the method onProgressChanged(WebView view, int newProgress). Now I can't use this method in setWebViewClient and can't figure out how to go about solving this problem. Another issue I have is that the progress bar never goes away once the page is loaded, I can't add a breakpoint to the method public void onPageFinished(WebView view, String url) either. Web View Settings Method: public void WebViewSettings(){ webView = (WebView) findViewById(R.id.webview); webView.getSettings().setJavaScriptEnabled(true); webView.getSettings().setBuiltInZoomControls(true); webView.getSettings().setSupportZoom(true); webView.getSettings().setLoadWithOverviewMode(true); webView.canGoBack(); webView.setWebViewClient(new WebViewClient(){ @Override public boolean shouldOverrideUrlLoading(WebView view, String url) { if (Uri.parse(url).getHost().equals(urlString)) { // This is my web site, so do not override; let my WebView load the page return false; } // Otherwise, the link is not for a page on my site, so launch another Activity that handles URLs Intent intent = new Intent(Intent.ACTION_VIEW, Uri.parse(url)); startActivity(intent); return true; } @Override public void onLoadResource(WebView view, String url) { // Check to see if there is a progress dialog if (progressDialog == null) { progressDialog = new ProgressDialog(context); progressDialog.setTitle("Loading..."); progressDialog.setMessage("Please wait."); //progressDialog.setCancelable(false); progressDialog.setIndeterminate(true); progressDialog.show(); } } @Override public void onPageFinished(WebView view, String url) { // Page is done loading; // hide the progress dialog and show the webview if (progressDialog.isShowing()) { progressDialog.dismiss(); progressDialo…

to-char
tag name: to-char
type: Tag
tags question: http://stackoverflow.com/q/22683284

http://stackoverflow.com/comment/34761178
comment on: http://stackoverflow.com/q/22796385
type: QuestionComment
has text: Well, if the value of `posComma` is `== line.length()-1`, you will get that error.
score: 0
type: Comment

http://stackoverflow.com/a/68083334
type: Answer
has body: In old JSP 1.2 descriptor, use this tag in your jsp header &lt;%@ page isELIgnored=”false” %&gt;
score: 1
upvote count: 1
answers question: http://stackoverflow.com/q/22670323
downvote count: 0

http://stackoverflow.com/a/30348029
answers question: http://stackoverflow.com/q/22714359
has body: Spring's MockHttpServletRequest and MockHttpServletResponse are useful for that purpose. E.g. MockHttpServletRequest request = new MockHttpServletRequest(); MockHttpServletResponse response = new MockHttpServletResponse(); request.addHeader(HttpHeaders.HOST, "myhost.com"); request.setLocalPort(PORT_VALID); // e.g. 8081 request.setRemoteAddr(REQUEST_IP); // e.g. 127.0.0.1 then I can call myclass.method(request, response, ...) and check whether some attribute has been correctly set into the request, e.g. MyBean attr = (MyBean) request.getAttribute(ATTRIBUTE_NAME)); // do my Assert.* stuff with 'attr' MockHttpServletRequest and MockHttpServletResponse work fine where mock(HttpServletRequest.class) fails, for instance where you need to get back the real content of a request attribute which has been previously set within your business logic.
type: Answer
downvote count: 2
upvote count: 20
has comment: http://stackoverflow.com/comment/51558922
score: 18
has comment: http://stackoverflow.com/comment/57325579

http://stackoverflow.com/comment/34672168
score: 0
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/22746813
has text: try now i've edit my answer also you can use the sent `arraylist ` from activity its already filled from activity so adapter can loop the elements

http://stackoverflow.com/a/45547873
score: 4
upvote count: 4
downvote count: 0
type: Answer
answers question: http://stackoverflow.com/q/22729341
has body: Using this snippet you can skip using Enter key driver.get("https://www.google.com"); WebElement element = driver.findElement(By.name("q")); element.sendKeys("your text"); element.submit();

http://stackoverflow.com/comment/34559401
score: 0
type: Comment
type: QuestionComment
has text: android:maxLines="2" android:singleLine="false"
comment on: http://stackoverflow.com/q/22684779

http://stackoverflow.com/comment/34706120
comment on: http://stackoverflow.com/q/22765373
score: 0
type: Comment
type: QuestionComment
has text: @njzk2 again, look at the link I provided

http://stackoverflow.com/q/22750148
tagged with: java
has answer: http://stackoverflow.com/a/22750182
tagged with: hadoop
answer count: 1
score: 0
has title: Pig pass tab (\t) as param for dynamic CSV parsing
tagged with: python
tagged with: apache-pig
type: UnansweredQuestion
has body: I am working on parsing data files with any delimiter data in File (CSV',' TSV '\t' ';') the approach works with ',' and ';' but not with tab '\t', how can we pass tab as param to pig? python code delimiter = '\t' cmd = 'pig -f sample.pig -p file='+data_file +' -p delimiter=' + delimiter subprocess.Popen(cmd, shell=True, stderr=subprocess.STDOUT) Pig -- REGISTER 'piggybank.jar' -- may use CSVExcelStorage in future results = LOAD '$file' USING PigStorage('$delimiter'); I am getting following exception 2014-03-31 03:26:41,412 [main] INFO org.apache.pig.tools.parameters.ParameterSubstitutionPreprocessor - The parameter: "delimiter= " cannot be parsed by Pig. Please double check it 2014-03-31 03:26:41,412 [main] INFO org.apache.pig.tools.parameters.ParameterSubstitutionPreprocessor - Parser give the follow error message: 2014-03-31 03:26:41,413 [main] INFO org.apache.pig.tools.parameters.ParameterSubstitutionPreprocessor - Encountered "&lt;EOF&gt;" at line 1, column 16. Was expecting one of: &lt;IDENTIFIER&gt; ... &lt;OTHER&gt; ... &lt;LITERAL&gt; ... &lt;SHELLCMD&gt; ...
type: Question

http://stackoverflow.com/comment/34686113
score: 0
comment on: http://stackoverflow.com/a/22754588
type: AnswerComment
has text: how do I access it in my jsp page?
type: Comment

http://stackoverflow.com/comment/34613478
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/22714277
score: 0
has text: no, CascadeType.MERGE on the owning side is what I tried but it didn't work...

http://stackoverflow.com/q/22736029
has comment: http://stackoverflow.com/comment/34652567
tagged with: jframe
has body: I have a program that draws Vehicle Objects (e.g. Car Shapes) onto a JFrame using a paint method. However whenever I click on the screen to draw the vehicles I have to refresh the window for them to be shown even with the repaint() method added. The first picture shows where I clicked. Nothing happened. After minimizing and opening the window. import java.awt.Graphics; import java.awt.Graphics2D; import java.awt.event.MouseEvent; import java.awt.event.MouseListener; import java.util.Iterator; import java.util.LinkedList; import javax.swing.JFrame; /** Program specs: Draws shapes (Vehicles) that are contained within LinkedLists. * When a shape is drawn over another shape it 'joins' its list. (not implemented yet, not my issue) */ /** Creates JFrame */ public class FramePanel extends JFrame implements MouseListener { private static final int FRAME_WIDTH = 600; private static final int FRAME_HEIGHT = 600; Car car; // Car is a subclass of Vehicle. It only contains a draw method. //Vehicle is an abstract class that only contains a draw method LinkedList&lt;LinkedList&lt;Vehicle&gt;&gt; list = new LinkedList&lt;LinkedList&lt;Vehicle&gt;&gt;(); LinkedList&lt;Vehicle&gt; temp = new LinkedList &lt;Vehicle&gt;(); /** Constructs the frame. */ public FramePanel() { addMouseListener(this); setSize(FRAME_WIDTH, FRAME_HEIGHT); repaint(); } @Override public void mouseClicked(MouseEvent evt) { car = new Car (evt.getX(), evt.getY()); temp.add(car); //Add Vehicle to LinkedList list.add(temp); //Add LinkedList to Collection of LinkedLists } public void mouseEntered(MouseEvent arg0) {} public void mouseExited(MouseEvent arg0) {} public void mousePressed(MouseEvent arg0) {} public void mouseReleased(MouseEvent arg0) {} public void paint(Graphics g) { super.paintComponents(g) ; Graphics2D g2 = (Graphics2D) g; for (LinkedList&lt;Vehicle&gt; veh : list){ // list is collection of Linked Lists Iterator&lt;Vehicle&gt; it = veh.iterator(); while (it.hasNext()){ it.next().draw(g2); } } } public …
linked to: http://stackoverflow.com/q/383947
type: AnsweredQuestion
tagged with: java
linked to: http://stackoverflow.com/q/5924697
type: Question
has comment: http://stackoverflow.com/comment/34652848
answer count: 1
has comment: http://stackoverflow.com/comment/34652494
score: 0
has title: Java JFrame repainting after minimizing/re-opening window
has comment: http://stackoverflow.com/comment/34652993
has answer: http://stackoverflow.com/a/22736449
accepted answer: http://stackoverflow.com/a/22736449
has comment: http://stackoverflow.com/comment/34653110

http://stackoverflow.com/a/22792203
score: 0
type: Answer
answers question: http://stackoverflow.com/q/22791847
has body: ... we often split the interface and implementation files into foo.h and foo.cpp ... That's not true, you are confusing the terms class declaration and (abstract) interface. Java has no concept of header files, nor does it distinguish class declaration from class definition.

http://stackoverflow.com/q/22714874
favorite count: 0
has answer: http://stackoverflow.com/a/22714932
type: UnansweredQuestion
tagged with: android
has answer: http://stackoverflow.com/a/22717347
tagged with: http://stackoverflow.com/tag/xml
upvote count: 2
score: 1
tagged with: java
has body: I am working on an android app and I am trying to open an xml file in assets folder containing references to images located also in assets folder. I am using AssetManager in a non-activity Class and tried to pass context to its constructor with no success.There are no errors in Eclipse but when I run the app it crushes. The code I use for the 2 classes and the XML is below. XML File: &lt;scene&gt; &lt;sprite&gt; &lt;img src="100789.jpg" positionx="100" positiony="200" name="100789.jpg"/&gt; &lt;/sprite&gt; &lt;sprite&gt; &lt;img src="100788.jpg" positionx="2" positiony="20" name="100788" /&gt; &lt;/sprite&gt; &lt;/scene&gt; Main Class (Activity) import android.content.Context; .... public class Test extends AndroidGame { Context context=getApplicationContext(); @Override public Screen getStartScreen() { return new LoadingScreen(this, context); } } Load Class (Screen) import java.io.InputStream; import javax.xml.parsers.DocumentBuilder; import javax.xml.parsers.DocumentBuilderFactory; import org.w3c.dom.Document; import android.content.Context; import android.content.res.AssetManager; .... public class LoadingScreen extends Screen { private Context context; public Document doc; public LoadingScreen(Game game, Context context) { super(game); this.context=context; } AssetManager gi = con.getAssets(); @Override public void update(float deltaTime) { try { InputStream inStream = gi.open("assets.xml"); DocumentBuilder builder = DocumentBuilderFactory.newInstance().newDocumentBuilder(); Document doc = builder.parse(inStream); doc.getDocumentElement().normalize(); }catch (Exception e) { e.printStackTrace(); } Graphics g = game.getGraphics(); Assets.background = g.newPixmap(doc.getDocumentElement().getElementsByTagName("sprite").item(0).getChildNodes().item(1).getAttributes().getNamedItem("name").getNodeValue(), PixmapFormat.RGB565); .... .... game.setScreen(new MainMenuScreen(game)); } So am I doing something wrong ? I have also tried to put the following code in the constru…
downvote count: 1
type: Question
has title: Pass context to a non-Activity Class to use AssetManager.getAssets()
has comment: http://stackoverflow.com/comment/34614445
tagged with: dom
answer count: 2

http://stackoverflow.com/comment/34723266
score: 0
comment on: http://stackoverflow.com/a/22703294
type: AnswerComment
type: Comment
has text: @sebastian Have a look at my EDIT 2 then

http://stackoverflow.com/q/22778913
has answer: http://stackoverflow.com/a/22779575
has title: Controlling what is lazy (or eager) loaded
tagged with: jpa-2.0
has comment: http://stackoverflow.com/comment/34730737
has comment: http://stackoverflow.com/comment/34729799
has comment: http://stackoverflow.com/comment/34730134
has comment: http://stackoverflow.com/comment/34730442
has comment: http://stackoverflow.com/comment/34730806
has body: I currently have a structure as follows (pseudocode): public class Order { @OneToMany(targetEntity = Orderline.class, fetch = FetchType.LAZY) private List&lt;Orderline&gt; orderlines; private Client client; } public class Orderline { @ManyToOne(mappedBy = 'orderlines') private Order order; private Client client; } public class Client { // your usual Client class, its contents aren't important for the question } Say that I can have an order with ID 123, which belongs to client X. I can also have an order with ID 123 which belongs to client Y. When lazy loading (or eager loading, for that matter), how can I know that when I fetch order with ID 123 for client X from the database, I won't be getting the orderlines from client Y? If JPA checks on the foreign key on the orderline side only, is there a way to add a check for the client when lazy (or eager) loading? I would like to solve this without using specific implementations like Hibernate or Eclipselink so I can easily switch between implementations if necessary.
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/34730233
accepted answer: http://stackoverflow.com/a/22779575
linked to: http://stackoverflow.com/q/21647947
tagged with: java
has comment: http://stackoverflow.com/comment/34729960
type: Question
has comment: http://stackoverflow.com/comment/34729776
has comment: http://stackoverflow.com/comment/34730495
score: 0
has comment: http://stackoverflow.com/comment/34730457
has comment: http://stackoverflow.com/comment/34730624
has comment: http://stackoverflow.com/comment/34730826
has comment: http://stackoverflow.com/comment/34730208
answer count: 1

http://stackoverflow.com/comment/34549931
type: QuestionComment
comment on: http://stackoverflow.com/q/22679106
has text: Pls dont ask the same ques again, instead elaborate your question. Else how could you expect someone to help you
score: 0
type: Comment

http://stackoverflow.com/q/22699104
has answer: http://stackoverflow.com/a/22699355
type: AnsweredQuestion
score: 2
has comment: http://stackoverflow.com/comment/34586241
has answer: http://stackoverflow.com/a/22699309
upvote count: 2
tagged with: java
duplicate of: http://stackoverflow.com/q/7153659
tagged with: bit-manipulation
type: Question
accepted answer: http://stackoverflow.com/a/22699355
has title: Find an integer not in list of 4 billion using 4 mb. But 4 MB is not enough
has comment: http://stackoverflow.com/comment/34586622
answer count: 3
downvote count: 0
has answer: http://stackoverflow.com/a/22699415
has body: Given a list of 4 billion integers, find an integer not in the list using 4MB of memory. (interview was in Java) My solution is to use a BitSet. However according to my calculations there aren't enough bits in 4 MB of memory! = c 4 Megabytes = 4096 KB # multiply by 8 4096 KB =~ 4,096,000 Bytes # multiply by 1000 4,096,000 Bytes =~ 33,500,000 bits # multiply by 8 So 33,500,000 bits is two orders of magnitude less than a billion. Let a lone the 4 billion. Or is it part of the question to work with this limitation?
favorite count: 0
has comment: http://stackoverflow.com/comment/34586277
tagged with: bit
possible better answer: http://stackoverflow.com/a/22699415
linked to: http://stackoverflow.com/q/7153659

http://stackoverflow.com/q/22662606
possible better answer: http://stackoverflow.com/a/22663003
has body: I am trying to understand Lambdas in Java 8. Say I have a Person class that looks like this: public class Person implements { String name; GenderEnum gender; int age; List&lt;Person&gt; children; } Now what I want to do is find all persons which are female, that have children that are younger than 10 years old. Pre java 8 I would do it like this: List&lt;Person&gt; allPersons = somePeople(); List&lt;Person&gt; allFemaleWithChildren = new ArrayList&lt;&gt;(); for(Person p : allPersons) { for(Person child : p.getChildren()) { if(child.getAge() &lt; 10 &amp;&amp; p.getGender() == GenderEnum.Female) { allFemaleWithChildren.add(p); } } } Now allFemaleWithChildren should have what I want. I have been trying to do the same using streams I think I need to use some sort of map, filter and reduce allPersons.stream() //filter females .filter(p -&gt; p.getGender == GenderEnum.Female) //get the children .map(c -&gt; c.getChildren()) //filter the ones that are less than 10 years .filter(c -&gt; c.getAge() &lt; 10) //return a list with the result .collect(Collectors.toList()) But this code does not compile. What am I missing. Also, I don't understand what the reduce method can be used for. The compiler says cannot resolve method getAge(). This is because c is apparently a collection and not the items in the collection, which is really what I want.
type: Question
answer count: 2
accepted answer: http://stackoverflow.com/a/22662890
downvote count: 0
has comment: http://stackoverflow.com/comment/34520199
has comment: http://stackoverflow.com/comment/34520288
upvote count: 6
favorite count: 0
has comment: http://stackoverflow.com/comment/34520495
has answer: http://stackoverflow.com/a/22662890
score: 6
has title: Trying to understand lambda and stream in Java 8
tagged with: collections
tagged with: lambda
has answer: http://stackoverflow.com/a/22663003
tagged with: java-8
type: AnsweredQuestion
tagged with: java-stream
tagged with: java

http://stackoverflow.com/a/22740393
answers question: http://stackoverflow.com/q/22740376
has comment: http://stackoverflow.com/comment/34660047
type: Answer
has comment: http://stackoverflow.com/comment/34660092
upvote count: 3
accepted answer of: http://stackoverflow.com/q/22740376
has comment: http://stackoverflow.com/comment/34660058
score: 3
has body: Add an optional decimal part: if (tokens[i].matches("[0-9]*([.][0-9]+)?")) Use asterisk to make the integer portion optional. The problem with this expression, however, that now it could match an empty string. A better (but longer) expression would match a string that starts in a decimal point in a separate subexpression, as follows: if (tokens[i].matches("[0-9]+([.][0-9]+)?|[.][0-9]+"))
type: AcceptedAnswer
downvote count: 0

hash
tags question: http://stackoverflow.com/q/22795483
tags question: http://stackoverflow.com/q/22744343
tags question: http://stackoverflow.com/q/22669746
type: Tag
tags question: http://stackoverflow.com/q/22678755
tags question: http://stackoverflow.com/q/22801373
tags question: http://stackoverflow.com/q/22805183
tags question: http://stackoverflow.com/q/22737685
tag name: hash

http://stackoverflow.com/a/22706013
upvote count: 2
score: 2
answers question: http://stackoverflow.com/q/22705981
has comment: http://stackoverflow.com/comment/34598614
accepted answer of: http://stackoverflow.com/q/22705981
type: AcceptedAnswer
downvote count: 0
type: Answer
has body: because you are attempting to print an instance of BufferedReader not the data you are reading from it Change while(br1.readLine() != null) { masterRBT.add(br1.toString()); System.out.println(br1.toString()); } to while((String line = br1.readLine()) != null) { masterRBT.add(line); System.out.println(line); }

http://stackoverflow.com/comment/106284281
comment on: http://stackoverflow.com/a/22726869
type: Comment
score: 1
has text: @kubek2k Better yet, `opt.map(Stream::of).orElseGet(Stream::empty)` — because for some reason the result of `Stream.empty()` isn’t cached, so your code always re-creates a somewhat costly empty stream, even if there’s no need.
type: AnswerComment

http://stackoverflow.com/q/22752865
tagged with: seed
has body: I know there's been a lot of questions on Seeds here before already, I've looked through quite a few but am still struggling, sorry if this seems repetitive! Basically I'm prompting the user for an input value (which will be the seed) and then using that seed to generate random values. My code is in two separate files, but I'll try to keep this organized for you. File 1: Random generator = new Random(); public RandomWalk(int gridSize){ gridSize = generator.nextInt(); this.gridSize = gridSize; } public RandomWalk(int gridSize, long seed){ generator.nextInt(); this.gridSize = gridSize; } File 2: public static long seed = 0; int i = 1; System.out.println("Enter random seed (0 for no seed): "); while (i == 1) { seed = scan.nextInt(); if (!(seed == 0)) { if (seed &gt; 0) { i++; //Generate numbers based on seed entered } else { System.out.println("You need to enter a positive integer."); } } else { System.out.println("Seed is 0, a random seed will be generated"); //Make this generate a random seed i++; } } public static void main(String[] args) { getInput(); RandomWalk walk; if (seed==0){ walk = new RandomWalk(gridSize); } else { walk = new RandomWalk(gridSize, seed); } walk.createWalk();
score: 0
tagged with: random
has answer: http://stackoverflow.com/a/22752908
accepted answer: http://stackoverflow.com/a/22752908
type: AnsweredQuestion
tagged with: java
tagged with: random-seed
has comment: http://stackoverflow.com/comment/34682785
type: Question
has title: Using a Specific Seed for a Random Number Generator in Java
answer count: 1

http://stackoverflow.com/a/22706848
has comment: http://stackoverflow.com/comment/36218056
score: 1
upvote count: 1
has body: In Netbeans there are basically two types of java projects. One is using ANT as its build machine and one is using maven. Using ANT to build: You have to modify or build a build.xml. Netbeans offers some targets in its standard build.xml to trigger events on each part of the build process. So to include some additional resource files (in your case some text files) you should add your build.xml with a target like &lt;target name="-post-jar"&gt; &lt;jar destfile="dist/myjar.jar" update="true"&gt; &lt;fileset dir="${basedir}"&gt; &lt;include name="data/include/*"/&gt; &lt;/fileset&gt; &lt;/jar&gt; &lt;/target&gt; It means that after your JAR is build the files from ${basedir}/files/* are included as well. Using MAVEN to build: Netbeans uses here completely Mavens infrastructure. So Maven does have a standard mechanism to recognize resource files to include. It all comes down to place these files in a specific place of the project. Assuming you did not change this standard directory layout of maven JAR projects is is something like: Project src main java resources ... So all files placed in src/main/resources (including subfolders) are included in your JAR automatically. Read more here Edit 1: To access this resource files you cannot use File objects. This is done using the class own getResource methods: App.class.getResourceAsStream("data.xml") App.class.getResource("data.xml") Here my class is App and my datafile is data.xml which is in the same directory as my class. This is relative adressed. But if you use a path with a heading / then your path is JAR file absolute. Read more about this here.
accepted answer of: http://stackoverflow.com/q/22690762
type: AcceptedAnswer
answers question: http://stackoverflow.com/q/22690762
downvote count: 0
has comment: http://stackoverflow.com/comment/36198064
has comment: http://stackoverflow.com/comment/34624315
type: Answer

http://stackoverflow.com/comment/34671687
score: 3
type: AnswerComment
comment on: http://stackoverflow.com/a/22746652
type: Comment
has text: You don't refer to a variable. You refer to an object. Each time you have a reference to an object, the reference needs to store the address of the object. And that costs 4 bytes of memory.

http://stackoverflow.com/q/22784617
favorite count: 0
upvote count: 0
has comment: http://stackoverflow.com/comment/34739544
downvote count: 1
possible better answer: http://stackoverflow.com/a/22784689
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/22784733
accepted answer: http://stackoverflow.com/a/22784733
tagged with: java
tagged with: http://stackoverflow.com/tag/json
score: -1
has title: Couldn't able to extract attributes present in JSON Array
has comment: http://stackoverflow.com/comment/34739657
type: Question
has answer: http://stackoverflow.com/a/22785157
linked to: http://stackoverflow.com/q/21019131
has answer: http://stackoverflow.com/a/22784689
answer count: 3
has body: I have a JSON in this format { "futLink": "/live_market/dynaContent/live_watch/get_quote/GetQuoteFO.jsp?underlying=INFY&amp;instrument=FUTSTK&amp;expiry=24APR2014&amp;type=-&amp;strike=-", "otherSeries": [ "EQ" ], "lastUpdateTime": "01-APR-2014 16:00:01", "tradedDate": "01APR2014", "data": [ { "deliveryToTradedQuantity": "66.31", "totalTradedVolume": "10,78,544" } ], "optLink": "/marketinfo/sym_map/symbolMapping.jsp?symbol=INFY&amp;instrument=-&amp;date=-&amp;segmentLink=17&amp;symbolCount=2" } I need to extract attributes present from the section data array shown above I tried using simple JSON Api JSONObject json = (JSONObject)new JSONParser().parse(jsonString); System.out.println("tradedDate=" + json.get("tradedDate")); System.out.println("totalTradedVolume=" + json.get("totalTradedVolume")); The output ia m getting is ** tradedDate=01APR2014 totalTradedVolume=null ** The issue i am facing is that , getting null value for the array section attributes could anybody please tell me how to resolve this ??

http://stackoverflow.com/a/22688927
score: 0
has body: You can easily achieve this; $(/* selector */).on('click', function() { $.ajax({ url: 'http://10.100.12.145:8080/somePage/123', success: function (response) { // add response to the container you want: $(/* selector */).html(response); } }); });
has comment: http://stackoverflow.com/comment/34567031
has comment: http://stackoverflow.com/comment/34567420
has comment: http://stackoverflow.com/comment/34566834
has comment: http://stackoverflow.com/comment/34568288
has comment: http://stackoverflow.com/comment/34567152
answers question: http://stackoverflow.com/q/22688743
type: Answer
has comment: http://stackoverflow.com/comment/34568525

http://stackoverflow.com/a/22687033
type: Answer
answers question: http://stackoverflow.com/q/22685281
score: 1
upvote count: 1
downvote count: 0
has body: You are asking how to parse but I don't see any JSON to parse in your question. An example parsing method without any library looks like that: JSONObject jo = new JSONObject(response); JSONArray rootArray= jo.getJSONArray("jArray"); int rootArrayLength=rootArray.length(); for(int i=0;i&lt;rootArrayLength;i++){ int id= rootArray.getJSONObject(i).getInt("value"); // do same for others too and create an object } // create object and make a list You can also check from my other answer to compare: Convert String to JsonArray

http://stackoverflow.com/q/22729407
has comment: http://stackoverflow.com/comment/34640872
type: UnansweredQuestion
has title: Is this an adequate way of testing a shallow vs deep copy?
tagged with: java
has body: Hi I am trying to devise a way of testing if a copy constructor is a deep or shallow copy. I have come up with the following. Would it work correctly? The output of the shallow copy is Test1 Test1 Output of Shallow Test1 Output of deep. In my head this makes sense that its working correctly because in the deep copy nothing has been copied to the second instance. public class DeepAndShallowCopyConstructor { public String Stringtest =""; public DeepAndShallowCopyConstructor(){ } //Deep public DeepAndShallowCopyConstructor(DeepAndShallowCopyConstructor other){ DeepAndShallowCopyConstructor test = new DeepAndShallowCopyConstructor(); this.Stringtest = test.Stringtest; } // //Shallow // public Testing(Testing other){ // this.Stringtest = other.Stringtest; // } public static void main(String[] args) { // TODO Auto-generated method stub DeepAndShallowCopyConstructor test1 = new DeepAndShallowCopyConstructor(); test1.setStringtest("test1"); System.out.println(test1.getStringtest()); DeepAndShallowCopyConstructor test2 = new DeepAndShallowCopyConstructor(test1); System.out.println(test2.getStringtest()); } public String getStringtest() { return Stringtest; } public void setStringtest(String stringtest) { Stringtest = stringtest; } }
type: Question
score: 0
tagged with: deep-copy
tagged with: copy-constructor
answer count: 1
has answer: http://stackoverflow.com/a/22729528

http://stackoverflow.com/comment/34759134
type: QuestionComment
has text: Just a comment for future viewers: You should not add or copy "only the jar" if you are planning to use any resource (images, text, etc) from the Google Play Services (If I'm not wrong, error messages are included as resources).
comment on: http://stackoverflow.com/q/22795285
score: 0
type: Comment

http://stackoverflow.com/a/22684828
type: Answer
score: 1
answers question: http://stackoverflow.com/q/22684758
upvote count: 1
has comment: http://stackoverflow.com/comment/34559632
has comment: http://stackoverflow.com/comment/34559489
downvote count: 0
has comment: http://stackoverflow.com/comment/34559416
has comment: http://stackoverflow.com/comment/34559931
has body: I would use a static factory method and make the constructor private. Then within that method I would control those values to create an instance or not. public static Employee getInstance(int age, String name) { if(age &gt;= 21) return new Employee(age, name); return null; }
has comment: http://stackoverflow.com/comment/34560026

http://stackoverflow.com/comment/34637666
type: QuestionComment
comment on: http://stackoverflow.com/q/22724797
score: 0
type: Comment
has text: Use a `JSpinner` for this. E.G. as seen [here](http://stackoverflow.com/a/10021773/418556).

http://stackoverflow.com/a/22663628
score: 0
has comment: http://stackoverflow.com/comment/34521956
answers question: http://stackoverflow.com/q/22663101
has comment: http://stackoverflow.com/comment/34522411
has comment: http://stackoverflow.com/comment/34522285
type: Answer
has comment: http://stackoverflow.com/comment/34522350
has body: You need to be in a managed environment (like an application server) to just create an InitialContext without parameters. As the code you posted has a main method I assume you have executed your code as a standalone application. But in your question you write that your application runs on a Tomcat, so you need to deploy it to your container and call it there. Or is there a reason why you want to remotely access JNDI?
has comment: http://stackoverflow.com/comment/34527320

http://stackoverflow.com/comment/34642019
type: QuestionComment
comment on: http://stackoverflow.com/q/22729894
has text: `JFrame` has no `setBorder`. Use a `JPanel` as the contentpane and set the border to the panel
type: Comment
score: 0

http://stackoverflow.com/comment/34563911
has text: Why does "for(int j = 0; j < 20; j++)" seems to have no effect? You are restricting the loop count to 20 instead of the list's size (hopefully the list contains at least 20 items). This seems to be correct.
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/22687024
score: 2

security
tags question: http://stackoverflow.com/q/22674937
tags question: http://stackoverflow.com/q/22801229
tags question: http://stackoverflow.com/q/22724862
tags question: http://stackoverflow.com/q/22679586
tags question: http://stackoverflow.com/q/22794276
tags question: http://stackoverflow.com/q/22765459
tags question: http://stackoverflow.com/q/22760124
tags question: http://stackoverflow.com/q/22682432
tags question: http://stackoverflow.com/q/22689040
tags question: http://stackoverflow.com/q/22666480
tags question: http://stackoverflow.com/q/22660492
tags question: http://stackoverflow.com/q/22734755
tags question: http://stackoverflow.com/q/22770980
tags question: http://stackoverflow.com/q/22668936
type: Tag
tags question: http://stackoverflow.com/q/22696759
tags question: http://stackoverflow.com/q/22709987
tags question: http://stackoverflow.com/q/22737872
tag name: security

http://stackoverflow.com/comment/34631813
type: Comment
has text: I've never seen anybody use `` for user links before. That's kind of cool looking.
comment on: http://stackoverflow.com/a/22723968
score: 3
type: AnswerComment

http://stackoverflow.com/a/22733544
answers question: http://stackoverflow.com/q/22733437
has comment: http://stackoverflow.com/comment/34650354
score: 2
has body: These are the lines at fault: ballArr[i] = new Ball(new Point(50,50), 5); Here, you call the two-argument constructor from Ball. It looks like this: public Ball(Point l, int r){ location = l; radius = r; color = Color.RED; } So your balls will all be red, have a radius of 5 and be at position 50,50. You do have a three-argument constructor that also sets the color of a ball. If you want these things to be random, use a Random object, select a random color, radius and point for each ball, and there you go. It should be clear how you get random numbers for radius and point. In case you're wondering about Color, here's a way: Define an array containing Color objects. Color[] colors = {Color.Red, Color.Blue, Color.Yellow}; Get a random number based on the size of the array, int colornumber = random.nextInt(colors.length); and retrieve the color Color c = colors[colornumber] Then, create balls with random properties. EDIT public class BallWorld { .... private Random random = new Random(); private Color[] colors={Color.red,Color.blue,Color.yellow}; public BallWorld(int ballCnt){ super(); setSize(FRAMEWIDTH, FRAMEHEIGHT); setTitle("My Bouncing Ball Application"); ballArr = new Ball[ballCnt]; this.ballCnt = ballCnt; for (int i=0; i &lt; ballCnt; i++){ ----&gt; // Create attributes here int bcn = random.nextInt(colors.length); Color ballcolor = colors[bcn]; int ballradius = random.nextInt(10); // change to suit your needs ----&gt; int posx = random.nextInt(200); // change to suit your needs ----&gt; int posy = random.nextInt(200); // change to suit your needs // this creates a ball given the above calculated parameters ----&gt; ballArr[i] = new Ball(new Point(posx,posy), ballradius, ballcolor); int ddx = (int) (5*Math.random()); //Exercise 1 int ddy = (int) (4*Math.random()); //Exercise 1 ballArr[i].setMotion(ddx, ddy); } }
upvote count: 2
has comment: http://stackoverflow.com/comment/34649074
has comment: http://stackoverflow.com/comment/34649476
accepted answer of: http://stackoverflow.com/q/22733437
has comment: http://stackoverflow.com/comment/34649001
has comment: http://stackoverflow.com/comment/34649080
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/34649022
type: Answer

http://stackoverflow.com/a/22660881
has body: Since the Class class is final, the &lt;? extends Class&gt; will be applicable only for the Class type. Therefore, there's no functional difference between Container&lt;Class&gt; and Container&lt;? extends Class&gt;. Update: If your question refers to What is a wildcard ? and if we assume we're not talking about Class, but some other (extendable) type, here's the difference: Let's say we have two classes: class Shape class Rectangle extends Shape Consider the following method signature: public void addRectangle(List&lt;? extends Shape&gt; shapes) This is an example of bounded wildcard, where the Shape part is called upper bound. public void addRectangle(List&lt;? extends Shape&gt; shapes) { // Compile-time error! shapes.add(0, new Rectangle()); } The reason for the compile-time error is that the type of the second parameter to shapes.add() is ? extends Shape, which in human language means an unknown subtype of Shape. Since we don't know what type it is, we don't know if it is a supertype of Rectangle. It might or might not be such a supertype, so it isn't safe to pass a Rectangle there. The example is taken from: The Java Tutorials - Wildcards
score: 3
type: AcceptedAnswer
downvote count: 0
type: Answer
answers question: http://stackoverflow.com/q/22660811
has comment: http://stackoverflow.com/comment/34516856
accepted answer of: http://stackoverflow.com/q/22660811
upvote count: 3

http://stackoverflow.com/comment/34768794
type: AnswerComment
score: 0
has text: Hello Sir, thanks for the answer and see my own answer. I have tried something new and that's working fine for me. This is something different but this short code have done all for me.
type: Comment
comment on: http://stackoverflow.com/a/22784232

http://stackoverflow.com/q/22799393
score: 1
tagged with: java
type: Question
has body: I'm trying to use an interface with a JavaFX ListView to allow multiple object types to be displayed in the list at different points in the application (different Object type on different GUI screens. I have defined the ListView in my JavaFX controller class as: @FXML private static ListView&lt;? extends ListDisplayObj&gt; lvLeftBarItems; and ListDisplayObj is a simple interface: public interface ListDisplayObj { public String getListDisplayString(); } I have a database-level method which obtains a list of objects to be displayed based on a given key - the method is defined as: public ObservableList&lt;? extends ListDisplayObj&gt; getListObjectsForKey(String selectedKey) { ... } Later in the controller event handler (or initialize() method) I am trying to initialize the ListView using an ObservableList as follows: ObservableList&lt;? extends ListDisplayObj&gt; ol = MyObjectManager.getListObjectsForKey(selectedKey); lvLeftBarItems.setItems(ol); The lvLeftBarItems.setItems(ol) call generates the following compiler error (in Netbeans):: incompatible types: ObservableList&lt;CAP#1&gt; cannot be converted to ObservableList&lt;CAP#2&gt; where CAP#1,CAP#2 are fresh type-variables: CAP#1 extends ListDisplayObj from capture of ? extends ListDisplayObj CAP#2 extends ListDisplayObj from capture of ? extends ListDisplayObj Any suggestions? I'm not sure how to resolve this. I've tried variations on using the raw Object (which implements ListDisplayObj) instead of &lt;? extends ListDisplayObj&gt;, just returning &lt;ListDisplayObj&gt; vs &lt;? extends ListDisplayObj&gt;, etc with no luck.
has comment: http://stackoverflow.com/comment/34772473
downvote count: 0
answer count: 1
favorite count: 0
linked to: http://stackoverflow.com/q/3733644
has answer: http://stackoverflow.com/a/22802842
has comment: http://stackoverflow.com/comment/34766927
tagged with: generics
has title: Compiler error using Java generics Interface with JavaFX Collection
tagged with: observablelist
type: UnansweredQuestion
tagged with: interface
upvote count: 1
tagged with: collections

http://stackoverflow.com/comment/34500538
type: Comment
has text: Unfortunately, OP has 10,000 rows, not 1,000.
comment on: http://stackoverflow.com/a/22651147
type: AnswerComment
score: 0

ip-address
tags question: http://stackoverflow.com/q/22737926
tag name: ip-address
type: Tag
tags question: http://stackoverflow.com/q/22802914

foreground
type: Tag
tags question: http://stackoverflow.com/q/22782483
tag name: foreground

http://stackoverflow.com/comment/34687200
type: QuestionComment
has text: Solved ;) The problem was in the regex that didn't allow the " " char Thanks
comment on: http://stackoverflow.com/q/22742890
score: 0
type: Comment

http://stackoverflow.com/a/22685059
score: 0
type: Answer
answers question: http://stackoverflow.com/q/22684758
has body: If you really want to enforce this without explicitly throwing an error you could use an assert. public Employee(int age, String name){ // Age higher than 21? assert(age &gt; 21); /* Code */ } You will have to enable asserts though with -ea as build option, otherwise they don't work.

http://stackoverflow.com/q/22744941
has comment: http://stackoverflow.com/comment/34668257
favorite count: 0
has comment: http://stackoverflow.com/comment/34668461
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/34668213
tagged with: client
tagged with: multithreading
has answer: http://stackoverflow.com/a/22745132
has comment: http://stackoverflow.com/comment/34668484
upvote count: 1
type: Question
has comment: http://stackoverflow.com/comment/34668317
score: 1
tagged with: java
has comment: http://stackoverflow.com/comment/34668398
has comment: http://stackoverflow.com/comment/34668408
has comment: http://stackoverflow.com/comment/34668370
tagged with: client-server
answer count: 2
has comment: http://stackoverflow.com/comment/34668479
has comment: http://stackoverflow.com/comment/35205809
has title: Single client to multiple client support: multithreading conversion in java
downvote count: 0
has answer: http://stackoverflow.com/a/22745040
has body: So I don't know who to go about creating a multithreaded server. I have client and server working fine together but can't introduce multiple clients properly. Here is my Server code: package dod; import java.net.*; import java.io.*; import dod.game.GameLogic; public class Server{ Server(GameLogic game, int port) throws IOException{ ServerSocket ss = null; Socket sock = null; try{ ss = new ServerSocket(4444);//port no. while(true){ try{ sock = ss.accept(); ClientThread thread = new ClientThread(game, sock); System.out.println("Adding new player..."); thread.run(); }catch(final Exception e) { System.err.println(e.getMessage()); System.exit(1); } } }catch(Exception d){ System.out.println(d); }finally{ if(ss!=null){ ss.close(); } } } } Here is my thread class: package dod; import java.io.*; import java.net.Socket; import dod.game.GameLogic; import dod.game.PlayerListener; public class ClientThread extends CommandLineUser implements PlayerListener, Runnable{ DataInputStream in; PrintStream out; // The game which the command line user will operate on. // This is private to enforce the use of "processCommand". ClientThread(GameLogic game, Socket sock) { super(game); try{ in = new DataInputStream(sock.getInputStream()); out = new PrintStream(sock.getOutputStream()); }catch(IOException ioe){ System.out.println(ioe); } game.addPlayer(this); } /** * Constantly asks the user for new commands */ public void run() { System.out.println("Added new human player."); // Keep listening forever while(true){ try{ // Try to grab a command from the command line final String command = in.readLine();; // Test for EOF (ctrl-D) if(command == null){ System.exit(0); } processCommand(command); }catch(final RuntimeException e){ System.err.println(e.toString()); System.exit(1); } catch (final IOException e) { System.err.println(e.toString()); System.exit(1); } } } /** * Outputs a message to the player * * @param message * the message to send to the player. */ public void outputMessage(String messag…
has comment: http://stackoverflow.com/comment/34668337

http://stackoverflow.com/comment/109639651
score: 0
type: Comment
comment on: http://stackoverflow.com/a/61984400
type: AnswerComment
has text: Personally i would not set `parallelTestTimeoutForcedInSeconds` unless it is a performance testset. The timeout should be 10 times of expected exec time.

http://stackoverflow.com/comment/34714982
has text: @JHollanti I have tried options 2 and 3 in that list. I have not tried creating my own injection provider (option 1), but I was hoping I wouldn't have to do that
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/22770261

http://stackoverflow.com/comment/34710739
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/22765263
score: 0
has text: All you can do is add an explicit check. (Note that in many cases you should be checking anyway, since a nil result is commonly used as an error indication.)

http://stackoverflow.com/a/22742574
answers question: http://stackoverflow.com/q/22742538
has comment: http://stackoverflow.com/comment/34664572
has comment: http://stackoverflow.com/comment/34664653
has comment: http://stackoverflow.com/comment/34664057
has body: If you're attempting to add all the values of one row then this appears to be the issue: samletFravaer = samletFravaer + fravaer[0][i2]; You need to change this to: samletFravaer = samletFravaer + fravaer[i1][i2]; Edit - this will print out the total: public int samletFravaer(int[][] fravaer, int elevNr) { int samletFravaer = 0; for(int i1 = 0 ; i1 &lt; fravaer[elevNr].length ; i1++) { samletFravaer += fravaer[elevNr][i1]; } System.out.println( samletFravaer ); return samletFravaer; } Second edit - you are not calling your method. Change your call to: public void udskrivFravaer(int[][] fravaer) { for (int i1 = 0; i1 &lt; fravaer.length; i1++) { samletFravaer( fravaer, i1 ); } }
has comment: http://stackoverflow.com/comment/34664488
has comment: http://stackoverflow.com/comment/34664314
has comment: http://stackoverflow.com/comment/34664669
has comment: http://stackoverflow.com/comment/34664597
accepted answer of: http://stackoverflow.com/q/22742538
has comment: http://stackoverflow.com/comment/34664396
has comment: http://stackoverflow.com/comment/34663982
has comment: http://stackoverflow.com/comment/34664237
score: 0
has comment: http://stackoverflow.com/comment/34664610
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/34664297
has comment: http://stackoverflow.com/comment/34663906
has comment: http://stackoverflow.com/comment/34664407
has comment: http://stackoverflow.com/comment/34664665
has comment: http://stackoverflow.com/comment/34664420
has comment: http://stackoverflow.com/comment/34664441
type: Answer
has comment: http://stackoverflow.com/comment/34664625
has comment: http://stackoverflow.com/comment/34664021
has comment: http://stackoverflow.com/comment/34664056

weighted
tags question: http://stackoverflow.com/q/22665070
tag name: weighted
type: Tag

http://stackoverflow.com/q/22657096
upvote count: 1
type: Question
has answer: http://stackoverflow.com/a/22687052
answer count: 2
has answer: http://stackoverflow.com/a/22657270
downvote count: 0
favorite count: 0
type: UnansweredQuestion
tagged with: solrj
has body: I am using solrj to perform a query search from solr installation. This is what i have: public List&lt;Details&gt; search(String query, int first, int rows) { List&lt;Details&gt; cds = new ArrayList&lt;Details&gt;(); try { SolrQuery q = new SolrQuery(); q.set("q", "name:" + query); //this throws an error on the solr side! q.setFields("id"); q.setRows(rows); q.setStart(first); QueryResponse r = server.query(q); final SolrDocumentList docList = r.getResults(); for (SolrDocument doc : docList) { String id_ = doc.getFieldValue("id").toString(); Long id = Long.parseLong(id_); Details cd = detailsFacade.find(id); cds.add(cd); } } catch (SolrServerException ex) { Logger.getLogger(SolrIndexer.class.getName()).log(Level.SEVERE, null, ex); } return cds; } public int count(String query) { try { SolrQuery q = new SolrQuery(); q.set("q", "name:" + query); //this throws an error on the solr side q.setRows(0); // don't actually request any data return (int) server.query(q).getResults().getNumFound(); } catch (SolrServerException ex) { Logger.getLogger(SolrIndexer.class.getName()).log(Level.SEVERE, null, ex); } return 0; } I want to do a query on the name field only. (I have several fields with data for the indexed documents). The error on the solr side: 1126326 [qtp1645986986-17] ERROR org.apache.solr.core.SolrCore – org.apache.solr.common.SolrException: org.apache.solr.search.SyntaxError: Cannot parse 'name:': Encountered "&lt;EOF&gt;" at line 1, column 5. Was expecting one of: &lt;BAREOPER&gt; ... "(" ... "*" ... &lt;QUOTED&gt; ... &lt;TERM&gt; ... &lt;PREFIXTERM&gt; ... &lt;WILDTERM&gt; ... &lt;REGEXPTERM&gt; ... "[" ... "{" ... &lt;LPARAMS&gt; ... &lt;NUMBER&gt; ... at org.apache.solr.handler.component.QueryComponent.prepare(QueryComponent.java:171) at org.apache.solr.handler.component.SearchHandler.handleRequestBody(SearchHandler.java:187) at org.apache.solr.handler.RequestHandlerBase.handleRequest(RequestHandlerBase.java:135) at org.apache.solr.core.SolrCore.execute(SolrCore…
score: 1
tagged with: java
tagged with: solr
has title: solrj search on particular field

http://stackoverflow.com/a/22659112
has comment: http://stackoverflow.com/comment/34514111
has comment: http://stackoverflow.com/comment/34514180
answers question: http://stackoverflow.com/q/22659056
downvote count: 0
has comment: http://stackoverflow.com/comment/34514777
score: 3
type: Answer
has body: There is a global exception handling in JVM layer. EDIT. You can implement global exception handling using Thread.setDefaultUncaughtExceptionHandler()
upvote count: 3

http://stackoverflow.com/comment/34685998
score: 0
has text: I am trying to understand how hashmap works if two objects have same hashcode ? By Hashcode contract if hashcode is same then through equals method objects should be same. Is there a way by which i can retrieve the d1 value in java when hashcodes are same ?
type: QuestionComment
comment on: http://stackoverflow.com/q/22754299
type: Comment

http://stackoverflow.com/comment/34517355
type: Comment
has text: Ya. Now I tried in local websphere server and it's working fine . But while deploying, it's not invoking.
type: QuestionComment
comment on: http://stackoverflow.com/q/22660842
score: 0

http://stackoverflow.com/a/22666102
has body: Try to put all the panels in a Frame. Try to use this tutorial. http://docs.oracle.com/javase/7/docs/api/javax/swing/JFrame.html This is the Window used to display all the things, and make them visible.
score: 0
answers question: http://stackoverflow.com/q/22666008
type: Answer

http://stackoverflow.com/comment/34595325
type: Comment
has text: Your last comment looks like the answer - I really missed that read barrier, that `volatile` gives us to getter thread. Thank you.
comment on: http://stackoverflow.com/a/22703656
type: AnswerComment
score: 0

http://stackoverflow.com/q/22743815
tagged with: java
has title: Checking a wiki link using regexp
type: Question
has answer: http://stackoverflow.com/a/22743861
score: 0
has answer: http://stackoverflow.com/a/22743957
accepted answer: http://stackoverflow.com/a/22743840
has body: I am not good at regexp. I am trying to check a wiki link. If it has a hashtag #, then I do not want to use it because it is within the current page. Example: Ball -- OK Ball -- OK #Ball -- No What I have done sounds pretty simple, so I have a string called a link.matches("^#"). It matches with everything except # but when tested with Ball, it didn't work pretty well. Any ideas why?
answer count: 3
tagged with: regex
has answer: http://stackoverflow.com/a/22743840
possible better answer: http://stackoverflow.com/a/22743957
type: AnsweredQuestion

http://stackoverflow.com/comment/34570465
type: Comment
type: QuestionComment
has text: `org.springframework.batch.item.ItemStreamException: Failed to initialize the reader`: Actually, it's not an issue of Spring Integration File Polling Adapter. It's an issue from Spring Batch. Does it say anything for you?
comment on: http://stackoverflow.com/q/22690538
score: 0

http://stackoverflow.com/comment/34502056
type: QuestionComment
has text: huh, only method `DisplayTotalCost()` recognize that `customers`. you should use `customerlist` in all your method instead of declaring one for each method.
score: 1
comment on: http://stackoverflow.com/q/22651770
type: Comment

http://stackoverflow.com/a/22678832
score: 0
upvote count: 1
answers question: http://stackoverflow.com/q/22678654
downvote count: 1
has comment: http://stackoverflow.com/comment/34549543
type: Answer
has comment: http://stackoverflow.com/comment/34549402
has body: You first must get the Music object from the LinkedList. for(Music m: head.data) { m.play(); } or head.data.get(int index).play()

http://stackoverflow.com/q/22688900
has title: J3D - How to use a UV mapping of an object to convert 2D coordinates to 3D ones
has body: I am currently working on trying to convert 2D coordinates to 3D ones. Basically, I have the texture in 2D and I would like to be able to show on a 3D object, having the same texture applied to it, where I am pointing at. Let's say I have the 2D texture of the world. I would like to be able to know, given U,V coordinates on the texture, to get the X,Y,Z coordinates on a sphere having the same texture applied to it. I am using J3D and now I am working with blender and figure out what is the best way to tackle this problem. Any idea? EDIT: Here is a graphical idea of what I am trying to achieve: You get (X,Y) coordinates of a point on a 2D texture and, thanks to some function, get and visualize where it would be if it was placed on a 3D object (I define both the mapping and the object itself).
type: Question
tagged with: blender
tagged with: 3d
has answer: http://stackoverflow.com/a/22689449
score: 0
answer count: 1
type: UnansweredQuestion
tagged with: java-3d
tagged with: uv-mapping
tagged with: java

http://stackoverflow.com/comment/34547687
has text: Like if I have a list (a b), after i run it, it will output List$ListNode@8b8bda4 but not (b). Each list has a ListNode called myHead. public class List { private ListNode myHead; private int mySize; private ListNode myRest;
comment on: http://stackoverflow.com/q/22677825
type: Comment
type: QuestionComment
score: 0

http://stackoverflow.com/comment/34548242
score: 0
type: Comment
type: QuestionComment
has text: I've posted my mapfragment layout in the question. The second part of your question, do you mean: "SupportMapFragment mapFragment = SupportMapFragment.newInstance();"? Isn't that the fragment of mapFragmentClass getting initialized?
comment on: http://stackoverflow.com/q/22677989

netbeans-7.4
tags question: http://stackoverflow.com/q/22700013
type: Tag
tag name: netbeans-7.4

http://stackoverflow.com/a/22658251
has comment: http://stackoverflow.com/comment/34513811
score: 1
has body: No, not directly. This happens if something stops the import step. While I can not tell you wat exactly went wrong in your case, I can tell you how to solve it: Rename the maven.xxxxxfolder in your workspace to the real project name. The select File -&gt; Import... -&gt; Existing Maven Project and choose the project folder. The project will appear in your workspace as maven project. Depending on your eclipse configuration and plugins environment, you might also need to right-click on your new project and select Team -&gt; Share... -&gt; SVN (if there is a long list of options under Team, it is already correctly identifed as SVN project). Update If your maven.xxxx folder is empty, than you seem to have connection problems. Split the checkout and the import part: Switch to the "SVN Repository Exploring" perspective, create the repository (if not already there). Can you browse the repository? If not, you have a connection problem (proxy?). Right click your SVN project and select -> Checkout... Select Check out as project in the workspace This checks out the project as simple resource project now back in the java perspective you can either delete the project and do an "Import existing Maven Project" or convert the project to a maven project using right-click -&gt; Configure -&gt; Convert to Maven project (exact command may vary with your m2e version). If everything elese fails, try to checkout your project using TortoiseSVN (on Windows) or the commandline and doing "import -> existing maven project" afterwards.
upvote count: 1
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/34513995
type: Answer
accepted answer of: http://stackoverflow.com/q/22652176
has comment: http://stackoverflow.com/comment/34637697
answers question: http://stackoverflow.com/q/22652176
downvote count: 0
has comment: http://stackoverflow.com/comment/34513903

http://stackoverflow.com/a/32382708
has comment: http://stackoverflow.com/comment/66888248
type: Answer
has comment: http://stackoverflow.com/comment/137395819
has body: Try this if you are using aar locally: compile(project(:your-library-name)) { transitive=true }
score: 14
answers question: http://stackoverflow.com/q/22795455
has comment: http://stackoverflow.com/comment/65330188
downvote count: 1
upvote count: 15
has comment: http://stackoverflow.com/comment/70805161
has comment: http://stackoverflow.com/comment/64599544

http://stackoverflow.com/q/22673406
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/34539909
has comment: http://stackoverflow.com/comment/34541133
has body: Using C/C++ it is possible to do the following: int arr[100]; int ar[10][10]; memcpy(ar, arr, sizeof(int)*100); Because the C/C++ standard guarantees that arrays are contiguous, the above will copy 1D array to 2D array. Is this possible in Java ?
score: 0
tagged with: java
has comment: http://stackoverflow.com/comment/34539940
upvote count: 1
downvote count: 1
type: Question
has answer: http://stackoverflow.com/a/22673491
has title: Copy 1D array to 2D array
answer count: 1
favorite count: 0
has comment: http://stackoverflow.com/comment/34540095

http://stackoverflow.com/comment/34622575
has text: oh I am sorry I did not mean initialize a keyword I was just trying to say initialize some value in it.
score: 0
type: Comment
comment on: http://stackoverflow.com/a/22719184
type: AnswerComment

http://stackoverflow.com/a/22732702
answers question: http://stackoverflow.com/q/22732030
type: Answer
score: 2
downvote count: 0
has body: You may as well use a generic method public &lt;T&gt; void update_user(String what, T value) {} This may be useful if you are intended to add more types used by the method in the future. Using generics may save you from writing too much boilerplate code.
upvote count: 2
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/22732030

http://stackoverflow.com/comment/34542081
type: QuestionComment
has text: Don't understand why you expect there to be more than 8 entries in that map if there are 8 threads running. Each thread has a single array that is uses as map key? It's going to just keep updating the same value.
comment on: http://stackoverflow.com/q/22674497
score: 0
type: Comment

http://stackoverflow.com/comment/34523868
score: 0
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/22663644
has text: welp looks like my service is still running on background after i close the app. I will just have to work on my service design to not waste battery life and resources. Also i was using the log.i() to check if service was running, looks like when main process closes i can't use log or toast just notifications ( still not implemented) because the service is there running just won't show in log .

http://stackoverflow.com/comment/34567394
has text: why you use two methods for getItem use only one method for taking position of the listview.
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/22688935

http://stackoverflow.com/q/22780786
answer count: 0
tagged with: java
has comment: http://stackoverflow.com/comment/34734067
score: 13
type: Question
linked to: http://stackoverflow.com/q/11001102
tagged with: runtime
has comment: http://stackoverflow.com/comment/53065434
upvote count: 14
downvote count: 1
has comment: http://stackoverflow.com/comment/34738084
has comment: http://stackoverflow.com/comment/79596343
favorite count: 0
has title: Change keystore and truststore at runtime
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/80525949
tagged with: keystore
duplicate of: http://stackoverflow.com/q/11001102
has body: I'm working on a client that consumes an https web service (client code created with JAX-WS RI). The server requires users authentication, provided with different PKCS12 files. When my client starts, I set the keystore and the truststore as follows: System.setProperty("javax.net.ssl.keyStore",fileKeystore); System.setProperty("javax.net.ssl.keyStorePassword",pwdKeystore); System.setProperty("javax.net.ssl.keyStoreType","PKCS12"); System.setProperty("javax.net.ssl.trustStore",fileTruststore); System.setProperty("javax.net.ssl.trustStorePassword",pwdTruststore); System.setProperty("javax.net.ssl.trustStoreType","JKS"); Then I consume the WS, and all works: string result = myClient.WSMethod(...); I know these system properties can't be changed in the same way once setted. So, if I need to change the keystore to consume the webservice, without restart my server, as another user, what should I do? In other words, I would achieve this behaviour: Consume the WS using keystore/truststore of user #1 Consume the WS using keystore/truststore of user #2 .... Searching on SO I read about creating an SSLContext but I'm a little bit confused about how to do that and assign it to the connection with the WS.
tagged with: web-services

http://stackoverflow.com/comment/34670971
comment on: http://stackoverflow.com/a/22746430
type: AnswerComment
score: 0
has text: @user3079108 It is most likely small because of the layout you are using on the frame. Did you change it? The default layout on a `JFrame` is `BorderLayout`, which shouldn't suppress the size of the frame, as long as you add it to `BorderLayout.CENTER`, which can be done by adding another parameter to `add` like so: `frame.add(panel, BorderLayout.CENTER);`.
type: Comment

http://stackoverflow.com/a/22749948
has comment: http://stackoverflow.com/comment/34678085
has comment: http://stackoverflow.com/comment/34678312
has comment: http://stackoverflow.com/comment/34678838
has body: Issue with the Import in MainActivity change this import android.app.ActionBar.TabListener; to import com.example.MainActivity.TabListener or change your custom TabListener class name.
has comment: http://stackoverflow.com/comment/34679218
has comment: http://stackoverflow.com/comment/34679091
downvote count: 0
answers question: http://stackoverflow.com/q/22748171
has comment: http://stackoverflow.com/comment/34678660
has comment: http://stackoverflow.com/comment/34678283
type: Answer
has comment: http://stackoverflow.com/comment/34678294
has comment: http://stackoverflow.com/comment/34678871
score: 1
has comment: http://stackoverflow.com/comment/34677799
upvote count: 1

http://stackoverflow.com/a/22915424
accepted answer of: http://stackoverflow.com/q/22760638
upvote count: 5
score: 5
type: AcceptedAnswer
downvote count: 0
has body: Well, you are looking for DF federation. As far as I understand, it is nothing but 'connecting' DFs. There is an example in yelloPages package in 'jade all examples' folder. It creates register,subscriber,searcher and a subDF agent. registrer agent registers agent with soe property and other agents do their jobs. SubDF creates child DF which involves DF Federation. For you, I modified the code as this: Next three agents run on port 1099 as: 1) package examples.yellowPages; import jade.core.Agent; import jade.core.AID; import jade.domain.DFService; import jade.domain.FIPAException; import jade.domain.FIPANames; import jade.domain.FIPAAgentManagement.DFAgentDescription; import jade.domain.FIPAAgentManagement.ServiceDescription; import jade.domain.FIPAAgentManagement.Property; /** This example shows how to register an application specific service in the Yellow Pages catalogue managed by the DF Agent so that other agents can dynamically discover it. In this case in particular we register a "Weather-forecast" service for Italy. The name of this service is specified as a command line argument. @author Giovanni Caire - TILAB */ public class DFRegisterAgent extends Agent { protected void setup() { String serviceName = "unknown"; // Read the name of the service to register as an argument Object[] args = getArguments(); if (args != null &amp;&amp; args.length &gt; 0) { serviceName = (String) args[0]; } // Register the service System.out.println("Agent "+getLocalName()+" registering service \""+serviceName+"\" of type \"weather-forecast\""); try { DFAgentDescription dfd = new DFAgentDescription(); dfd.setName(getAID()); ServiceDescription sd = new ServiceDescription(); sd.setName(serviceName); sd.setType("weather-forecast"); // Agents that want to use this service need to "know" the weather-forecast-ontology sd.addOntologies("weather-forecast-ontology"); // Agents that want to use this service need to "speak" the FIPA-SL language sd.addLanguages(FIPANames.ContentLanguage.FIPA_…
type: Answer
answers question: http://stackoverflow.com/q/22760638

synchronized
tags question: http://stackoverflow.com/q/22784209
type: Tag
tag name: synchronized
tags question: http://stackoverflow.com/q/22650465
tags question: http://stackoverflow.com/q/22756940
tags question: http://stackoverflow.com/q/22759934

http://stackoverflow.com/q/22751989
has answer: http://stackoverflow.com/a/22752042
score: 0
linked to: http://stackoverflow.com/q/8030101
answer count: 1
has title: How to get Class from a Type Inference argument?
has comment: http://stackoverflow.com/comment/34681226
has body: I have a class like this, and want to get the Class as showed by example (which doesn't works) in return of method getClazz. Is it possible? public abstract class SuperTestClass&lt;E&gt; { public Class&lt;?&gt; getClazz() { return E.getClass(); } }
duplicate of: http://stackoverflow.com/q/8030101
accepted answer: http://stackoverflow.com/a/22752042
tagged with: type-inference
type: AnsweredQuestion
tagged with: java
type: Question

semaphore
type: Tag
tags question: http://stackoverflow.com/q/22766988
tag name: semaphore
tags question: http://stackoverflow.com/q/22800120

http://stackoverflow.com/comment/34607330
score: 0
type: AnswerComment
has text: this.getClass().getResourceAsStream("ListApi.xsl") returns a InputStream and it cannot be used in creating a new FileInputStream object. Kindly help me to out with some other option.
comment on: http://stackoverflow.com/a/22710647
type: Comment

http://stackoverflow.com/comment/34736423
comment on: http://stackoverflow.com/q/22770068
has text: The fact that code is transformed into native code does not change it to unmanaged C, it is still fully managed Java. The difference is that the VM does not have to interpret bytecode (a bit like `if(currentByteCodeInstruction == ADD && valueOnStack == 5) { virtualRegister += 5 }`, it just executes pre-compiled pieces (in this example, instead of executing an `if` with two comparisons and then the actual addition the processor executes just the operations).
score: 1
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/34685266
type: Comment
has text: @MarcoAcierno yes gson doesnt use them but just in order to get the data :).. correct they should be private. I simple picked the user's classes :).. il change that.. :)
comment on: http://stackoverflow.com/a/22754230
score: 0
type: AnswerComment

http://stackoverflow.com/a/22649389
type: Answer
answers question: http://stackoverflow.com/q/22649351
has comment: http://stackoverflow.com/comment/34497450
score: 1
has body: listOfFiles is of type Files, not Strings
upvote count: 1
downvote count: 0

http://stackoverflow.com/comment/34534183
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/22670188
has text: Then format it. If you don't know how, go through the Help Center. Only post relevant code.

http://stackoverflow.com/comment/34743911
type: AnswerComment
comment on: http://stackoverflow.com/a/22713146
has text: rowCells.get(5).click(); webdriver.findElement(By.cssSelector("img[alt='Delete Project']")).click(); webdriver.findElement(By.xpath("//*[@id='deleteError_confirm']/table/tbody/tr[2]/td/input[1]")).click(); it is working but deleting first row from the table instead of particular row from table.
type: Comment
score: 0

http://stackoverflow.com/q/22776664
type: UnansweredQuestion
tagged with: gwt
tagged with: java
type: Question
has answer: http://stackoverflow.com/a/22783544
has answer: http://stackoverflow.com/a/22792085
score: 0
answer count: 2
has body: I am building a GWT app and wants to detect whether user has a internet connection or not. My main problem is detect internet at the time of making an asynchronous call. We are mainly using Chrome browser. I tried using this: public void onFailure(Throwable caught) { if (caught instanceof StatusCodeException &amp;&amp; ((StatusCodeException) caught).getStatusCode() == 0) { return "NoInternetConnnectivity"; } But I found that we receive 0 as status code in many other cases apart from internet connectivity.
tagged with: asynchronous
has title: Detecting offline and online status in GWT

http://stackoverflow.com/comment/34496293
comment on: http://stackoverflow.com/q/22648627
type: QuestionComment
type: Comment
has text: `byte byteValue = intObject;` - you do realize that's an error regardless of whether `intObject` is an object or a primitive type, right?
score: 0

http://stackoverflow.com/a/46340850
answers question: http://stackoverflow.com/q/22725537
upvote count: 5
has body: Late to the party, but what about things.stream() .map(this::resolve) .filter(Optional::isPresent) .findFirst().get(); You can get rid of the last get() if you create a util method to convert optional to stream manually: things.stream() .map(this::resolve) .flatMap(Util::optionalToStream) .findFirst(); If you return stream right away from your resolve function, you save one more line.
downvote count: 0
score: 5
type: Answer

http://stackoverflow.com/comment/34685079
type: AnswerComment
comment on: http://stackoverflow.com/a/22754100
score: 0
type: Comment
has text: @sin cite one... They work pretty well as far as I'm concerned. Of course, they are not a builtin part of the language like perl

http://stackoverflow.com/comment/34917334
type: AnswerComment
comment on: http://stackoverflow.com/a/22795610
score: 0
type: Comment
has text: It doesn't show up the alert, but the sessions exist.

http://stackoverflow.com/q/22793452
tagged with: jsp
tagged with: web
has body: I've created a website in JSP with Servlets. Users can login and they all get a session attribute with their userid. I created a page with a textbox and button where I can fill in an userid. Upon clicking the button I want to open a popup (url) on the browser of the specific user with the session userid equals to the userid filled in the textbox. The popup should appear immediately an not require a page request to get shown. What kind of things I should use for this? I googled, but couldn't find anything usefull.
score: 0
has title: Communicate with a specific browser
has comment: http://stackoverflow.com/comment/34755854
accepted answer: http://stackoverflow.com/a/22795610
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/34755738
type: Question
has answer: http://stackoverflow.com/a/22793648
tagged with: java
tagged with: servlets
has answer: http://stackoverflow.com/a/22795610
possible better answer: http://stackoverflow.com/a/22793648
answer count: 2

http://stackoverflow.com/comment/34622918
type: Comment
comment on: http://stackoverflow.com/a/22719396
has text: Still not plays? Are you sure texts are equals? Can you add debug messages inside actionPerfomed where you print .getLabel() ?
type: AnswerComment
score: 0

http://stackoverflow.com/comment/34591824
type: Comment
score: 0
type: AnswerComment
has text: @JohnGardner That's true. You have to love the courage of people who downvote questions and answers without leaving a comment...how are people suppose to learn or have the chance to improve the quality of the post :P
comment on: http://stackoverflow.com/a/22701762

http://stackoverflow.com/comment/34754910
type: QuestionComment
comment on: http://stackoverflow.com/q/22793006
score: 2
has text: one line shorter if you merge the increment `query.bind(idx++, e);` but that's all I can think of
type: Comment

quotes
tags question: http://stackoverflow.com/q/22789293
tags question: http://stackoverflow.com/q/22793989
tag name: quotes
type: Tag

http://stackoverflow.com/q/22710607
has answer: http://stackoverflow.com/a/22711058
type: Question
has answer: http://stackoverflow.com/a/22711019
has title: java enable the second textfield if the first textfield is not empty
score: 0
has comment: http://stackoverflow.com/comment/34607202
possible better answer: http://stackoverflow.com/a/22716071
accepted answer: http://stackoverflow.com/a/22711058
answer count: 3
tagged with: jtextfield
has answer: http://stackoverflow.com/a/22716071
tagged with: java
has body: I have 2 textfields in my project. The first textfield is txtNumA and the second is txtNumB. I disabled txtNumB. When txtNumA is not empty, txtNumB will be enabled. Well, this is part of code I've tried: private void txtNumKeyTyped(java.awt.event.KeyEvent evt) { if(!(txtNumA.getText().trim().equals(""))){ txtNumB.setEnabled(true); } else { txtNumB.setText(null); txtNumB.setEnabled(false); } } Actually it works, but not perfect. It works only if I typed 2 or more characters in txtNumA. What I need is when I typed one character and more, txtNumB will be enabled. What's wrong with my code?
type: AnsweredQuestion

http://stackoverflow.com/a/24854010
type: Answer
score: 2
has body: Had similar issues with eclipse luna on debian wheezy with oracle JDK7. Understand these are issues with GTK3. Resolved by exporting SWT_GTK3=0 before running eclipse. Via a script: #!/bin/bash export SWT_GTK3=0 /path_to_eclipse/eclipse
answers question: http://stackoverflow.com/q/22735527
upvote count: 3
downvote count: 1
has comment: http://stackoverflow.com/comment/107096195

http://stackoverflow.com/comment/82716996
type: Comment
has text: @alexbt The problem statement is to ensure that there is exactly one (no more, no fewer) matching element. After my code, one can test `result.size()` to make sure it equals 1. If it's 2, then there's more than one match, so it's an error. If the code instead did `limit(1)`, more than one match would result in a single element, which can't be distinguished from there being exactly one match. This would miss an error case the OP was concerned about.
score: 12
type: AnswerComment
comment on: http://stackoverflow.com/a/22717262

http://stackoverflow.com/q/22745154
tagged with: android
tagged with: textview
has answer: http://stackoverflow.com/a/22745203
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/22745363
type: Question
tagged with: java
answer count: 2
has body: I am reading from txt file some strings.TextView shows me:"score=10" "score=1""score=5""score=11" I want to sort this like:TextView shows:"score=1" "score=5""score=10""score=11" I dont know how to sort this strings.this are not ints. Can u Help me with an example ? Or can u see my code? protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.wyniki); final TextView scores = (TextView) findViewById(R.id.textView4); final Button button5 = (Button) findViewById(R.id.button5); String saved_scores = readText(); if (saved_scores.length()&gt;0){ scores.setText(saved_scores);} sort(); button5.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { final File f = new File(Environment.getExternalStorageDirectory()+"/cos/Wynik.txt"); if (f.exists()){ f.delete(); Toast.makeText(getApplicationContext(),"Deleted",Toast.LENGTH_SHORT).show(); scores.setText(null); } } }); } public String readText(){ //this is your text StringBuilder text = new StringBuilder(); try{ final File f = new File(Environment.getExternalStorageDirectory()+"/cos/Wynik.txt"); FileInputStream fileIS = new FileInputStream(f); BufferedReader buf = new BufferedReader(new InputStreamReader(fileIS)); String readString = ""; //just reading each line and pass it on the debugger while((readString = buf.readLine())!= null){ Log.d("line: ", readString); text.append(readString + "\n"); } buf.close(); } catch (FileNotFoundException e) { e.printStackTrace(); } catch (IOException e){ e.printStackTrace(); } return text.toString(); }
tagged with: sorting
has title: How to sort strings from txt file and post them to textview item
score: 0

http://stackoverflow.com/q/22679526
has title: How to work with JButton?
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/22679573
tagged with: java
has body: Hi I am trying to make java desk top application where I am using 3 JButtons. I want that when I click any JButton it should change the color of that button and if I click on any other JButton then previous clicked button should be like before and recently clicked button change its color until another JButton is clicked How can I achieve this here is my button code b1 = new JButton("Ok"); b1.setBounds(800, 725, 100, 40); b1.setForeground(Color.BLACK); c.add(b1); b2 = new JButton("Print"); b2.setBounds(925, 725, 100, 40); b2.setForeground(Color.BLACK); c.add(b2); b1.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent ae){ b1.setBackground(Color.BLUE); JOptionPane.showMessageDialog(frame,"Welcome to allhabad High Court"); } }); b2.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent ae){ b2.setBackground(Color.BLUE); JOptionPane.showMessageDialog(frame,"Welcome to allhabad High Court"); } });
tagged with: swing
tagged with: jbutton
type: Question
score: 0
has answer: http://stackoverflow.com/a/22679757
answer count: 2
has answer: http://stackoverflow.com/a/22679573
possible better answer: http://stackoverflow.com/a/22679757
tagged with: colors

http://stackoverflow.com/comment/34750397
score: 0
comment on: http://stackoverflow.com/a/22789537
type: AnswerComment
type: Comment
has text: Hi Thomas, thanks for your answer. Yeah I had tried this also (I'll update my question). My only problem with this approach is that there could be any number of interfaces to implement, so it could get very messy very quickly.

http://stackoverflow.com/q/22777633
has answer: http://stackoverflow.com/a/22783190
accepted answer: http://stackoverflow.com/a/22787278
tagged with: gwt
type: AnsweredQuestion
possible better answer: http://stackoverflow.com/a/22783190
has answer: http://stackoverflow.com/a/22787278
tagged with: java
has body: I have a GWT appilcation in which the client makes a request to another domain. I wrote the request using RequestBuilder in GWT. On executing the code, I get an error in my browser : No 'Access-Control-Allow-Origin' header is present on the requested resource. So I google and I found that the domain to which I am making the request should add this header in the response that it sends. Now I dont't have control over the other domain's server, so I can't do any modification there. My question is, can I intercept the response and the Access-Control-Allow-Origin header to the response that is being sent by the other domain's server at my server, before I send it to my client? I tried using Filters but the Filter doesn't get called for responses coming from another domain. Is this possible to do, am I missing something or is it just not possible?
tagged with: servlets
type: Question
score: 0
has title: Is it possible to add headers for CORS at the calling side server?
answer count: 2
tagged with: cors

http://stackoverflow.com/comment/34681947
type: QuestionComment
type: Comment
score: 2
comment on: http://stackoverflow.com/q/22752421
has text: You're printing the thread names on the client. Don't you want to know the thread names in your server program?

http://stackoverflow.com/comment/34768173
comment on: http://stackoverflow.com/a/22800057
type: AnswerComment
score: 0
type: Comment
has text: After your updated answer it will work fine. Before that it wont.

http://stackoverflow.com/q/22729865
has title: Mapreduce Program(Java) using Distributed Cache
tagged with: java
has body: Hi I am new to Hadoop Mapreduce programming. Actually I have a requirement like below: larger file i.e the input file input.txt 101 Vince 12000 102 James 33 103 Tony 32 104 John 25 105 Nataliya 19 106 Anna 20 107 Harold 29 And this is the smaller file lookupfile.txt 101 Vince 12000 102 James 10000 103 Tony 20000 104 John 25000 105 Nataliya 15000 Now what we want is to get those results which have common Id Number. So, in order to achieve this use smaller file as look up file and larger file as input file. The complete java code and explanation of each component is given below: This is the result we will get after running the above code. 102 James 33 10000 103 Tony 32 20000 104 John 25 25000 105 Nataliya 19 15000 Code: public class Join extends Configured implements Tool { public static class JoinMapper extends Mapper { Path[] cachefiles = new Path[0]; //To store the path of lookup files List exEmployees = new ArrayList();//To store the data of lookup files /********************Setup Method******************************************/ @Override public void setup(Context context) { Configuration conf = context.getConfiguration(); try { cachefiles = DistributedCache.getLocalCacheFiles(conf); BufferedReader reader = new BufferedReader(new FileReader(cachefiles[0].toString())); String line; while ((line = reader.readLine())!= null) { exEmployees.add(line); //Data of lookup files get stored in list object } } catch (IOException e) { e.printStackTrace(); } } /************************setup method ends***********************************************/ /********************Map Method******************************************/ public void map(LongWritable key, Text value, Context context)throws IOException, InterruptedException { String[] line = value.toString().split("\t"); for (String e : exEmployees) { String[] listLine = e.toString().split("\t"); if(line[0].equals(listLine[0])) { context.write(new Text(line[0]), new Text(line[1]+"\t"+line[2]+"\t"+listLine[2])); } } } //map met…
tagged with: mapreduce
type: Question
tagged with: hadoop
score: 0
answer count: 1
has answer: http://stackoverflow.com/a/22745714
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/34661341
has comment: http://stackoverflow.com/comment/34654038

http://stackoverflow.com/comment/82535947
has text: @nullpointer - Looks like you misunderstood desilvai's comment. Roberto's answer is still wrong even after your edits. Please revert the edits and downvote roberto's answer.
type: AnswerComment
score: 0
type: Comment
comment on: http://stackoverflow.com/a/22807363

tomcat7
tags question: http://stackoverflow.com/q/22714650
tags question: http://stackoverflow.com/q/22690260
tags question: http://stackoverflow.com/q/22798955
tags question: http://stackoverflow.com/q/22791153
type: Tag
tags question: http://stackoverflow.com/q/22656528
tags question: http://stackoverflow.com/q/22660842
tags question: http://stackoverflow.com/q/22764221
tags question: http://stackoverflow.com/q/22761373
tags question: http://stackoverflow.com/q/22744144
tag name: tomcat7
tags question: http://stackoverflow.com/q/22771000
tags question: http://stackoverflow.com/q/22761401
tags question: http://stackoverflow.com/q/22665723

http://stackoverflow.com/comment/34757918
has text: sorry for late reply guys I just saw all your comments and answers..... I used BorderLayout ............ .......thanks to all of you guys ........... eitanfar's code helped me out ............... :)
score: 0
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/22777780

http://stackoverflow.com/q/22792734
has comment: http://stackoverflow.com/comment/34755421
upvote count: 0
has comment: http://stackoverflow.com/comment/34755539
has comment: http://stackoverflow.com/comment/34755614
has body: I am making a login screen which is connected to the database shown below, I have the class called DatabaseHelper which contains all my tables and functions, and the main.java contains the codes below, and the register.java contains the following codes : package DatabaseHelper; public class DatabaseHelper extends SQLiteOpenHelper { //get reference to writable DB SQLiteDatabase db = this.getWritableDatabase(); // Database Version private static final int DATABASE_VERSION = 1; // Database Name private static final String DATABASE_NAME = "ExpenseManager"; // Table Names private static final String TABLE_user = "user"; private static final String TABLE_income = "income"; private static final String TABLE_store = "store"; // Common column names private static final String KEY_ID = "uid"; // user Table - column names public static final String KEY_username = "username"; public static final String KEY_password = "password"; private static final String KEY_email = "email"; private static final String KEY_url = "url"; private static final String KEY_amountalert = "amountalert"; private static final String KEY_currency = "currency"; // income Table - column names private static final String KEY_IID = "iid"; private static final String KEY_INCOMEDATE = "Incomedate"; private static final String KEY_AMOUNT = "amount"; private static final String KEY_INCOMETYPE = "Incometype"; // store Table - column names private static final String KEY_EID = "eid"; private static final String KEY_ITEM = "item"; private static final String KEY_PRICE = "price"; private static final String KEY_TYPE = "type"; private static final String KEY_DATE = "date"; private static final String KEY_PLACE = "place"; // Table Create Statements // user table create statement private static final String CREATE_TABLE_user = "CREATE TABLE " + TABLE_user + "(" + KEY_ID + " INTEGER PRIMARY KEY," + KEY_username + " TEXT," + KEY_password + " TEXT," + KEY_email + " TEXT, " + KEY_url + " TEXT," + KEY_amountalert + " FLOAT…
has title: Database using Eclipse
tagged with: sqlite
answer count: 1
has comment: http://stackoverflow.com/comment/34754859
favorite count: 0
has comment: http://stackoverflow.com/comment/34760115
type: UnansweredQuestion
tagged with: android
has answer: http://stackoverflow.com/a/22792817
score: -3
has comment: http://stackoverflow.com/comment/34760411
has comment: http://stackoverflow.com/comment/34755778
has comment: http://stackoverflow.com/comment/34756951
tagged with: java
downvote count: 3
has comment: http://stackoverflow.com/comment/34754501
type: Question

http://stackoverflow.com/comment/34533213
score: 0
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/22666988
has text: So I would really like to discuss some details and get advice on the general architecture aspects. I dont need rocket science NASA stuff here, just a decent enough model to get started without having to get an onsite solution from IBM

http://stackoverflow.com/q/22711213
score: 1
favorite count: 0
has comment: http://stackoverflow.com/comment/34608040
type: Question
has body: import java.util.HashSet; import java.util.concurrent.TimeUnit; import org.openqa.selenium.By; import org.openqa.selenium.WebDriver; import org.openqa.selenium.WebElement; import org.openqa.selenium.firefox.FirefoxDriver; import org.openqa.selenium.support.ui.Select; public class Demo27 { public static void main(String[] args) { WebDriver driver=new FirefoxDriver(); driver.manage().timeouts().implicitlyWait(20, TimeUnit.SECONDS); driver.get("file:///C:/Users/Administrator/Desktop/listDropdown.html"); WebElement listElement=driver.findElement(By.id("countrySelect")); Select select=new Select(listElement); List&lt;WebElement&gt; elements=select.getOptions(); int count=elements.size(); HashSet&lt;String&gt; set=new HashSet&lt;String&gt;(); for(int i=0;i&lt;count;i++) { WebElement singleElement=elements.get(i); String text=singleElement.getText(); if(!set.add(text)) { System.out.println(text+"is duplicated"); } } driver.close(); } }
has answer: http://stackoverflow.com/a/22711326
has comment: http://stackoverflow.com/comment/34609773
tagged with: java
tagged with: selenium
upvote count: 1
answer count: 1
has title: Need to supress sops for second duplicate String onwards.
has comment: http://stackoverflow.com/comment/34609700
accepted answer: http://stackoverflow.com/a/22711326
tagged with: duplicates
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/34608361
downvote count: 0
has comment: http://stackoverflow.com/comment/34608171

http://stackoverflow.com/q/22768787
tagged with: android
has comment: http://stackoverflow.com/comment/34712300
has body: I made class extends service and I wrote a separate thread sleeps for 1 sec My service and Thread: public class UpdaterService extends Service { private static String TAG = UpdaterService.class.getSimpleName(); private Updater updater; @Override public IBinder onBind(Intent intent) { return null; } @Override public void onCreate() { updater = new Updater(); updater.start(); Log.d(TAG, "Create'd"); super.onCreate(); } @Override public synchronized int onStartCommand(Intent intent, int flags, int startId) { Log.d(TAG, "Start'd"); return super.onStartCommand(intent, flags, startId); } @Override public void onDestroy() { Log.d(TAG, "Destroy'd"); super.onDestroy(); } class Updater extends Thread { ArrayList&lt;chatData&gt; list = new ArrayList&lt;chatData&gt;(); ArrayList&lt;String&gt; getContactsList = new ArrayList&lt;String&gt;(); Boolean thereIsNewData = false; SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(getApplicationContext()); String yourID = prefs.getString("KEY_USERNAME", "No login info available"); void getData(){ chatServiceHandler jsonParser = new chatServiceHandler(); ArrayList&lt;NameValuePair&gt; nvp = new ArrayList&lt;NameValuePair&gt;(); nvp.add(new BasicNameValuePair("yourID", yourID)); String json = jsonParser.makeServiceCall("http://example.com/getMSG.php", contactsServiceHandler.GET, nvp); Log.d("Response: ", "&gt; " + json); if (json != null) { try { JSONObject jsonObj = new JSONObject(json); if (jsonObj != null) { list.clear(); JSONArray contactsArray = jsonObj.getJSONArray("MSGhandling"); for (int i = 0; i &lt; contactsArray.length(); i++) { JSONObject catObj = (JSONObject) contactsArray.get(i); chatData cat = new chatData(catObj.getString("sender"), catObj.getString("receiver"),catObj.getString("msg"),catObj.getString("msgID")); list.add(cat); thereIsNewData = true; } } } catch (JSONException e) { e.printStackTrace(); thereIsNewData = false; } } else { Log.e("JSON Data", "Didn't receive any data from server!"); thereIs…
answer count: 0
tagged with: java
tagged with: multithreading
type: Question
score: 0
has comment: http://stackoverflow.com/comment/34712687
has title: Thread connection to web server lags 190-318/system_process E/ThrottleService
type: UnansweredQuestion

http://stackoverflow.com/q/22688692
accepted answer: http://stackoverflow.com/a/22689338
has answer: http://stackoverflow.com/a/22688892
possible better answer: http://stackoverflow.com/a/22688880
has comment: http://stackoverflow.com/comment/34566746
answer count: 4
has comment: http://stackoverflow.com/comment/34567787
score: 2
upvote count: 2
has comment: http://stackoverflow.com/comment/34567520
tagged with: multithreading
has comment: http://stackoverflow.com/comment/34566800
type: Question
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/34566690
has answer: http://stackoverflow.com/a/22689338
has comment: http://stackoverflow.com/comment/34566587
tagged with: java
has comment: http://stackoverflow.com/comment/34566444
has answer: http://stackoverflow.com/a/22688880
downvote count: 0
has answer: http://stackoverflow.com/a/22688871
has body: I have one thread that has this code while(!this.isInterrupted()) { try { socket = server.accept(); } catch(IOException e) { continue; } } When I call interrupt method from somewhere then it will stop executing only if it is checking condition. What if the program is at server.accept() statement? It will not stop till any request comes from any socket. I want that when I call interrupt method this should stop immediately. Is there any solution for this problem.
favorite count: 0
has title: How to stop this kind of thread?

spring-mongo
tags question: http://stackoverflow.com/q/22788269
type: Tag
tag name: spring-mongo

http://stackoverflow.com/comment/34521619
has text: Even if do so, in settings you can see that whatsapp still have 2 process and 1 service running, this service is MessageService. From there you can stop the service and its the only way.
comment on: http://stackoverflow.com/q/22662687
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/a/22757491
type: AcceptedAnswer
downvote count: 0
has body: The most simple way IMO: // create your output stream. Use the current running directory for your project FileOutputStream fout = new FileOutputStream(new File(System.getProperty("user.dir"), "test.txt")); // print it out so you know where it is... maybe? System.out.println(new File(System.getProperty("user.dir"), "test.txt")); byte[][] map = new byte[][] { { 0, 0, 0, 0, 0 }, { 1, 1, 1, 0, 0 } }; // loop through your map, 2d style for (int i = 0; i &lt; map.length; i++) { for (int j = 0; j &lt; map[i].length; j++) { // get the string value of your byte and print it out fout.write(String.valueOf(map[i][j]).getBytes()); } // write out a new line. For different systems the character changes fout.write(System.getProperty("line.separator").getBytes()); } // close the output stream fout.close();
type: Answer
score: 2
answers question: http://stackoverflow.com/q/22756853
upvote count: 2
accepted answer of: http://stackoverflow.com/q/22756853
has comment: http://stackoverflow.com/comment/34714395

http://stackoverflow.com/comment/34667662
type: QuestionComment
type: Comment
has text: won't the framework automatically detect it I've given as @Repository UserDaoImpl?
comment on: http://stackoverflow.com/q/22744666
score: 0

http://stackoverflow.com/a/22674986
answers question: http://stackoverflow.com/q/22674815
score: 0
has body: I believe you are referring to nested/inner classes and here is an example from C# and an example from java
type: Answer

http://stackoverflow.com/comment/34745266
type: Comment
type: QuestionComment
has text: My main objective here is that of retrieving data from multiple sensors at the same time. However it seems i have 2 issues 1) I cannot retrieve the data simultaneously 2) When implementing helper classes ( to avoid messy code) its only accessing the sensors after the above code executes (display info in textbox)
comment on: http://stackoverflow.com/q/22787538
score: 0

http://stackoverflow.com/a/22678272
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/34548557
accepted answer of: http://stackoverflow.com/q/22678169
answers question: http://stackoverflow.com/q/22678169
type: Answer
score: 3
downvote count: 0
has comment: http://stackoverflow.com/comment/34548488
has body: Your arguments being passed to your constructor should be flipped. In your application: Guitar1 = new StringPractice(brand, color); but in your code: public StringPractice(String clor, String brnd) {
upvote count: 3

http://stackoverflow.com/a/22687324
type: AcceptedAnswer
downvote count: 0
type: Answer
score: 1
upvote count: 1
has body: When you have a mapped field/property that is an interface type you need to use the @XmlElement annotation to specify the implementation type. @XmlElement(type=SelectionCriteriumImpl.class) public ArrayList&lt;SelectionCriterium&gt; getCriteria( ) { return criteria; } Additional Information You can find more information about this use case on my blog: http://blog.bdoughan.com/2011/05/jaxb-and-interface-fronted-models.html
answers question: http://stackoverflow.com/q/22685410
has comment: http://stackoverflow.com/comment/34566388
accepted answer of: http://stackoverflow.com/q/22685410

http://stackoverflow.com/comment/113511947
type: Comment
score: 1
comment on: http://stackoverflow.com/a/22670380
has text: @Alexandr as you asked, this below lambda single line code is much faster than traditional loops. I personally did experiment using JMH and was amazed over the results. ```DATA_FOR_TESTING.stream().peek(s -> bh.consume(s));``` Check out this link for how the above code was written in another iteration methods https://mkyong.com/java/java-jmh-benchmark-tutorial/
type: AnswerComment

http://stackoverflow.com/a/22687188
has comment: http://stackoverflow.com/comment/34563739
score: 3
downvote count: 1
has comment: http://stackoverflow.com/comment/34564136
has comment: http://stackoverflow.com/comment/34564394
upvote count: 4
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/22687028
answers question: http://stackoverflow.com/q/22687028
has comment: http://stackoverflow.com/comment/34564981
type: Answer
has body: Try this: System.out.println("Your initials are " + achar + "" + bchar); I think this shouldn't happen but it smells like char addition. For example: char a='a'; char b='b'; System.out.println( a+b ); ==&gt; 195
has comment: http://stackoverflow.com/comment/34564066

http://stackoverflow.com/a/22733065
has comment: http://stackoverflow.com/comment/34647691
has comment: http://stackoverflow.com/comment/34647458
downvote count: 0
has body: Pseudo code: Generate a random number for first index range [0,9] Generate a random number for the second index range [0,9] Check if it has already been set: if it has repeat until this is false if it hasn't, continue below Set the location Repeat 19 more times.
type: Answer
answers question: http://stackoverflow.com/q/22733023
upvote count: 2
score: 2

http://stackoverflow.com/comment/34693994
type: Comment
type: QuestionComment
has text: *"My solution: instead of creating real lines, I use little dots to construct lines"* - this does not really sound like a solution, but rather like a source of new problems. Any particular reason *why* you are doing it this way?
score: 1
comment on: http://stackoverflow.com/q/22757105

http://stackoverflow.com/q/22659970
upvote count: 11
tagged with: db2
has title: Lob is closed. ERRORCODE=-4470, SQLSTATE=null
has answer: http://stackoverflow.com/a/76239970
answer count: 3
downvote count: 0
has answer: http://stackoverflow.com/a/51362940
favorite count: 0
score: 11
has body: I am using IBM websphere commerce and db2, have following piece of code Clob clobVar = null; if (result.elementAt(3) != null) clobVar = (Clob) result.elementAt(3); if (clobVar == null) { infoTable.put("EInfo", ""); } else { stringTemp = clobVar.getSubString(1, (int) clobVar.length()); infoTable.put("EInfo", stringTemp); } Code works fine till clobVar = (Clob) result.elementAt(3); but as soon as execution comes to stringTemp = clobVar.getSubString(1, (int) clobVar.length()); System throws an exception [jcc][10120][11936][4.3.111] Invalid operation: Lob is closed. ERRORCODE=-4470, SQLSTATE=null What I am doing wrong? How to resolve this issue?
type: UnansweredQuestion
tagged with: java
tagged with: websphere-commerce
type: Question
tagged with: jakarta-ee
has answer: http://stackoverflow.com/a/22760068

http://stackoverflow.com/a/22799874
score: 3
answers question: http://stackoverflow.com/q/22799389
upvote count: 3
downvote count: 0
type: Answer
has body: This is allowed, but there is grave danger associated with it and some compilers will give you a warning. It has nothing to do with the super class being abstract, or the methods being abstract. It has to do with base class calling non-final methods. Consider the following: class Base { SomeObject s; Base() { s = new SomeObject(); foo(); } void foo() { s.someMethod(); } } class Der { SomeOtherObject o; Der() { super(); o = new new SomeOtherObject();} @Override foo() { o.someOtherMethod(); } } What happens when Der is created? Der() is called Base() is called Base.s is initialized foo() is called Call is dispatched to Der.foo() Der.foo calls o.someOtherMethod At this point Der.o is null and you get a NullPointerException (Virtual member call in a constructor)[Virtual member call in a constructor has a nice explanation of the topic. It is for C# but applies just as well to java.

http://stackoverflow.com/comment/34722600
has text: @nyx Java is not nearly as dynamic as ruby and python, but this translates into better runtime performance because a property access does not have the overhead of a function call. The JVM also optimizes away simple getters/setters to have no function call overhead.
type: AnswerComment
type: Comment
score: 1
comment on: http://stackoverflow.com/a/22774817

http://stackoverflow.com/comment/34753711
has text: The `^` operation can be reversed by re-applying itself: `x^n ^n == x`
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/22760510
score: 0

http://stackoverflow.com/a/22787488
score: -1
has body: Once the cursor is retrieved from the query, it has nothing to do with the actual database, besides representing the db's data. Even if you were able to change the row in a cursor, which you are not able to, it wouldn't effect the database.
upvote count: 0
answers question: http://stackoverflow.com/q/22787121
type: Answer
has comment: http://stackoverflow.com/comment/34744766
downvote count: 1

http://stackoverflow.com/comment/34734850
type: Comment
type: QuestionComment
score: 0
has text: yes they are not invoking
comment on: http://stackoverflow.com/q/22780355

http://stackoverflow.com/comment/34520550
comment on: http://stackoverflow.com/q/22660651
type: Comment
has text: Can you try with `private Set<String> strings = new HashSet<String>();` instead of `new HashSet<>();`
type: QuestionComment
score: 0

http://stackoverflow.com/a/22686688
has comment: http://stackoverflow.com/comment/34563376
upvote count: 1
accepted answer of: http://stackoverflow.com/q/22683155
score: 1
has body: Try this: import java.awt.BorderLayout; import java.awt.Color; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import javax.swing.JButton; import javax.swing.JFrame; import javax.swing.JPanel; public class Window extends JFrame implements ActionListener { int lg = 1000; int lrg = 700; int h = 2; Panel b = new Panel(); private JButton btn = new JButton("Start"); JButton bouton = new JButton(); private JPanel container = new JPanel(); Panel boutonPane = new Panel(); public Window() { this.setTitle("Animation"); this.setSize(300, 300); this.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); this.setLocationRelativeTo(null); container.setBackground(Color.white); container.setLayout(new BorderLayout()); JPanel top = new JPanel(); btn.addActionListener(this); top.add(btn); container.add(top); this.setContentPane(container); this.setVisible(true); } public void Window2() { System.out.println("windows2"); this.setTitle("ADHD"); this.setSize(lg, lrg); this.setLocationRelativeTo(null); bouton.addActionListener(this); if (h &lt; 11) { boutonPane.Panel2(h, Color.BLUE, lg, lrg, this.getGraphics()); System.out.println("draw" + h); boutonPane.add(bouton); this.add(boutonPane); this.setContentPane(boutonPane); updateWindow2(); } this.setVisible(true); } public void updateWindow2() { boutonPane.Panel2(h, Color.BLUE, lg, lrg, this.getGraphics()); this.revalidate(); this.repaint(); } public void actionPerformed(ActionEvent e) { if ((JButton) e.getSource() == btn) { System.out.println("pressed0"); Window2(); } if ((JButton) e.getSource() == bouton) { h++; System.out.println("pressed" + h); updateWindow2(); } } public static void main(String[] args) { Test t = new Test(); } } What you did wrong was adding a new BoutonPane every time you clicked the button. The next time you clicked the button, you didn't click ONE button, but TWO buttons, adding two more boutonPanes, and two more buttons. This multiplies very quickly. What I did was the following: make boutonPane a…
has comment: http://stackoverflow.com/comment/34568074
type: AcceptedAnswer
downvote count: 0
type: Answer
answers question: http://stackoverflow.com/q/22683155

http://stackoverflow.com/comment/34738011
has text: yes now working fine, for every time i have to follow this steps? any alternative is there. thanks..
comment on: http://stackoverflow.com/a/22783494
score: 0
type: AnswerComment
type: Comment

http://stackoverflow.com/comment/35121617
comment on: http://stackoverflow.com/q/22791677
score: 0
has text: yeah i had to try how to do it!:) it's working now! Thank you all!
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/34594563
score: 0
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/22703373
has text: @Dog A compilation unit is a single file that gets compiled. So a single `.java` file. As for Java 8, see the tutorial on [Local Classes](http://docs.oracle.com/javase/tutorial/java/javaOO/localclasses.html) on `Accessing Members of an Enclosing Class`. I don't have the link to the JLS now. Please don't ask for it :|. I'll find it if you really want.

http://stackoverflow.com/comment/34742574
type: Comment
has text: I did not know the _Workspace resolution_ feature. Thanks for the hint. I will look into it. Currently the plain java projects are still built by Maven 1. So maybe this is a problem.
type: AnswerComment
score: 0
comment on: http://stackoverflow.com/a/22765955

http://stackoverflow.com/comment/34662914
score: 0
has text: Are you sure, you are not getting any string from the web-service ? See line 5 of logcat.
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/22737265

http://stackoverflow.com/comment/34684194
comment on: http://stackoverflow.com/q/22753660
type: Comment
has text: Should the last line (`I need`) really be in the result?
score: 0
type: QuestionComment

http://stackoverflow.com/comment/34504961
type: Comment
comment on: http://stackoverflow.com/q/22653769
type: QuestionComment
has text: @fge It is quite long to include, however, is there really any useful information that can be obtained from the code? my tests uses the exact same classes. Literally same files.
score: 0

http://stackoverflow.com/q/22802016
has answer: http://stackoverflow.com/a/22802157
answer count: 5
has comment: http://stackoverflow.com/comment/34771103
tagged with: embedded-resource
tagged with: swing
has answer: http://stackoverflow.com/a/22868842
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/22802336
has comment: http://stackoverflow.com/comment/34771240
has answer: http://stackoverflow.com/a/22802171
tagged with: java
linked to: http://stackoverflow.com/q/2195445
tagged with: eclipse
has title: Java Swing: Runnable JAR file does not work when including images
linked to: http://stackoverflow.com/q/22733881
type: Question
has comment: http://stackoverflow.com/comment/34771172
accepted answer: http://stackoverflow.com/a/22868842
tagged with: jar
has answer: http://stackoverflow.com/a/22802985
has comment: http://stackoverflow.com/comment/34890903
score: 0
has body: The code below works fine in Eclipse (both image-handling possibilities). But when exporting as a Runnable JAR File, and double-clicking the .JAR, nothing happens. If I comment out the image parts of the code, the .JAR runs fine as an export and the frame builds. So it seems the getting of the image is causing the .JAR to fail. I've got the strawberry.jpg file sitting in 'C:\Users\sean\workspace\myApps\bin\testing' Could you advise if the issue is with my code? (Code first modified here: Java Swing: unable to load image using getResource) package testing; import java.awt.*; import java.awt.image.BufferedImage; import java.io.IOException; import javax.imageio.ImageIO; import javax.swing.*; import java.awt.*; import java.io.IOException; import java.io.InputStream; public class IconTest { public static void main(String[] arguments) throws IOException { JFrame frame1 = new JFrame(); frame1.setTitle("Frame1"); frame1.setSize(500, 500); frame1.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); FlowLayout flo = new FlowLayout(); frame1.setLayout(flo); //POSSIBILITY 1 TO HANDLE IMAGE InputStream resourceAsStream = IconTest.class.getResourceAsStream("strawberry.jpg"); Image image = ImageIO.read(resourceAsStream); JLabel label1 = new JLabel(new ImageIcon(image)); //POSSIBILITY 2 TO HANDLE IMAGE /* java.net.URL url= IconTest.class.getResource("strawberry.jpg"); BufferedImage watermarkImage = ImageIO.read(url); JLabel label1 = new JLabel(new ImageIcon(watermarkImage));*/ frame1.add(label1); frame1.setVisible(true); } }
possible better answer: http://stackoverflow.com/a/22802157

http://stackoverflow.com/comment/34640232
type: Comment
has text: Thanks a lot ,it worked..thanks..Just did what you said. st.setInt(9,Integer.parseInt(t1));
comment on: http://stackoverflow.com/a/22729032
type: AnswerComment
score: 0

http://stackoverflow.com/comment/34619626
type: Comment
has text: @leo Yes I am using the same StringUtils.getLevenshteinDistance, but my question is if the distance is same , I want to chose the one which match the most starting from left.
score: 0
type: QuestionComment
comment on: http://stackoverflow.com/q/22717642

http://stackoverflow.com/q/22771298
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/22771545
tagged with: java
has title: Third party bundle imports and uses any version of a package exported by system bundle
type: Question
has body: I have two third party bundles that both depend on the javax.transaction package. This package is exported by the system bundle as version 0.0.0. One of the bundles imports any version of the package and declares it as a uses-constraint on its exported package. The other bundle explicitly requires version 1.1.0. This package is provided by a different bundle. My own bundle requires both third party bundles. However, since the system bundle is resolved first, the third party bundle that accepts any version is wired against version 0.0.0. As a result, a package uses conflict arises. What are the options to fix this?
answer count: 2
score: 0
has answer: http://stackoverflow.com/a/22779497
tagged with: equinox
tagged with: osgi

http://stackoverflow.com/a/22779218
score: 38
type: Answer
has body: Only local primitive variables and references to object (i.e. variable declared in method) are stored in stack. Others are stored in heap
upvote count: 38
downvote count: 0
answers question: http://stackoverflow.com/q/22779145

http://stackoverflow.com/a/22771551
accepted answer of: http://stackoverflow.com/q/22771471
has comment: http://stackoverflow.com/comment/34716696
downvote count: 0
score: 7
answers question: http://stackoverflow.com/q/22771471
has comment: http://stackoverflow.com/comment/34716709
has body: The first and second methods return the reference to the object, the finally block is executed later, what happens in the first example is that you still keep the reference to the object (the builder) so you can modify it. In the second example you have a string, which also is inmutable, so you are not able to modify it, only assign it a new object to the variable. But the object which you have returned is not modified. So when you do str = str + "fail"; you assign to your variable str a new object. In the third example you have an integer, which is not an object, it returns it´s value, later in the finally block you assign your variable to a new integer, but the returned one is not modified Detailed explanation: Imagine a fourth case: public static class Container{ public int value = 0; } protected static Container setOne(){ Container container = new Container(); try{ container.value = 20; return container ; }finally{ container.value = container.value + 10; } } This function retrieves the reference to a variable called container, and after returning it it increments the container's value field to +10, so when you exit the function, the container.value will be at 30, just like in the StringBuilder example. Let´s compare this method with the third example (the int method): If you get the bytecode of this two methods you get: For the example of the int: bipush 10 istore_0 bipush 20 istore_0 iload_0 istore_2 iinc 0 10 iload_2 ireturn &lt;- return point astore_1 iinc 0 10 &lt;- retrieve the variable value and add 10 to it's value aload_1 &lt;- Store the value of the result of the sum. athrow For the example of the Container wrapper class: new Test4$Container dup invokespecial Test4$Container/&lt;init&gt;()V astore_0 aload_0 bipush 20 putfield Test4$Container/value I aload_0 astore_2 aload_0 aload_0 getfield Test4$Container/value I bipush 10 iadd putfield Test4$Container/value I aload_2 areturn &lt;-- Return point astore_1 &lt;-- Stores the reference aload_0 aload_0 getf…
upvote count: 7
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/34718604
has comment: http://stackoverflow.com/comment/34716799
type: Answer
has comment: http://stackoverflow.com/comment/34716628

http://stackoverflow.com/comment/34757496
score: 0
has text: Please tell him also to compare strings via equals.
type: Comment
comment on: http://stackoverflow.com/a/22794364
type: AnswerComment

http://stackoverflow.com/a/22758565
answers question: http://stackoverflow.com/q/22757434
score: 0
type: Answer
has body: You can use the java Executors, included in version 7. You reuse the thread instance and the LoadTask instance. import java.util.concurrent.Executors; import java.util.concurrent.ScheduledExecutorService; import java.util.concurrent.ScheduledFuture; import java.util.concurrent.TimeUnit; public class Render { private final LoadTask yourDelayedTask; private ScheduledExecutorService scheduler; private static final long DELAY_MS = 1000; public Render() { scheduler = Executors.newScheduledThreadPool(1); yourDelayedTask = new LoadTask(); } private ScheduledFuture&lt;?&gt; lastScheduledTask; public void refresh() { if (lastScheduledTask != null &amp;&amp; !lastScheduledTask.isCancelled() || !lastScheduledTask.isDone()) { // Review this logic lastScheduledTask.cancel(true); } lastScheduledTask = scheduler.schedule(yourDelayedTask, DELAY_MS, TimeUnit.MILLISECONDS); } private class LoadTask implements Runnable { @Override public void run() { // request the server } } }

http://stackoverflow.com/comment/34688086
score: 1
comment on: http://stackoverflow.com/a/22755788
type: AnswerComment
type: Comment
has text: why should it make any difference?

http://stackoverflow.com/q/22664865
score: 1
has comment: http://stackoverflow.com/comment/34525989
has comment: http://stackoverflow.com/comment/34524786
downvote count: 1
type: Question
has comment: http://stackoverflow.com/comment/34525040
possible better answer: http://stackoverflow.com/a/22665099
tagged with: java
has body: I've researched this issue a great deal, but have not been very successful in finding a solution close to my situation. I apologize if I am redundant. Anyway, I am new to generics and so I'm not entirely clear on the syntax. But here is my situation: I have an Interface (let's call it IService) and an implementation (ServiceImpl). The implementation class has an abstract method that is to be overridden by an extending class (ServiceExt). I have an abstract bean (let's call it AbstractBean) which has a few fields and is meant to be extended by another bean (BeanExt) in order to add some more fields. Ok, now that the situation is laid out, here is my abbreviated code: &nbsp; Interface: public interface IService &lt;B extends AbstractBean&gt; { B method(B bean, Object data) throws Exception; } Implementation: public abstract class ServiceImpl &lt;B extends AbstractBean&gt; implements IService&lt;B&gt; { public abstract B method(B bean, Object data); } Abstract Bean: public abstract class AbstractBean{ private String fname; private String lname; [getters and setters] } Extended Bean: public class BeanExt extends AbstractBean{ private String phoneNum; [getter and setter] } Extending Class: aka Class giving me issues public class ServiceExt &lt;B extends AbstractBean&gt; extends ServiceImpl &lt;B&gt; { @Override public &lt;B&gt; BeanExt method(Bbean, Object data) { if(beaninstanceof AbstractBean){ BeanExt beanExt = (BeanExt) session; beanExt.setFname("John"); beanExt.setLname("Doe"); beanExt.setPhoneNum("123456789"); return beanExt; }else{ return null; } } } Ok, so now eclipse is giving me all kinds of non-descriptive issues and I don't know what to do. I've played around with the extending class methods a ton but have not found success. Above is how it looks after my last tinkering. The issues currently presented by my IDE within the class ServiceExt are: The method method(B, Object) of type ServiceImpl must override or implement a supertype method The type ServiceExt mu…
has comment: http://stackoverflow.com/comment/34524889
has title: Using Generics and extending Abstract classes
has answer: http://stackoverflow.com/a/22665146
answer count: 3
has comment: http://stackoverflow.com/comment/34525285
has comment: http://stackoverflow.com/comment/34524644
favorite count: 0
has comment: http://stackoverflow.com/comment/34525793
has comment: http://stackoverflow.com/comment/34525277
has comment: http://stackoverflow.com/comment/34525642
tagged with: abstract
has comment: http://stackoverflow.com/comment/34525563
tagged with: generics
accepted answer: http://stackoverflow.com/a/22665146
has answer: http://stackoverflow.com/a/22665151
type: AnsweredQuestion
upvote count: 2
has answer: http://stackoverflow.com/a/22665099

http://stackoverflow.com/comment/34590086
has text: no problem, just got round to implementing your code by the way, its throwing me a couple of errors so changed a couple of things.
score: 0
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/22699195

http://stackoverflow.com/comment/34714759
type: QuestionComment
has text: Is this the actual code you're using? You're calling methods on `Rectangle3` that don't appear to exist, like `getReal()` and `getImag()`
comment on: http://stackoverflow.com/q/22770512
score: 1
type: Comment

http://stackoverflow.com/q/22713652
has answer: http://stackoverflow.com/a/22714153
has comment: http://stackoverflow.com/comment/34612099
has comment: http://stackoverflow.com/comment/34619731
has comment: http://stackoverflow.com/comment/34612247
has answer: http://stackoverflow.com/a/22713721
has comment: http://stackoverflow.com/comment/34619793
has comment: http://stackoverflow.com/comment/34612153
has comment: http://stackoverflow.com/comment/34612109
downvote count: 2
linked to: http://stackoverflow.com/q/22591499
tagged with: default-implementation
has title: Can an interface method have a body?
has comment: http://stackoverflow.com/comment/34620726
favorite count: 0
has answer: http://stackoverflow.com/a/22721153
has comment: http://stackoverflow.com/comment/34623234
has comment: http://stackoverflow.com/comment/34623388
possible better answer: http://stackoverflow.com/a/22714153
tagged with: interface
has comment: http://stackoverflow.com/comment/34612119
has comment: http://stackoverflow.com/comment/34612064
tagged with: java-8
has comment: http://stackoverflow.com/comment/34612158
answer count: 4
has body: I know that an interface is like a 100% pure abstract class. So, it can't have method implementation in it. But, I saw a strange code. Can anyone explain it? Code Snippet: interface Whoa { public static void doStuff() { System.out.println("This is not default implementation"); } } EDIT: My IDE is Intellij Idea 13.1. The project SDK is java 7 &lt;1.7.0_25>. The IDE is not showing any compiler error. But, When I compile the code at command line I am getting the following message. Whoa.java:2: error: modifier static not allowed here public static void doStuff() { ^
type: AnsweredQuestion
upvote count: 94
tagged with: java
accepted answer: http://stackoverflow.com/a/22713721
has answer: http://stackoverflow.com/a/72991743
type: Question
score: 92
has comment: http://stackoverflow.com/comment/34612161
has comment: http://stackoverflow.com/comment/34622963

http://stackoverflow.com/comment/34550113
has text: for login we have to give like this example@gmail.com or example@chatfacebook.com
type: AnswerComment
score: 0
type: Comment
comment on: http://stackoverflow.com/a/22677511

http://stackoverflow.com/a/22723576
upvote count: 3
has comment: http://stackoverflow.com/comment/35241553
has comment: http://stackoverflow.com/comment/34631396
accepted answer of: http://stackoverflow.com/q/22723496
answers question: http://stackoverflow.com/q/22723496
has body: Nothing wrong with the key but may be a little bit with docs: -1 is an integer key, '-1' is a string, '' is an empty char, "" is an empty string, but the key should not be empty. Thus -1, '-1', ' ', " " are valid values. From the docs: '1' is a char, '01' is a String, "1" is a String. This is important since if the value returned by your "value" attribute is NOT the same type as the key in the "list" attribute, they WILL NOT MATCH, even though their String values may be equivalent. If they don't match, nothing in your list will be auto-selected. You should provide to the listKey attribute a corresponding field type, so -1 is for integer of numeric types, rather than ' ' and " " are for character and string types. The framework uses a type conversion when comparing keys and values of the select tag and to avoid a typecast errors occurred somewhere at the OGNL runtime you'd better provide the type correctly and two key attributes have the same type. And if the key value, which should be not empty, matches the value specified in the both attributes the header value option will be populated.
score: 3
type: AcceptedAnswer
downvote count: 0
type: Answer

country
tag name: country
tags question: http://stackoverflow.com/q/22683448
type: Tag

http://stackoverflow.com/q/22772961
favorite count: 0
has comment: http://stackoverflow.com/comment/34719386
type: UnansweredQuestion
linked to: http://stackoverflow.com/q/8687765
score: 2
has body: According to the java docs, it says that If SingleThreadModel is used there are two ways a servlet instance will be created and used 1. Create one servlet instance and make the service() method synchronized and thus allow only one thread to execute the service method. 2. Create a pool of servlets and serve the request by using one servlet instance from the pool for each request. THe question which I want to ask is I have also read a new Servlet instance is created and destroyed for every request. Now which one is correct
downvote count: 0
tagged with: java
has answer: http://stackoverflow.com/a/22773056
type: Question
tagged with: servlets
upvote count: 2
has title: Life cycle management of servlet when SingleThreadModel is used
answer count: 2
has answer: http://stackoverflow.com/a/22773488

http://stackoverflow.com/comment/34522097
has text: can i show my complete code
comment on: http://stackoverflow.com/q/22663387
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/a/22720202
has body: Try to make a constructor and pass the parent activity as a parameter when you call this class. Here's an example: Activity activity; public MyCustomWebViewClient (Activity _activity) { this.activity = _activity; } Then use it: final ProgressDialog pd = ProgressDialog.show(activity, "", "Loading...", true);
type: Answer
answers question: http://stackoverflow.com/q/22716900
score: 0

http://stackoverflow.com/q/22726597
has answer: http://stackoverflow.com/a/22957786
has body: I'm creating a process using the Process Builder and do a waitFor() to suspend the current thread till the process completes. Should I do a process.destroy() in a finally block after the process has executed, to ensure the process resources can be reclaimed? Or close the streams associated with the process at the very least? Would that be necessary even after waitFor()?
downvote count: 0
score: 1
favorite count: 0
type: Question
tagged with: memory-leaks
has title: Should a new process created in a Java program be destroyed after use?
tagged with: process
upvote count: 1
answer count: 1
tagged with: java
type: UnansweredQuestion

http://stackoverflow.com/comment/34541759
score: 0
type: Comment
has text: David, while your code works, this is a `O(n²)` algorithm, OP algorithm is already `O(n)`, there are `O(n)` algorithms available (like the ones that I linked as duplicates).
type: AnswerComment
comment on: http://stackoverflow.com/a/22674076

http://stackoverflow.com/comment/34668608
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/22742229
score: 0
has text: It can't. Why do you wan to destroy beans and still hold reference to them?

http://stackoverflow.com/comment/34642198
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/22730034
has text: ListView visible when desc or image not big, but if image on the fullscreen - Listview not visible, because i can not to scroll down. I want make comments, in the top info about post, in the bottom user comments.
score: 0

http://stackoverflow.com/comment/34586493
type: Comment
score: 0
has text: Do you want to include text files in the projects final jar?
comment on: http://stackoverflow.com/q/22690762
type: QuestionComment

http://stackoverflow.com/a/22683054
score: 1
has body: You're performing integer division and multiplication and storing that result in a float variable. use float literals instead. E.g. 100f
upvote count: 1
answers question: http://stackoverflow.com/q/22682936
type: Answer
downvote count: 0

http://stackoverflow.com/q/22664272
score: 4
has body: I have a dependency to an external web service in my @BeforeClass method. The dependency keeps timing out. I need to retry this a couple of times. @BeforeClass public void setup() { //Call to dependency } @Test public void test() { //The actual test } I use the retryAnalyzer to retry my tests. for eg @Test(retryAnalyzer = RetryDecider.class) public void test() { //The actual test } Is there something similar for @BeforeClass ?
favorite count: 0
has comment: http://stackoverflow.com/comment/34548162
has comment: http://stackoverflow.com/comment/34526326
tagged with: testng
answer count: 0
has title: How to Retry @BeforeClass method in testng?
type: UnansweredQuestion
tagged with: java
has comment: http://stackoverflow.com/comment/34523671
has comment: http://stackoverflow.com/comment/34548218
type: Question
upvote count: 4
downvote count: 0

http://stackoverflow.com/q/22707099
has title: Split the time given based on the number of digits
has comment: http://stackoverflow.com/comment/34600353
answer count: 2
tagged with: validation
downvote count: 0
favorite count: 0
has answer: http://stackoverflow.com/a/22707176
has body: I have string which holds a time. For example, String time = "11235678"; The above time is in HH MM SS MS (Hours, Minutes, Seconds, Milliseconds). There is no guarantee that seconds and milliseconds are received all the time but if I receive it I must split accordingly. Now I know we can use the length split the string but I want to know if there is any better way of doing it? Cheeers!!!
tagged with: datetime
upvote count: 1
type: AnsweredQuestion
score: 1
tagged with: java
possible better answer: http://stackoverflow.com/a/22707400
tagged with: date
has comment: http://stackoverflow.com/comment/34600513
has answer: http://stackoverflow.com/a/22707400
type: Question
accepted answer: http://stackoverflow.com/a/22707176
has comment: http://stackoverflow.com/comment/34600473

http://stackoverflow.com/q/22744355
has comment: http://stackoverflow.com/comment/34670104
has comment: http://stackoverflow.com/comment/34668176
linked to: http://stackoverflow.com/q/7408921
has title: Adding .class file to NetBeans project
linked to: http://stackoverflow.com/q/2193226
has comment: http://stackoverflow.com/comment/34668019
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/34668091
has comment: http://stackoverflow.com/comment/34667961
tagged with: netbeans
has comment: http://stackoverflow.com/comment/34668494
has comment: http://stackoverflow.com/comment/34668465
answer count: 0
has comment: http://stackoverflow.com/comment/34667608
has comment: http://stackoverflow.com/comment/34669343
type: Question
has comment: http://stackoverflow.com/comment/34668676
has comment: http://stackoverflow.com/comment/34667381
has comment: http://stackoverflow.com/comment/34668825
tagged with: java
has body: I have an assignment in school to use a given .class file in java application. The file is for reading input that the user gives. I have created a .jar file containing the .class file and added it to my project library in NetBeans, but my application does not recognise it. How do I get to use the methods provided in the file/library?
has comment: http://stackoverflow.com/comment/34667938
score: 0
has comment: http://stackoverflow.com/comment/34667539
has comment: http://stackoverflow.com/comment/34667449

http://stackoverflow.com/comment/34542717
type: Comment
type: QuestionComment
has text: Let's say; numbers first, independent of type, then strings.
comment on: http://stackoverflow.com/q/22674750
score: 0

http://stackoverflow.com/comment/34629498
comment on: http://stackoverflow.com/q/22707942
score: 0
type: Comment
has text: You need to use the Java Metro 2.1 Library. Please see http://stackoverflow.com/questions/22332829/java-web-service-client-to-wcf-web-service-server-interoperability-solution/22722503#22722503
type: QuestionComment

http://stackoverflow.com/comment/34639439
score: 0
type: Comment
has text: Can I draw the grids on an image which is as an icon on a jLabel?
comment on: http://stackoverflow.com/a/22728604
type: AnswerComment

http://stackoverflow.com/comment/34617953
type: AnswerComment
comment on: http://stackoverflow.com/a/22716722
type: Comment
has text: i didnt get ur answer
score: 0

http://stackoverflow.com/a/22794036
has body: To accomplish this configuration, I had to upgrade my web.xml to Servlet 3.0 specification. This way, on the administration console, by selecting the application I can know access a option to configure the deployed Web Services, and on Configuration > WS-Policy I can add configure TLS security. Here is a link to use as reference: Oracle WebLogic documentation - How to configure WS-Policy
score: 0
type: AcceptedAnswer
type: Answer
answers question: http://stackoverflow.com/q/22712438
accepted answer of: http://stackoverflow.com/q/22712438

http://stackoverflow.com/comment/34809954
comment on: http://stackoverflow.com/q/22737535
has text: If you get any probems, I hope my solution will help you too.
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/a/22778235
has body: A Comparator "has" to return -1 if rhs is "more" than lhs, 0 if they're equal and 1 if it's less. This is so the sorting is actually consistent (if you sort rhs comparing it to lhs and lhs comparing it to rhs it has to have the opposite result, or 0). The following Comparator does that: private class CustomComparator implements Comparator&lt;Spot&gt; { @Override public int compare(Spot lhs, Spot rhs) { if (lhs.isStar == rhs.isStar) return 0; else if (lhs.isStar) return 1; return -1; } } You also have to actually sort it, but I'm guessing you know how to do that (Collections.sort(arrayList, comparator)).
upvote count: 1
type: AcceptedAnswer
type: Answer
answers question: http://stackoverflow.com/q/22778180
accepted answer of: http://stackoverflow.com/q/22778180
downvote count: 0
has comment: http://stackoverflow.com/comment/34729474
score: 1

http://stackoverflow.com/q/22730611
has answer: http://stackoverflow.com/a/22733627
has comment: http://stackoverflow.com/comment/34651798
type: Question
has comment: http://stackoverflow.com/comment/34648777
answer count: 1
downvote count: 0
accepted answer: http://stackoverflow.com/a/22733627
has title: Neo4j Start-Guide (IntelliJ)
tagged with: neo4j
favorite count: 0
tagged with: spring-data-neo4j
type: AnsweredQuestion
score: 3
has body: does someone know a good beginner tutorial for getting started with Neo4j? I downloaded the hello-world and cineast from neo4j examples, but I just can't make it run. I got AspectJ errors and spring errors and everytime I fix an error, a new one appears. I think, the problem is, that I don't really understand, how I have to structure a neo4j-spring-data project correctly. Could you tell me, what would be the best way to get a running example for neo4j? Maybe some could post a working pom.xml configuration. I tried the configs from the neo4j examples and got exceptions. When I change the aspectj version from 1.6.? to RELEASE I can make the project but then I get a exception in glassfish (I deploy the webapp). EDIT So! Finally I made it working! Here some tipps for other neo4j-newbies: Use Java 7! I'm not sure if it was me or java, but it didn't work with java 8 for me! Since spring-data 3.0 there is the strict checking (see: http://blog.neo4j.org/2014/03/spring-data-neo4j-progress-update-sdn-3.html), so you have to define the package of the repositories in the spring config xml! I did it like this: applicationContext-graph.xml &lt;neo4j:repositories base-package="org.neo4j.app.todos"/&gt; &lt;neo4j:config graphDatabaseService="graphDatabaseService" base-package="org.neo4j.app.todos" /&gt; &lt;bean id="graphDatabaseService" class="org.springframework.data.neo4j.rest.SpringRestGraphDatabase"&gt; &lt;constructor-arg index="0" value="http://localhost:7474/db/data/" /&gt; &lt;/bean&gt; Use the todo-example from the neo4j-examples, it's in my opinion the simplest of them. I hope this helps someone. Best regards
upvote count: 3
tagged with: java

http://stackoverflow.com/comment/34643003
score: 0
has text: there is, but as far as i know it never loads anything, just throws an exception
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/22730636

http://stackoverflow.com/comment/34789100
type: AnswerComment
has text: Thank you. It turned out that it was in fact enabled, but the project's version differed from the Maven Dependency in the other project. After I changed it to be the same version number (SNAPSHOT), it worked.
score: 0
comment on: http://stackoverflow.com/a/22765955
type: Comment

http://stackoverflow.com/a/22660407
type: Answer
has body: if you need to parse the xml file you need to use a xml parser. get it as seperate strings and then save it into a string array Please follow this link to understand better http://www.mkyong.com/java/how-to-read-xml-file-in-java-dom-parser/ when you get the parsed string u can add it to the array.
answers question: http://stackoverflow.com/q/22660070
type: AcceptedAnswer
score: 0
accepted answer of: http://stackoverflow.com/q/22660070

http://stackoverflow.com/a/23478626
downvote count: 1
type: Answer
upvote count: 0
has body: For any kinda data, we as a programer can eithe do insert ,delete or update. Same with data at google's server. You may have not set to update that data. Just go to dev console &amp; properly change the settings for YT data api.
score: -1
answers question: http://stackoverflow.com/q/22781932

http://stackoverflow.com/q/22790375
has comment: http://stackoverflow.com/comment/34750458
tagged with: java
upvote count: 1
type: Question
has comment: http://stackoverflow.com/comment/34750357
has comment: http://stackoverflow.com/comment/34750316
downvote count: 0
has comment: http://stackoverflow.com/comment/34750451
accepted answer: http://stackoverflow.com/a/22791532
has body: Is it possible to use annotations to create multiple versions of an API? I've got a target API that needs implementing, but it has grown in time, and I would like to support multiple levels - if possible in the same branch. I've already thought about splitting up the API and proxy it to implementation library, but that still requires a lot of code to keep synchronized. So you would create code like: @Since("1.2") &lt;- only created when 1.2 or higher public interface InNewerAPI { @Since("1.3") &lt;- only compiled when 1.3 or higher public void methodInEvenNewerAPI(); } Of course I could also use a preprocessor for this, but I would like to avoid pre-processors for Java code. Are there any drawbacks to this approach (such as loosing argument names prior to 1.8)? Note that I need support for interfaces and classes, including abstract and inner classes. Methods and constants need to be versioned as well.
answer count: 1
score: 1
tagged with: preprocessor
favorite count: 0
tagged with: annotations
has comment: http://stackoverflow.com/comment/34750506
has title: Using annotations to create multiple versions of an API
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/22791532

http://stackoverflow.com/q/22804328
type: Question
accepted answer: http://stackoverflow.com/a/22804361
answer count: 1
downvote count: 0
favorite count: 0
has body: I am trying this code below but it is giving me warning message but when I execute it runs without error. import javax.swing.JFrame; class MyFrame extends JFrame { public MyFrame() { setTitle("Besm Allah Ya Allah"); setSize(300,300); setLocation(10,100); } public static void main(String[] args){ JFrame f = new MyFrame(); f.show(); } } javac -Xlint MyFrame.java gives me: MyFrame.java:13: warning: [deprecation] show() in Window has been deprecated f.show(); ^ MyFrame.java:3: warning: [serial] serializable class MyFrame has no definition of serialVersionUID class MyFrame extends JFrame { ^ 2 warnings What is the problem? Why I'm getting warning messages?
tagged with: swing
has answer: http://stackoverflow.com/a/22804361
type: AnsweredQuestion
score: 1
tagged with: java
tagged with: warnings
upvote count: 1
has title: Compilation warnings - deprecation and no definition of serialVersionUID

http://stackoverflow.com/q/22743890
tagged with: android
upvote count: 2
type: UnansweredQuestion
has title: android An established connection was aborted by the software in your host machine
has body: [2014-03-30 19:55:57 - ddmlib]An established connection was aborted by the software in your host machine java.io.IOException: An established connection was aborted by the software in your host machine at sun.nio.ch.SocketDispatcher.write0(Native Method) at sun.nio.ch.SocketDispatcher.write(Unknown Source) at sun.nio.ch.IOUtil.writeFromNativeBuffer(Unknown Source) at sun.nio.ch.IOUtil.write(Unknown Source) at sun.nio.ch.SocketChannelImpl.write(Unknown Source) at com.android.ddmlib.JdwpPacket.writeAndConsume(JdwpPacket.java:213) at com.android.ddmlib.Client.sendAndConsume(Client.java:642) at com.android.ddmlib.HandleHeap.sendREAQ(HandleHeap.java:348) at com.android.ddmlib.Client.requestAllocationStatus(Client.java:488) at com.android.ddmlib.DeviceMonitor.createClient(DeviceMonitor.java:835) at com.android.ddmlib.DeviceMonitor.openClient(DeviceMonitor.java:803) at com.android.ddmlib.DeviceMonitor.processIncomingJdwpData(DeviceMonitor.java:763) at com.android.ddmlib.DeviceMonitor.deviceClientMonitorLoop(DeviceMonitor.java:652) at com.android.ddmlib.DeviceMonitor.access$100(DeviceMonitor.java:44) at com.android.ddmlib.DeviceMonitor$3.run(DeviceMonitor.java:580) Hello, the problems occur after run the SQLite application (in Eclipse), I search a lot of similar questions, but none of the solution can solve my problem. Can anyone help me to solve this problem? Thanks. The pictures of problem as below: https://i.sstatic.net/NtMk3.jpg https://i.sstatic.net/DK8zO.jpg
tagged with: java
type: Question
answer count: 2
score: 2
linked to: http://stackoverflow.com/q/5618664
has answer: http://stackoverflow.com/a/25267720
downvote count: 0
has answer: http://stackoverflow.com/a/30416603
favorite count: 0

http://stackoverflow.com/comment/34740580
type: Comment
has text: @maaartinus Maybe JIT / Java adds noise to your benchmark? My example was written in C++ where I find it is easier to reason about execution times. Unfortunately, your benchmark is far from trivial; I would have to re-write that in C++ and analyze it in great detail to understand what's going on in your code.
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/22755044

http://stackoverflow.com/comment/34713225
type: QuestionComment
comment on: http://stackoverflow.com/q/22769703
type: Comment
has text: 1. Don't set the content-type header. 2. Handle it like any other file upload. 3. Is `uploadfile` defined aywhere?
score: 0

http://stackoverflow.com/q/22684482
score: 0
has title: Deploying on Tomcat 8.0.3
has comment: http://stackoverflow.com/comment/34602471
type: UnansweredQuestion
tagged with: maven
tagged with: spring
type: Question
has body: I'm trying to deploy my spring application on Tomcat 8.0.3. The servlet container uses a jdk 1.0.7_51. I'm able to do the deploy through mvn tomcat7:plugin but when Tomcat tries to run the application. In the log file i get this exception: Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'entityManagerFactory' defined in URL [file:/home/myApp/apache-tomcat-8.0.3/webapps/myApp/WEB-INF/classes/database.xml]: Invocation of init method failed; nested exception is java.lang.SecurityException: class "org.eclipse.persistence.sessions.coordination.CommandProcessor"'s signer information does not match signer information of other classes in the same package at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1455) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:519) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:456) at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:294) at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:225) at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:291) at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:197) at org.springframework.beans.factory.support.DefaultListableBeanFactory.getBeansOfType(DefaultListableBeanFactory.java:420) at org.springframework.beans.factory.BeanFactoryUtils.beansOfTypeIncludingAncestors(BeanFactoryUtils.java:277) at org.springframework.dao.support.PersistenceExceptionTranslationInterceptor.detectPersistenceExceptionTranslators(PersistenceExceptionTranslationInterceptor.java:139) at org.springframework.dao.support.…
has comment: http://stackoverflow.com/comment/34562209
tagged with: java
has answer: http://stackoverflow.com/a/22708490
answer count: 2
has answer: http://stackoverflow.com/a/22711719
has comment: http://stackoverflow.com/comment/34559293
tagged with: tomcat

http://stackoverflow.com/comment/34607625
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/22691268
has text: To revert the sorting order, you mirror all indices. `i0 = startIndex+11; i1 = startIndex10; ... i11 = startIndex + 0;`. The network itself, including comparisons, stays the same. I'm not 100% sure, but quite sure! Report back :-)
score: 0

http://stackoverflow.com/q/22669442
has comment: http://stackoverflow.com/comment/34532787
has body: Can someone help me in this code. The if statement isn't run but the term is true.. (I see it n the Log) So what is the problem with this code? There are two line in the .txt file so the while is running twice. The code: String tag = null; String path = "/data/data/com.barnabas.vac.ballog/files"; try { BufferedReader br = new BufferedReader(new InputStreamReader( new FileInputStream(path+"/Settings.txt"))); String line = ""; Log.e(tag, "A"); while((line = (br.readLine())) != null) { if(line.getBytes() == "RunApp: ON".getBytes()) { RunApp.setChecked(true); Log.e(tag, "B =&gt; " + line); } else if(line.getBytes() == "Battery: ON".getBytes()) { Battery.setChecked(true); Log.e(tag, "C =&gt; " + line); } Log.e(tag, line.getBytes() + " =&gt; " + "RunApp: ON".getBytes()); Log.e(tag, "D =&gt; " + line); } Log.e(tag, "E"); } catch (FileNotFoundException e) { // TODO Auto-generated catch block e.printStackTrace(); } catch (IOException e) { // TODO Auto-generated catch block e.printStackTrace(); } And the Log: 03-26 18:55:05.405: E/(25690): A 03-26 18:55:05.405: E/(25690): [B@419d1aa8 =&gt; [B@419d1bf8 03-26 18:55:05.405: E/(25690): D =&gt; RunApp: ON 03-26 18:55:05.405: E/(25690): [B@419d1f10 =&gt; [B@419d1fe8 03-26 18:55:05.405: E/(25690): D =&gt; Battery: ON 03-26 18:55:05.405: E/(25690): E
tagged with: uiswitch
linked to: http://stackoverflow.com/q/513832
upvote count: 0
has title: BufferedReader input on if statement
answer count: 1
favorite count: 0
tagged with: android
has comment: http://stackoverflow.com/comment/34541137
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/22669531
tagged with: java
accepted answer: http://stackoverflow.com/a/22669531
has comment: http://stackoverflow.com/comment/34532794
downvote count: 1
type: Question
tagged with: if-statement
has comment: http://stackoverflow.com/comment/34532797
tagged with: bufferedreader
score: -1

http://stackoverflow.com/comment/34540266
type: QuestionComment
comment on: http://stackoverflow.com/q/22654850
has text: Could you explain how the directory structures differs?
score: 0
type: Comment

http://stackoverflow.com/comment/34594658
type: AnswerComment
comment on: http://stackoverflow.com/a/22703656
score: 0
type: Comment
has text: Are you saying that `synchronized` will only update the executing thread's view of the variable, but not other threads which may only be calling `get`?

http://stackoverflow.com/q/22783153
possible better answer: http://stackoverflow.com/a/22783627
has comment: http://stackoverflow.com/comment/34737424
has comment: http://stackoverflow.com/comment/34736831
has answer: http://stackoverflow.com/a/22783627
tagged with: arraylist
score: 0
has comment: http://stackoverflow.com/comment/34736981
answer count: 2
has comment: http://stackoverflow.com/comment/34737460
has answer: http://stackoverflow.com/a/22783444
has comment: http://stackoverflow.com/comment/34736873
has comment: http://stackoverflow.com/comment/34737384
has comment: http://stackoverflow.com/comment/34737692
has comment: http://stackoverflow.com/comment/34737132
has body: Now, before you start clicking the down arrow on this question, hear me out. I am doing a paper on Dynamic Arrays in my Java class. I already know the normal Arrays (1D and 2D) and the ArrayList. Now, My teacher claims there are more kinds of dynamic arrays, but she refuses to tell me anything since I'm the one that is suppose to do the work. I have searched around, and the only thing I found was Linked List, and it doesn't even work with arrays. I simply can't find anything anywhere of other Dynamic Arrays. Could someone explain to me what are the types of dynamic arrays (if there are more then ArrayList) and maybe give me some insight about it? If not, just the types would be good. Really struggling here... Thanks. EDIT: Turns out she wants Dynamic data structures, not arrays. so imagine everytime you read arrays up there it was written "data structures". sorry EDIT: So let me see if I got it all: I need to talk about java collections, java vectors, and Lists (talking a litle bit of all the List types). Anything missing?
has comment: http://stackoverflow.com/comment/34737192
has comment: http://stackoverflow.com/comment/34736982
has title: Dynamic Arrays in Java - What are my options?
has comment: http://stackoverflow.com/comment/34737157
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/34736930
accepted answer: http://stackoverflow.com/a/22783444
tagged with: dynamic
tagged with: java
has comment: http://stackoverflow.com/comment/34740487
has comment: http://stackoverflow.com/comment/34736993
type: Question
has comment: http://stackoverflow.com/comment/34737295
has comment: http://stackoverflow.com/comment/34736932
tagged with: arrays

http://stackoverflow.com/q/22787153
tagged with: postgresql
has comment: http://stackoverflow.com/comment/34744519
type: UnansweredQuestion
linked to: http://stackoverflow.com/q/39099905
has title: Gaps In the sequence values generated by JPA @GeneratedValue with PostgreSQL
type: Question
has answer: http://stackoverflow.com/a/22787550
tagged with: java
tagged with: hibernate
has body: For my desktop application I use JavaFX, Spring, JPA + Hibernate and PostgreSQL. Currently I have faced several issues. Issue one: Violation of PRIMARY KEY constraint SQL Error When I create Entity classes according to following manner (GenerationType as AUTO) it works fine. But when I create a new data base and add some Test data with sql script (as showing following picture) and try to insert some data with my application I have got 'Violation of PRIMARY KEY constraint' SQL Error. That mean it seems Hibernate try to generated PK values which are already available (allocated with my test data ex 1, 2, 3 etc). But after 5 attempts (exceed the test data maximum pk value) it was fine and start the data inserting with PK key value with 6. Entity Class - GenerationType as AUTO @Entity @Table(name = "devicetype") public class Devicetype implements Serializable { @Id @Basic(optional = false) @Column(name = "id") private Integer id; } Table with initial test data EntityManager factory org.hibernate.cfg.ImprovedNamingStrategy org.hibernate.dialect.PostgresPlusDialect update false false false false Issue Two: Gaps In the sequence value For make resolve about error I have changed Entity class according to following manner (with GenerationType as SEQUENCE) and done the same steps (insert initial test data with sql script and try to insert data via application). Then data was inserted without any exception. Now my table contains records both inserted via script and application (as showing following picture). But newly add data (I have highlight on light blue color) via application had very higher PK value (started at 184 not from 6). That mean with "GenerationType as SEQUENCE" it seems hibernate not populate ID value in sequence manner (maintain some gaps). When I add further some data via application it seems it will stat to inserting data with another higher ID value (not start form 214). That mean is seems ID is not incrementing on sequence manner. Entity Class - GenerationT…
has comment: http://stackoverflow.com/comment/65572849
score: 0
tagged with: sql
tagged with: jpa
answer count: 1

http://stackoverflow.com/q/22730331
has answer: http://stackoverflow.com/a/22730411
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/34642399
tagged with: java
type: Question
has body: Hi I have a problem with Eclipse that , after i type a variable and then a '.' the possible functions are not being autocompleted or shown as drop down.. (For example string str = "hello"; then str. should show me something like length() or substring() ) I have already tried everything with eclipse settings as seen in this link : Improving Eclipse autocompletion? But it doesnt work. (Am using Java, mac ,eclipse) Also when it shows no SWT proposals, and No default proposals, hoever if i give a space instead of '.' it shows some proposals ... Any suggestions are appreciated..
tagged with: autocomplete
has title: eclipse Java autocompletion doesnt work
tagged with: eclipse
score: 0
answer count: 3
linked to: http://stackoverflow.com/q/5929773
has answer: http://stackoverflow.com/a/22731789
accepted answer: http://stackoverflow.com/a/22730411
possible better answer: http://stackoverflow.com/a/22730393
has answer: http://stackoverflow.com/a/22730393
has comment: http://stackoverflow.com/comment/34644740

http://stackoverflow.com/comment/34667449
type: QuestionComment
score: 0
comment on: http://stackoverflow.com/q/22744355
has text: I don't know what package the .class is, but I packaged it in the command line.
type: Comment

http://stackoverflow.com/comment/34694028
has text: @IanRoberts Can you show how to use the `<condition>` variable in the way you describe? I am a bit new to ant and cannot figure it out from the documentation.
comment on: http://stackoverflow.com/q/22757095
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/34518655
type: QuestionComment
has text: Do you have any overloads of the method you're trying to call? Something else you could try is calling with an array e.g. `...addTerm(Comparison.EQ, "s0", new String[] { "s1", "s2" })`.
score: 0
comment on: http://stackoverflow.com/q/22661468
type: Comment

http://stackoverflow.com/comment/34679675
comment on: http://stackoverflow.com/q/22750468
score: 0
has text: Releases already friend, I hope your help.
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/34496363
comment on: http://stackoverflow.com/q/22648629
has text: If a pattern became irrelevant in just one of these languages, please share it as well.
type: Comment
score: 0
type: QuestionComment

http://stackoverflow.com/comment/34627901
type: QuestionComment
has text: How do the line numbers in the stack-trace relate to the lines of code you posted?
score: 0
comment on: http://stackoverflow.com/q/22718965
type: Comment

http://stackoverflow.com/q/22672580
answer count: 2
has answer: http://stackoverflow.com/a/22672860
has comment: http://stackoverflow.com/comment/34538597
has comment: http://stackoverflow.com/comment/34538212
type: UnansweredQuestion
tagged with: jdbc
has answer: http://stackoverflow.com/a/22672764
score: 0
tagged with: java
tagged with: hibernate
type: Question
has body: I made a connection to SQL server with Hibernate configuration wizard, when I click test connection, I get success message, but when I want to make hibernate mapping, I cannot I get error message, Cannot established a connection to jdbc. The below code is jdbc connection with hibernate; please say me, what is the problem? <hibernate-configuration> com.microsoft.sqlserver.jdbc.SQLServerDriver jdbc:sqlserver://localhost; databaseName=Test sa sa123 org.hibernate.dialect.SQLServerDialect </hibernate-configuration> Best Regards
has title: Can not established a connection to jdbc with Hibernate-SQL Server 2008
tagged with: sql-server

http://stackoverflow.com/comment/34707320
comment on: http://stackoverflow.com/q/22766332
has text: What did you find about page scope and what don't you understand about it?
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/a/22777262
score: 1
upvote count: 1
has body: My sample source. switch(cell.getCellType()) { case org.apache.poi.ss.usermodel.Cell.CELL_TYPE_STRING: data = cell.getRichStringCellValue().toString(); break; case org.apache.poi.ss.usermodel.Cell.CELL_TYPE_NUMERIC: data = Integer.toString((int)cell.getNumericCellValue()); break; } javadoc link : http://javafind.net/library/13/poi-3.10-FINAL/docs/apidocs/org/apache/poi/xssf/usermodel/XSSFCell.html#getCellType()
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/34732388
type: Answer
accepted answer of: http://stackoverflow.com/q/22777109
answers question: http://stackoverflow.com/q/22777109

http://stackoverflow.com/comment/34574175
type: QuestionComment
comment on: http://stackoverflow.com/q/22692431
score: 1
type: Comment
has text: I would suggest going through the http://docs.oracle.com/javase/tutorial/uiswing/components/applet.html tutorial to learn how to use swing in java applets. This tutorial to learn how to use applets in general : http://docs.oracle.com/javase/tutorial/deployment/applet/index.html. Alternatively you can use JavaScript with something like Ajax for the web page which would communicate with a server-side Java application.

http://stackoverflow.com/comment/34651458
comment on: http://stackoverflow.com/q/22735351
type: QuestionComment
type: Comment
score: 0
has text: In your question you state, that the correct order of the values corresponds to 11, 20, 15, 29, so where's the problem if you get 20 after 11?

http://stackoverflow.com/q/22658366
has comment: http://stackoverflow.com/comment/34512752
possible better answer: http://stackoverflow.com/a/22658601
answer count: 4
tagged with: primitive-types
duplicate of: http://stackoverflow.com/q/709961
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/22658628
has comment: http://stackoverflow.com/comment/34512840
tagged with: java
has answer: http://stackoverflow.com/a/22658601
has title: How to detect primitive data type?
type: Question
has answer: http://stackoverflow.com/a/22658905
linked to: http://stackoverflow.com/q/709961
accepted answer: http://stackoverflow.com/a/22658905
has body: How can I check is Primitive Data Type of given parameter ? public static void main(String[] args) { if (isPrimitive("test")) { System.out.println("True"); } if (isPrimitive(1)) { System.out.println("True"); } } public static boolean isPrimitive(Object o) { // Here what would I do ? }
score: 0
has answer: http://stackoverflow.com/a/22658607

http://stackoverflow.com/comment/34714058
has text: Ok so how would I load the option list then if I cant have the process request method. I need to load the option list and then when the user hits submit they can go to the receipt page with the information they entered
comment on: http://stackoverflow.com/a/22770008
type: AnswerComment
score: 0
type: Comment

http://stackoverflow.com/a/22760113
type: Answer
answers question: http://stackoverflow.com/q/22759934
has body: As per documentation (http://docs.oracle.com/javase/tutorial/essential/concurrency/locksync.html): Every object has an intrinsic lock associated with it. By convention, a thread that needs exclusive and consistent access to an object's fields has to acquire the object's intrinsic lock before accessing them, and then release the intrinsic lock when it's done with them. A thread is said to own the intrinsic lock between the time it has acquired the lock and released the lock. When a thread invokes a synchronized method, it automatically acquires the intrinsic lock for that method's object and releases it when the method returns. The lock release occurs even if the return was caused by an uncaught exception. You might wonder what happens when a static synchronized method is invoked, since a static method is associated with a class, not an object. In this case, the thread acquires the intrinsic lock for the Class object associated with the class. Thus access to class's static fields is controlled by a lock that's distinct from the lock for any instance of the class. So your methods are usning intrinsic lock from the Test object, and yes, as Marko has correctly pointed out, you might get a deadlock.
score: 0

http://stackoverflow.com/comment/34587562
type: Comment
type: QuestionComment
has text: I meant to mention the "dropdown" widget in Android is the `Spinner` class (weird name I know). Good luck.
score: 0
comment on: http://stackoverflow.com/q/22698034

http://stackoverflow.com/a/22765302
answers question: http://stackoverflow.com/q/22765218
has comment: http://stackoverflow.com/comment/34705284
upvote count: 1
has comment: http://stackoverflow.com/comment/34705460
score: 1
type: AcceptedAnswer
has body: shortname.setText((Info2 == null) || Info2.isEmpty()) ? "N/A" : Info2); or, shortname.setText("".equals(Info2) ? "N/A" : Info2);
downvote count: 0
has comment: http://stackoverflow.com/comment/34705294
accepted answer of: http://stackoverflow.com/q/22765218
type: Answer

http://stackoverflow.com/comment/34508560
has text: Why you cannot use session? If you want to retain data you need to store it somewhere (e.g. database, session).
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/22654350
score: 0

http://stackoverflow.com/a/22702447
answers question: http://stackoverflow.com/q/22701694
score: 0
has body: make temporary arraylist, modify this list and copy its content at the end to the original list import java.util.ArrayList; public class MarkLength { void marklength4(ArrayList &lt;String&gt; themarklength){ ArrayList&lt;String&gt; temp = new ArrayList&lt;String&gt;(); for(String n : themarklength){ if(n.length() ==4){ temp.add(n); temp.add("****"); } } themarklength.clear(); themarklength.addAll(temp); System.out.println(themarklength); } }
type: Answer

http://stackoverflow.com/comment/34663320
comment on: http://stackoverflow.com/a/22741965
type: AnswerComment
score: 0
type: Comment
has text: I tried implementing this method but am not sure what to put into the "for" statement. I've added the code, hopefully it can help in answering the question. The final_output string is the string i want to append.

http://stackoverflow.com/a/22776192
has body: The most likely explanation is that your maven cache is corrupted. First, check if the C:/Users/cccc/.m2/repository/com/vaadin/vaadin-client/7.1.0/vaadin-client-7.1.0.jar jar is complete. Run jar tvf on the file to make sure you can use it. If you're lucky, things will work if you delete the C:/Users/cccc/.m2/repository/com/vaadin/vaadin-client/7.1.0/ folder, but if that doesn't work, you will have to try deleting C:/Users/cccc/.m2/repository. It's just a local cache of artifacts downloaded from maven central or an internal repository, so it is OK to delete. I am 90% certain this would fix your problem.
type: Answer
accepted answer of: http://stackoverflow.com/q/22772053
has comment: http://stackoverflow.com/comment/34761740
score: 2
type: AcceptedAnswer
downvote count: 0
answers question: http://stackoverflow.com/q/22772053
upvote count: 2

http://stackoverflow.com/a/22759461
answers question: http://stackoverflow.com/q/22745837
type: Answer
accepted answer of: http://stackoverflow.com/q/22745837
has body: You can do something similar with the analyzer package. This package allows you to get the AST or Resolved AST (with types) from sources and navigate inside it. So yes, you can process source codes like with apt.
downvote count: 0
score: 2
upvote count: 2
type: AcceptedAnswer

http://stackoverflow.com/comment/34669179
type: Comment
score: 0
type: AnswerComment
has text: For simplicity, just print out the success json string ie. `{"status":"success"}` just after executing query, and check your android app.
comment on: http://stackoverflow.com/a/22744805

http://stackoverflow.com/a/22986956
has body: I think you could try the following approach as a work around. fragmentTr.setCustomAnimations(enter, exit); fragmentTr.hide(currentFragment); fragmentTr.add(containerId, newFragment, "aTag"); fragmentTr.show(newFragment); fragmentTr.commit(); Do not use replace(). I tried the above approach, and it worked. Hope this helps.
score: 0
type: Answer
answers question: http://stackoverflow.com/q/22682790

http://stackoverflow.com/a/57475019
type: Answer
upvote count: 0
answers question: http://stackoverflow.com/q/22684741
score: -1
downvote count: 1
has body: If you use kotlin： class TransportSearch { @field:Equals(name = "vin") var vin:String? = null }

http://stackoverflow.com/a/22790298
score: 0
type: Answer
answers question: http://stackoverflow.com/q/22662173
has body: Actually from what I was told via IBM FP 6, does not include the fixed .jars. That was my main problem assuming it did.

http://stackoverflow.com/q/22796676
type: AnsweredQuestion
tagged with: java
has comment: http://stackoverflow.com/comment/34762293
has answer: http://stackoverflow.com/a/22796859
type: Question
has answer: http://stackoverflow.com/a/22797399
accepted answer: http://stackoverflow.com/a/22797126
possible better answer: http://stackoverflow.com/a/22796859
score: 0
answer count: 3
has title: program not returning proper results for RadioButton
has body: When I run the code below, the first 2 buttons do not appear; however, the third one is visible in the frame. public class RadioButton { RadioButton(){ JFrame frame = new JFrame(); JRadioButton button1 = new JRadioButton("One"); button1.setBounds(50, 20, 50, 20); JRadioButton button2 = new JRadioButton("Two"); button2.setBounds(50, 50, 50, 20); JRadioButton button3 = new JRadioButton("Three"); button2.setBounds(50, 80, 50, 20); ButtonGroup bg = new ButtonGroup(); bg.add(button1); bg.add(button2); bg.add(button3); frame.add(button1); frame.add(button2); frame.add(button3); frame.setSize(300, 300); frame.setVisible(true); frame.setLayout(null); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); } public static void main(String[] args) { new RadioButton(); } }
tagged with: jradiobutton
tagged with: swing
has answer: http://stackoverflow.com/a/22797126

http://stackoverflow.com/q/22775576
has answer: http://stackoverflow.com/a/22779982
tagged with: generics
type: UnansweredQuestion
tagged with: linked-list
has body: I am working on an assignment that requires building a generic Java method that sorts a linked list or an array but I don't understand how that would be possible.
tagged with: java
has title: is it possible to create a generic method that will sort arrays and linked lists equally?
type: Question
tagged with: arrays
tagged with: sorting
score: 0
has comment: http://stackoverflow.com/comment/34723872
has comment: http://stackoverflow.com/comment/34723738
answer count: 1

http://stackoverflow.com/a/22666554
has comment: http://stackoverflow.com/comment/34527444
has comment: http://stackoverflow.com/comment/34527814
has body: Just add more #,i.e. DOUBLE_FORMAT.applyPattern("#.######################");
answers question: http://stackoverflow.com/q/22666490
downvote count: 0
type: Answer
score: 2
upvote count: 2

http://stackoverflow.com/comment/34758544
type: Comment
type: QuestionComment
has text: @fge Apparently [String8](http://msdn.microsoft.com/en-us/library/dd240126.aspx) is a real thing, as is [String16](http://msdn.microsoft.com/en-us/library/dd240127.aspx).
comment on: http://stackoverflow.com/q/22794924
score: 1

http://stackoverflow.com/comment/34605219
type: AnswerComment
comment on: http://stackoverflow.com/a/22708575
score: 0
type: Comment
has text: At least now you know what your problem is. Try my updated answer

http://stackoverflow.com/comment/34626261
score: 0
comment on: http://stackoverflow.com/q/22721197
type: Comment
type: QuestionComment
has text: `shotsMade[0]= shotCount;`

http://stackoverflow.com/comment/34713052
type: QuestionComment
comment on: http://stackoverflow.com/q/22766269
type: Comment
has text: If one thing is raw, everything else becomes raw; it's not just treated as if it were `Object`. (And that's why you never use rawtypes in new code.)
score: 0

http://stackoverflow.com/comment/34572675
has text: I think you are explaining now something which I've already done. Please look at my code. As I explained, my normalised vector of direction works perfectly. The thing I need is to make possible to set initial position of bullet not from the middle of the ship.
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/22689291
score: 0

http://stackoverflow.com/comment/34604136
comment on: http://stackoverflow.com/a/22686861
type: AnswerComment
score: 0
type: Comment
has text: I tried to adapt this code with a scanner to let the enter use a pin instead of forcing to send "out.println("9.8.7.6");". So far I have the code you can see in my first post (I have edited), but I have difficulties to recover my loop from the beginning to make the 3 tries and so.. With this type of architecture I have the feeling everything is different.

http://stackoverflow.com/q/22753660
has comment: http://stackoverflow.com/comment/34685066
has answer: http://stackoverflow.com/a/22753956
has answer: http://stackoverflow.com/a/22753897
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/22753888
possible better answer: http://stackoverflow.com/a/22753739
has answer: http://stackoverflow.com/a/22754133
has answer: http://stackoverflow.com/a/22753739
tagged with: java
accepted answer: http://stackoverflow.com/a/22753888
linked to: http://stackoverflow.com/q/225337
type: Question
has body: I need to split a string in every three words (using JAVA). For example: "This is an example of what I need." The output would be: This is an is an example an example of example of what of what I what I need I need Thanks for the help! I've tried like this. I don´t know how to get the last two words or what to do when the phrase has less than 3 words. String phrase = "This is an example of what I need." String[] splited = phrase.split(" "); for (int i = 0; i &lt; phraseSplited.length - 2; i++) { threeWords = splited[i] + " " + splited[i+1] + " " + splited[i+2]; System.out.println(threeWords); }
tagged with: split
has title: How to split a string in every three words (JAVA)
duplicate of: http://stackoverflow.com/q/225337
has comment: http://stackoverflow.com/comment/34684259
upvote count: 4
score: 0
has comment: http://stackoverflow.com/comment/34684410
downvote count: 4
has comment: http://stackoverflow.com/comment/34684455
tagged with: string
favorite count: 0
has comment: http://stackoverflow.com/comment/34684194
answer count: 5
has comment: http://stackoverflow.com/comment/34684456

http://stackoverflow.com/a/22727085
has comment: http://stackoverflow.com/comment/34636866
score: 3
type: Answer
upvote count: 3
accepted answer of: http://stackoverflow.com/q/22726946
answers question: http://stackoverflow.com/q/22726946
has body: Generic parameters of a class do not apply to static members. The obvious solution is to use a method rather than a variable. public static &lt;U&gt; EventFactory&lt;Event&lt;U&gt;&gt; factory() { return new EventFactory&lt;Event&lt;U&gt;&gt;() { public Event&lt;U&gt; newInstance() { return new Event&lt;U&gt;(); } }; } The syntax is more concise in the current version of Java. It is possible to use a the same instance of EventFactory stored in a static field, but that requires an unsafe cast.
type: AcceptedAnswer
downvote count: 0

http://stackoverflow.com/q/22760750
type: AnsweredQuestion
tagged with: java
tagged with: adb
type: Question
accepted answer: http://stackoverflow.com/a/24112528
tagged with: adt
tagged with: ddms
possible better answer: http://stackoverflow.com/a/22761466
score: 0
answer count: 2
has answer: http://stackoverflow.com/a/22761466
has answer: http://stackoverflow.com/a/24112528
has body: I sent to the emulated android device SD card using DDMS and I can even see these in DDMS. The file names are POS1.png and POS2.png. The sdcard path is /storage/sdcard/foldername In my code I want to check if my file isFile() so i have written String filepath = "/storage/sdcard/foldername/POS1.png"; File file = new File(filepath); if (!file.isFile()){ //do something } else{ //do something else } The if condition is always returning true (i.e. file is not a file). I think it may be a permission issue (the current permissions on the files are u=&gt;rwx, g=&gt;rwx) so I am trying to change the permission of the file from adb shell: I launched my program in the emulator Opened cmd (on windows. path for adb is already set in environment) Typed the following codes C:\&gt; adb shell root@generic:/ # su Output: su root@generic:/ # chmod -R 777 /storage/sdcard/foldername/ Output: chmod -R 777 /storage/sdcard/foldername/ root@generic:/ # ls -l /storage/sdcard/foldername/ The permissions still show the same. Even in the DDMS they're the same. I even restarted the device and eclipse, no change. I tried the following variations too: root@generic:/ # chmod -R 777 /storage/sdcard/foldername/* root@generic:/ # chmod -R 777 /storage/sdcard/foldername/*.png root@generic:/ # chmod 777 /storage/sdcard/foldername/POS1.png Using u+rwx / g+rwx / o+rwx / a+rwx in place of 777 gives me a "Bad Mode" message Thank you in advance for the help! Edit: So I used the following code to check the exception: try { FileInputStream fis = null; fis = new FileInputStream("/storage/sdcard/foldername/POS1.png"); } catch (IOException e) { Log.e("openfile", "Exception:"+e.getMessage()); } I got the message open failed: EACCES (Permission Denied)"
has title: Android Permissions unchanged after chmod in ADB Shell & DDMS
tagged with: android

http://stackoverflow.com/comment/34748140
comment on: http://stackoverflow.com/q/22789413
has text: http://stackoverflow.com/a/18563928/829571
type: Comment
type: QuestionComment
score: 0

http://stackoverflow.com/q/22673386
has comment: http://stackoverflow.com/comment/34609384
tagged with: xmlbeans
upvote count: 1
answer count: 1
has body: I'm using XMLBeans to generate Java client code from two very similar XSDs. The XMLBeans-generated classes go into two parallel packages. I then retrieve data from a database to interact with the generated classes to produce two (again, nearly identical) XML output files. Even though the XSDs are about 95% the same, there's no defined relationship between them - no inheritance or anything. Unfortunately, these legacy XSDs have been in use for years and I'm not permitted to modify them. My problem is this: even though the majority of the data and structures are exactly the same between the two XML files, I can't figure out how to avoid tons of duplicate code to pour the data into two independent sets of XMLBeans-generated classes. I can create a common set of business objects to go between the DAOs and the XML structures. But I'd still have to map each of those objects to both corresponding generated XML types, and that seems incredibly tedious and inefficient. I don't want to modify the generated XMLBeans Java code (e.g., to implement a shared Interface), and I can't change the XSDs. I've looked at patterns like Adapter and Bridge but I don't think they get me there in terms of avoiding the duplicate code/effort. Is there an elegant design solution that I'm missing?
tagged with: xsd
accepted answer: http://stackoverflow.com/a/22712784
tagged with: java
has comment: http://stackoverflow.com/comment/34539875
type: AnsweredQuestion
downvote count: 0
has title: XMLBeans - How to handle nearly identical legacy XSDs?
has answer: http://stackoverflow.com/a/22712784
type: Question
linked to: http://stackoverflow.com/q/2519804
score: 1
favorite count: 0
tagged with: http://stackoverflow.com/tag/xml

http://stackoverflow.com/q/22775605
tagged with: postgresql
type: UnansweredQuestion
tagged with: spring
tagged with: java
has answer: http://stackoverflow.com/a/22776196
has comment: http://stackoverflow.com/comment/34723836
type: Question
has body: message descriptionThe server encountered an internal error () that prevented it from fulfilling this request. exception javax.servlet.ServletException: An error occurred performing resource injection on managed bean entryDataPegawaiBean root cause com.sun.faces.mgbean.ManagedBeanCreationException: An error occurred performing resource injection on managed bean entryDataPegawaiBean root cause com.sun.faces.spi.InjectionProviderException: com.sun.enterprise.container.common.spi.util.InjectionException: Exception attempting invoke lifecycle method private void com.pelindo.simpers.bean.EntryDataPegawaiBean.construct() root cause com.sun.enterprise.container.common.spi.util.InjectionException: Exception attempting invoke lifecycle method private void com.pelindo.simpers.bean.EntryDataPegawaiBean.construct() root cause java.security.PrivilegedActionException: java.lang.reflect.InvocationTargetException root cause java.lang.reflect.InvocationTargetException root cause javax.ejb.EJBException root cause Exception [EclipseLink-4002] (Eclipse Persistence Services - 2.3.2.v20111125-r10461): org.eclipse.persistence.exceptions.DatabaseException Internal Exception: org.postgresql.util.PSQLException: ERROR: function right(character varying, integer) does not exist Hint: No function matches the given name and argument types. You might need to add explicit type casts. Position: 75 Error Code: 0 root cause org.postgresql.util.PSQLException: ERROR: function right(character varying, integer) does not exist Hint: No function matches the given name and argument types. You might need to add explicit type casts. Position: 75 Part of my been class : public class EntryDataPegawaiBean implements Serializable { PegawaiFacadeRemote pegawaiFacade = lookupPegawaiFacadeRemote(); PegawaiKhususFacadeRemote pegawaiKhususFacade = lookupPegawaiKhususFacadeRemote(); AlamatHistFacadeRemote alamatFacade = lookupAlamatHistFacadeRemote(); CatatanHistFacadeRemote catatanFacade = lookupCatatanHistFacadeRemote…
tagged with: eclipse
tagged with: glassfish
has title: My Glassfish Exception report HTTP Status 500 -
score: 0
answer count: 1

http://stackoverflow.com/comment/34733911
type: QuestionComment
comment on: http://stackoverflow.com/q/22763391
type: Comment
has text: None of these answers help. It's not just the jayaway.jsonpath, if I comment this out I get an error on not being able to access other libraries so I guess it is some server error or proxy authentication failure (even though this doesn't seem to give an error). I've tried updating the version to 1.11. Proxy authentication is working fine when running maven, but not with gradle.
score: 0

http://stackoverflow.com/q/22667481
score: 3
possible better answer: http://stackoverflow.com/a/22667630
has answer: http://stackoverflow.com/a/22667630
tagged with: java
tagged with: sts-springsourcetoolsuite
tagged with: eclipse
upvote count: 4
answer count: 2
tagged with: groovy
has body: I have some java projects that have been around for a long time and am currently using a pretty recent version of SpringSource Toolsuite and the groovy plugin which works fine (this was added for people who don't read beyond the first paragraph). I can create a Groovy project or I can convert a Java project to a groovy project, but I'd really like to add a Groovy nature to my java project (I don't think the team would be very happy about me converting all the projects over to groovy projects!) The problem is that the "Groovy" menu item containing "Add Groovy Nature" doesn't appear in any java projects (legacy projects or new ones I create). It appears in a Groovy project with "Remove Groovy Nature", but not in java projects. Everything else works pretty well. Oh also, not using maven, just straight eclipse &amp; ant--I can deal with the Ant part it's just the eclipse integration that's being probleematic. Am I missing a setting or something?
has answer: http://stackoverflow.com/a/48118745
favorite count: 0
has comment: http://stackoverflow.com/comment/34993893
tagged with: plugins
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/34990552
accepted answer: http://stackoverflow.com/a/48118745
has comment: http://stackoverflow.com/comment/34992803
has title: Why can't I add a "Groovy Nature" to a java project?
downvote count: 1
type: Question

http://stackoverflow.com/comment/34762612
score: 0
comment on: http://stackoverflow.com/a/22779950
type: AnswerComment
type: Comment
has text: For `GL.GL_MAX_TEXTURE_SIZE`, it prints 3379. What is that number? Kilobytes? Dimensions? Pixels?

http://stackoverflow.com/a/22685737
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/34564245
answers question: http://stackoverflow.com/q/22685363
has comment: http://stackoverflow.com/comment/34562933
type: Answer
has comment: http://stackoverflow.com/comment/34561741
upvote count: 2
has body: Call the this.validate(); just once after both loops to avoid layout preferences recalculations UPDATE. Keep ImageIcons in a Map and reuse them rather than recreating. Key could be i+"_"+j String
score: 2
accepted answer of: http://stackoverflow.com/q/22685363
has comment: http://stackoverflow.com/comment/34562833
has comment: http://stackoverflow.com/comment/34562472
has comment: http://stackoverflow.com/comment/34562398
has comment: http://stackoverflow.com/comment/34564887

http://stackoverflow.com/comment/34651493
has text: it splits all spaces then, meaning you cannot ever split a full sentence
type: Comment
score: 0
comment on: http://stackoverflow.com/q/22734490
type: QuestionComment

http://stackoverflow.com/a/22696269
has body: You should really use a Calendar. Then you can individually set the hours and minutes from values parsed from the string. Then get the time in milliseconds and compare those. Date now = new Date(); Calendar cal = Calendar.getInstance(); cal.setTime(now); cal.set(Calendar.HOUR_OF_DAY, hours); cal.set(Calendar.MINUTE, minutes); long time = cal.getTimeInMillis(); You could also use the wonderful Joda library. In my opinion Joda is a much better way to work with Dates and Times.
type: Answer
score: 1
upvote count: 1
answers question: http://stackoverflow.com/q/22696124
downvote count: 0

http://stackoverflow.com/comment/34565037
type: Comment
type: QuestionComment
score: 0
comment on: http://stackoverflow.com/q/22687945
has text: Set breakpoint at "g.drawImage(img[i], x, y,200,200, null);" run and check if g is null or img is null; then check img[1]..img[12] if they nulls

http://stackoverflow.com/comment/34685407
type: Comment
type: QuestionComment
has text: This is because you will have errors in Manifest file or XML files. Please make sure you don't have any errors in the following. Once done,clean and import
score: 1
comment on: http://stackoverflow.com/q/22754319

http://stackoverflow.com/comment/34686285
type: AnswerComment
has text: Are all of the strings mentioned in your layout file defined OK?
type: Comment
comment on: http://stackoverflow.com/a/22754437
score: 0

http://stackoverflow.com/a/22778606
type: Answer
score: 2
upvote count: 2
answers question: http://stackoverflow.com/q/22778572
has body: Just define the folder path while writing to the file. As shown below: BufferedWriter writer = new BufferedWriter(new FileWriter("\path\to\folder\data.xml"));
downvote count: 0

http://stackoverflow.com/comment/34555464
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/22682175
type: Comment
has text: table is created and it has one record

http://stackoverflow.com/comment/34619731
has text: @The-Guy-With-The-Hat: the OS is irrelevant. Unless you meant to say 'version of Java'
comment on: http://stackoverflow.com/q/22713652
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/34646467
comment on: http://stackoverflow.com/q/22732106
type: Comment
type: QuestionComment
has text: possible duplicate of [javac is not recognized as an internal or external command, operable program or batch file](http://stackoverflow.com/questions/7709041/javac-is-not-recognized-as-an-internal-or-external-command-operable-program-or)
score: 0

http://stackoverflow.com/q/22691665
tagged with: java
tagged with: http
type: Question
has title: Why reading from a socket stream blocks forever?
has comment: http://stackoverflow.com/comment/34586763
upvote count: 2
linked to: http://stackoverflow.com/q/22688491
downvote count: 0
answer count: 1
has comment: http://stackoverflow.com/comment/34572175
has comment: http://stackoverflow.com/comment/34586582
favorite count: 0
tagged with: sockets
has comment: http://stackoverflow.com/comment/34572627
score: 2
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/22692952
has comment: http://stackoverflow.com/comment/34572382
accepted answer: http://stackoverflow.com/a/22692952
has body: I'm trying to do some HTTP manually by opening a TCP socket, send the request and read/print the response message. The content of the response body is well printed , but the main thread never exits and blocks forever. socket = new Socket(host, port); PrintWriter writer = new PrintWriter(socket.getOutputStream()); writer.print(request); writer.flush(); BufferedReader reader = new BufferedReader(new InputStreamReader(socket.getInputStream())); reader.lines().forEach(System.out::println); // String next_record = null; // while ((next_record = reader.readLine()) != null) // System.out.println(next_record); socket.close(); // System.out.println("Finished"); What am I missing, and how can I fix it ?

http://stackoverflow.com/a/22752245
score: 2
has comment: http://stackoverflow.com/comment/34681700
has body: Based on this... public class StartHandler implements ActionListener { public void actionPerformed(ActionEvent event) { System.out.println("START Pressed"); startButton.setText("Reset"); repaint(); runAnimation(); startButton.setText("Start"); } } You are calling runAnimation from within the context of the Event Dispatching Thread In you runAnimation method you then do this... do { //... } while (fireworks.size() &gt; 0); Which is block the EDT and preventing from processing new events, including repaint requests Take a look at Concurrency in Swing A simple solution would be to use a Swing Timer which would allow you offload a small wait into the background but which is triggered within the context of the EDT...
type: AcceptedAnswer
downvote count: 0
accepted answer of: http://stackoverflow.com/q/22752177
type: Answer
answers question: http://stackoverflow.com/q/22752177
upvote count: 2

http://stackoverflow.com/a/22657270
has body: You can use SolrRequestParsers.parseQueryString(string), as shown below: MultiMapSolrParams solrParams = SolrRequestParsers.parseQueryString("q=name:abc"); QueryResponse r = server.query(solrParams, SolrRequest.METHOD.POST); Hope this helps you.
score: 0
answers question: http://stackoverflow.com/q/22657096
type: Answer

http://stackoverflow.com/comment/34684463
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/22753279
has text: `pairs.getValue() // this is the cost for share. write logic here to find the last 259 shares and calculate avg` Can you please explain this line to me?
score: 0

http://stackoverflow.com/q/22775676
has body: hello i have this code and it asks the user to enter a video and customer id and adds it to an array list called hires how would i save that arraylist to a file when the are finished and quit this program? import java.util.ArrayList; import java.util.Scanner; public class Driver { public static final int LISTCUSTOMERS = 1; public static final int LISTVIDEOS = 2; public static final int LISTHIRES = 3; public static final int HIRESTATISTICS = 4; public static final int HIREVIDEO = 5; public static final int RETURNVIDEO = 6; public static final int QUIT = 7; public final static int DEFAULT = 0; private String[] menuText; private static final int MAXVIDEOS = 9; private static final int MAXCUSTOMERS = 5; static Scanner sc = new Scanner(System.in); private int selection; public int MAXLENGTH = 50; public static ArrayList&lt;Hire&gt;HireList = new ArrayList&lt;Hire&gt;(); public static Video[]videos= new Video[MAXVIDEOS]; public static Customer [] customers = new Customer[MAXCUSTOMERS]; public static String [] options = {"","List Customers", "List Videos", "List Hires", "Hire Statistics", "Hire Video", "Return Video", "Quit"}; public static Driver myMenu = new Driver (options, sc); public static boolean more = true; public static int option = 0; static Customer customer; public static void main (String [] args){ initilisation(); runHireVideo(); } public Driver (String[] menuText, Scanner sc){ this.menuText = menuText; } public int getMenuSelection(){ this.displayMenu(); this.selection = sc.nextInt(); if(this.selection &lt; DEFAULT || this.menuText.length&lt;this.selection){ System.out.println("Your selection was invalid - using default"); this.selection = DEFAULT; } return this.selection; } public void displayMenu(){ System.out.print("\nMicroVideo Menu: \n"); for (int index = 1; index &lt; menuText.length; index++) System.out.println(index + ". "+ menuText [index]); System.out.print("Enter option: "); } public static void runHireVideo(){ while (more){ option = myMenu.getMe…
favorite count: 0
has comment: http://stackoverflow.com/comment/34724165
has title: Java how to save An arrayList to a file
has answer: http://stackoverflow.com/a/22776261
type: UnansweredQuestion
tagged with: java
tagged with: file
downvote count: 1
type: Question
score: -1
tagged with: arraylist
has comment: http://stackoverflow.com/comment/34723939
upvote count: 0
linked to: http://stackoverflow.com/q/19065797
answer count: 1
tagged with: arrays

http://stackoverflow.com/comment/34567361
has text: Thanks for the suggestion! :-) The easiest way isn't always the first thing that crosses our mind. @mKorbel
comment on: http://stackoverflow.com/a/22688105
score: 0
type: AnswerComment
type: Comment

xamarin.android
type: Tag
tag name: xamarin.android
tags question: http://stackoverflow.com/q/22662342

http://stackoverflow.com/comment/34835645
has text: Thank you for all your answers.. Guess I need to do some learning in xslt before I start implementing the requirements. 'll try to use your answers to start with...
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/22794473

http://stackoverflow.com/comment/34756970
score: 0
type: Comment
type: QuestionComment
has text: So, do you run each program on the same jvm, or are you invoking each program with its own jvm?
comment on: http://stackoverflow.com/q/22793892

http://stackoverflow.com/q/22665948
has comment: http://stackoverflow.com/comment/34527294
has comment: http://stackoverflow.com/comment/34526770
has comment: http://stackoverflow.com/comment/34528431
upvote count: 1
has comment: http://stackoverflow.com/comment/34528297
answer count: 1
has comment: http://stackoverflow.com/comment/34528174
has answer: http://stackoverflow.com/a/22667561
has comment: http://stackoverflow.com/comment/34527450
has comment: http://stackoverflow.com/comment/34527378
has comment: http://stackoverflow.com/comment/34526510
has comment: http://stackoverflow.com/comment/34527853
tagged with: java
has comment: http://stackoverflow.com/comment/34528059
has title: No data found Exception
tagged with: servlets
has comment: http://stackoverflow.com/comment/34528833
has comment: http://stackoverflow.com/comment/34528254
type: AnsweredQuestion
downvote count: 0
has comment: http://stackoverflow.com/comment/34527801
favorite count: 0
accepted answer: http://stackoverflow.com/a/22667561
type: Question
tagged with: sql
tagged with: jdbc
has body: I was working on jdbc odbc connection using servlets.But am getting java.sql.SQLException: No data found.What can be the reason.?Please help.I am looking for my mistake since a day but not able to get it till yet. Connection con=null; PreparedStatement ps=null,ps1=null,ps2=null; ResultSet rs=null,rs1=null; con=DriverManager.getConnection("jdbc:odbc:SharedCryptography", "fyp", "fyp"); ps=con.prepareStatement("insert into tbGroup values ('G0',?,?,?,'Y')"); ps2=con.prepareStatement("insert into tbGroupAdmin values ('U0',?,?,?,?,?,?,?,?)"); Here String n1,n2,n3,n4,n5,n6,n7,n8 are strings obtained from html form String sql1 = "SELECT GNAME,OEMAIL FROM tbGroup where GNAME = '"+n1+"' and OEMAIL = '"+n3+"'" ; ps1 = con.prepareStatement(sql1); rs=ps1.executeQuery(); if(rs.next()){ out.println("THIS GROUP WITH SAME ID EXISTS"); } else{ ps.setString(1,n1); ps.setString(2,n3); ps.setString(3,n5); ps.execute(); out.println("inserted"); ResultSet rs2=null; String sql2="SELECT G_ID FROM tbGroup where GNAME like '"+n1+"' and OEMAIL like '"+n3+"'"; PreparedStatement ps3 = con.prepareStatement(sql2); rs2=ps3.executeQuery(); rs2.next(); String mypassword="password"; ps2.setString(1,rs2.getString(1)); ps2.setString(2,n2); ps2.setString(3,mypassword); ps2.setString(4,n6); ps2.setString(5,n7); ps2.setString(6,n3); ps2.setString(7,n4); ps2.setInt(8,Integer.parseInt(n8)); ps2.execute(); } My database has two tables : TABLE 1 : tbGroup G_ID VARCHAR2(10) GNAME VARCHAR2(20) OEMAIL VARCHAR2(50) Agenda VARCHAR2(50) Status CHAR(5) Table 2 : tbGroupAdmin GADMIN_ID VARCHAR2(5) GA_GROUPID VARCHAR2(5) GA_NAME VARCHAR2(20) GA_PASSWORD VARCHAR2(20) GA_FNAME VARCHAR2(20) LastName VARCHAR2(20) GA_EmailId VARCHAR2(50) GA_ContactNumber VARCHAR2(20) GA_Age NUMBER
score: 1

http://stackoverflow.com/q/22766117
has comment: http://stackoverflow.com/comment/34706982
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/34707631
tagged with: java
has body: I need to do a program with a method that receives a two dimensional 3*3 array with the information of several Professors (created in a class called "Profesor". The information includes their ID, name, last name, age, sex, amount of hours worked and how much they win per hour, in that specific order set by the constructor), and sort them by their age and their daily salary in two separate methods. Their information is provided through the constructor. Also, their daily salary is calculated with a Salary() method (in the "Profesor" class), which returns the amount of hours times the amount they make per hours. Here's my code so far: public class Main { /** * @param args the command line arguments */ public static void main(String[] args) { // TODO code application logic here Scanner in = new Scanner(System.in); Profesor arreglo[][]; arreglo = new Profesor[3][3]; Profesor profe1 = new Profesor(126509404, "Edgar", "Hernandez", 28, "M", 8, 0); profe1.setMoneyPerHour(1.66); Profesor profe2 = new Profesor(233849920, "Nuria", "Ramírez", 52, "F", 4, 0); profe2.setMoneyPerHour(2.43); Profesor profe3 = new Profesor(126509404, "José", "Hernandez", 29, "M", 8, 0); profe3.setMoneyPerHour(1.84); Profesor profe4 = new Profesor(126509404, "Arlene", "Hernandez", 34, "F", 6, 0); profe4.setMoneyPerHour(2.00); Profesor profe5 = new Profesor(126509404, "Orlando", "Hernandez", 36, "M", 10, 0); profe5.setMoneyPerHour(1.66); Profesor profe6 = new Profesor(126509404, "Ximena", "Hernandez", 55, "F", 4, 0); profe6.setMoneyPerHour(2.30); Profesor profe7 = new Profesor(126509404, "Eduardo", "Hernandez", 44, "M", 8, 0); profe7.setMoneyPerHour(1.66); Profesor profe8 = new Profesor(126509404, "Johanna", "Hernandez", 35, "F", 8, 0); profe8.setMoneyPerHour(1.66); Profesor profe9 = new Profesor(126509404, "Gilberto", "Hernandez", 42, "M", 8, 0); profe9.setMoneyPerHour(1.66); arreglo[0][0] = profe1; arreglo[0][1] = profe2; arreglo[0][2] = profe3; arreglo[1][0] = profe4; arreglo[1][1] = profe5; arreglo…
has comment: http://stackoverflow.com/comment/34707402
has comment: http://stackoverflow.com/comment/34707300
has answer: http://stackoverflow.com/a/22767036
type: Question
has comment: http://stackoverflow.com/comment/34706928
has comment: http://stackoverflow.com/comment/34707016
score: 0
has comment: http://stackoverflow.com/comment/34707884
answer count: 1
tagged with: arrays
tagged with: sorting
has comment: http://stackoverflow.com/comment/34707661
has comment: http://stackoverflow.com/comment/34707563
tagged with: multidimensional-array
has comment: http://stackoverflow.com/comment/34707348
accepted answer: http://stackoverflow.com/a/22767036
has title: Sort a two-dimensional array of teachers
has comment: http://stackoverflow.com/comment/34707966
has comment: http://stackoverflow.com/comment/34707739
has comment: http://stackoverflow.com/comment/34707484

http://stackoverflow.com/comment/34662961
comment on: http://stackoverflow.com/q/22740753
score: 0
type: QuestionComment
has text: I see no Java code here.
type: Comment

http://stackoverflow.com/q/22757852
upvote count: 1
favorite count: 0
possible better answer: http://stackoverflow.com/a/22760712
accepted answer: http://stackoverflow.com/a/22769380
has body: I am doing some SfM and having troubles getting R and T from the essential matrix. Here is what I am doing in sourcecode: Mat fundamental = Calib3d.findFundamentalMat(object_left, object_right); Mat E = new Mat(); Core.multiply(cameraMatrix.t(), fundamental, E); // cameraMatrix.t()*fundamental*cameraMatrix; Core.multiply(E, cameraMatrix, E); Mat R = new Mat(); Mat.zeros(3, 3, CvType.CV_64FC1).copyTo(R); Mat T = new Mat(); calculateRT(E, R, T); where `calculateRT` is defined as follows: private void calculateRT(Mat E, Mat R, Mat T) { /* * //-- Step 6: calculate Rotation Matrix and Translation Vector Matx34d P; //decompose E SVD svd(E,SVD::MODIFY_A); Mat svd_u = svd.u; Mat svd_vt = svd.vt; Mat svd_w = svd.w; Matx33d W(0,-1,0,1,0,0,0,0,1);//HZ 9.13 Mat_&lt;double&gt; R = svd_u * Mat(W) * svd_vt; // Mat_&lt;double&gt; T = svd_u.col(2); //u3 if (!CheckCoherentRotation (R)) { std::cout&lt;&lt;"resulting rotation is not coherent\n"; return 0; } */ Mat w = new Mat(); Mat u = new Mat(); Mat vt = new Mat(); Core.SVDecomp(E, w, u, vt, Core.DECOMP_SVD); // Maybe use flags Mat W = new Mat(new Size(3,3), CvType.CV_64FC1); W.put(0, 0, W_Values); Core.multiply(u, W, R); Core.multiply(R, vt, R); T = u.col(2); } And here are the results of all matrizes after and during calculation. Number matches: 10299 Number of good matches: 590 Number of obj_points left: 590.0 CameraMatrix: [1133.601684570312, 0, 639.5; 0 , 1133.601684570312, 383.5; 0, 0, 1] DistortionCoeff: [0.06604336202144623; 0.21129509806633; 0; 0; -1.206771731376648] Fundamental: [4.209958176688844e-08, -8.477216249742946e-08, 9.132798068178793e-05; 3.165719895008366e-07, 6.437858397735847e-07, -0.0006976204595236443; 0.0004532506630569588, -0.0009224427024602799, 1] Essential: [0.05410018455525099, 0, 0; 0, 0.8272987826496967, 0; 0, 0, 1] U: (SVD) [0, 0, 1; 0, 0.9999999999999999, 0; 1, 0, 0] W: (SVD) [1; 0.8272987826496967; 0.05410018455525099] vt: (SVD) [0, 0, 1; 0, 1, 0; 1, 0, 0] R: [0, 0, 0; 0, 0, 0; 0, 0, 0] T: [1; 0; 0…
has answer: http://stackoverflow.com/a/22769380
downvote count: 0
tagged with: computer-vision
has title: Decomposition of essential matrix leads to wrong rotation and translation
type: Question
tagged with: opencv
type: AnsweredQuestion
score: 1
tagged with: java
answer count: 2
has answer: http://stackoverflow.com/a/22760712

http://stackoverflow.com/comment/62341818
type: AnswerComment
type: Comment
has text: This answer is helpful. There was a typo in my previous comment and I deleted that one. Thanks for your answer, have a good day :).
score: 2
comment on: http://stackoverflow.com/a/30071402

http://stackoverflow.com/comment/34569987
type: Comment
type: AnswerComment
has text: I have installed FP6, put the jars in you mentioned above, rolled back fp6 and I get the same error under all 3 conditions. You link is exactly the "IBM download" I was referring to in my original question. I edited it to make it more clear.
comment on: http://stackoverflow.com/a/22672875
score: 0

http://stackoverflow.com/comment/100567880
comment on: http://stackoverflow.com/a/57002990
has text: @Fuhrmanator I don't think there is an API equivalent to that method no.
type: AnswerComment
score: 0
type: Comment

http://stackoverflow.com/comment/34700219
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/22761675
has text: I deleted the entire workspace. I know this is not a good idea. but i had no choice.Thanks for your time.
score: 0

http://stackoverflow.com/comment/34599255
comment on: http://stackoverflow.com/q/22706339
score: 0
has text: @andrbmgi I tried that but since the shotsMade.get index has to change each game it didnt function when I tried that.
type: Comment
type: QuestionComment

http://stackoverflow.com/q/22679488
has title: How to use Eclipse for both PHP and Java?
tagged with: php
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/34550502
tagged with: java
has answer: http://stackoverflow.com/a/22679655
tagged with: eclipse
has body: There are Eclipse IDE for Java and Eclipse for PHP. I've already installed Eclipse for JAVA. I don't want to install another eclipse for PHP. Is it possible to use the same Eclipse for both Java and PHP? What is the right process.please tel me.
type: Question
answer count: 1
has comment: http://stackoverflow.com/comment/34550697
has comment: http://stackoverflow.com/comment/34550516
linked to: http://stackoverflow.com/q/2493085
score: 0
accepted answer: http://stackoverflow.com/a/22679655
has comment: http://stackoverflow.com/comment/105269744
has comment: http://stackoverflow.com/comment/34550628
duplicate of: http://stackoverflow.com/q/2493085

http://stackoverflow.com/q/22653912
has answer: http://stackoverflow.com/a/22658875
tagged with: image-rotation
accepted answer: http://stackoverflow.com/a/22658875
tagged with: swing
has title: Rotating image on top of another image
type: AnsweredQuestion
tagged with: rotation
has body: I have a method that I want to rotate an image when the user enters the number of degrees to rotate it. The method does that, but the thing is it's rotating the image so that the new image lays on top of the old one (which I don't want it to do; I just want the new image by itself). The RotateTest is just an abbreviated form of the class with all of the methods needed in the ButtonListener class that should be relevant to rotating the image. public class RotateTest { public Rotate() { try { String path = "default.jpg"; File imageFile = new File(path); imageURL = imageFile.toURI().toURL(); image = ImageIO.read(imageURL); this.imageLabel = new JLabel(imageLabel); } catch (IOException e) { } } public void setAngle(double angle) { this.angle = angle; } public void setImage(BufferedImage img) { this.image = img; } private class ButtonListener implements ActionListener { public void actionPerformed(ActionEvent event) { boolean doAgain = true; Artsy artsy = new Artsy(); if(event.getSource() == rotate) { //need something for cancel! do { String angleString = JOptionPane.showInputDialog("Please enter your angle in degrees."); double angle = Double.parseDouble(angleString); if(angle &lt; 0) { angle = 360 + angle; } setAngle(getAngle() + angle); setImage(artsy.doRotate(image, angle)); revalidate(); repaint(); System.out.println("The angle is " + getAngle()); } while(JOptionPane.OK_OPTION == 1); } else { if(doAgain) { setImage(artsy.doRotate(image, 360 - getAngle())); doAgain = false; setAngle(0); } revalidate(); repaint(); System.out.println("The angle is " + getAngle()); } } } And this is the other class with the method that rotates the image: public class Artsy { public BufferedImage doRotate(BufferedImage src, double angle) { angle = Math.toRadians(angle); Graphics2D g = (Graphics2D) src.getGraphics(); int w = src.getWidth(); int h = src.getHeight(); AffineTransform trans = new AffineTransform(); trans.rotate(angle, w / 2, h / 2); AffineTransformOp scaleOp = new AffineTrans…
tagged with: java
tagged with: image
type: Question
score: 0
answer count: 1

http://stackoverflow.com/comment/35301738
type: Comment
has text: @Boann: Did you really read the question, my answer and §17.5.1? We are talking about the impact of _final_ member variables of a class _C_ on the assignments of references for newly created _C_ objects to _non-final_ variables. Of course, the latter **can** be _volatile_ or _atomic_. Also, the OP apparently understands the semantics of §17.5.1. He wanted to know if there is a real benefit of §17.5.1.
comment on: http://stackoverflow.com/a/22745616
type: AnswerComment
score: 0

http://stackoverflow.com/q/22801373
tagged with: sha256
upvote count: 2
possible better answer: http://stackoverflow.com/a/22801416
type: Question
has answer: http://stackoverflow.com/a/22801416
accepted answer: http://stackoverflow.com/a/22801410
has body: I am trying to hash my users password which is of string type using SHA-256 I am using SHA-256 to hash the string using the following method String text = "abc"; MessageDigest digest = MessageDigest.getInstance("SHA-256"); byte[] hash = digest.digest(text.getBytes("UTF-8")); To convert the btye array to string , I used the following method String doc2 = new String(hash, "UTF-8"); When i print doc2 to output , i get rubbish �x����AA@�]�"#�a��z���a� What am i doing wrong ??? How do i hash a string using SHA-256 and convert it back to string ??
tagged with: java
answer count: 2
downvote count: 0
tagged with: string
has title: How to hash a string using SHA-256
favorite count: 0
linked to: http://stackoverflow.com/q/17574916
tagged with: hash
linked to: http://stackoverflow.com/q/5531455
has comment: http://stackoverflow.com/comment/34770701
has answer: http://stackoverflow.com/a/22801410
score: 2
type: AnsweredQuestion

http://stackoverflow.com/a/22669337
type: Answer
has body: When I cleaned up your code, it worked just fine - public static int binaryToDecimal(String binaryString) { int binaryLength = binaryString.length(); int decimal = 0; for (int i = binaryLength - 1; i &gt;= 0; i--) { if (binaryString.charAt(i) == '1') { decimal += Math.pow(2, binaryLength - 1 - i); } } return decimal; } public static void main(String[] args) { Scanner input = new Scanner(System.in); System.out.println("Enter a binary number: "); String inString = input.nextLine(); while (!"-1".equals(inString)) { System.out.println(binaryToDecimal(inString)); System.out.println("Enter a binary number: "); inString = input.nextLine(); } System.out.println("All set !"); } Output Enter a binary number: 01 1 Enter a binary number: 10 2 Enter a binary number: -1 All set !
answers question: http://stackoverflow.com/q/22668908
score: 0

http://stackoverflow.com/a/22683922
downvote count: 0
answers question: http://stackoverflow.com/q/22683800
has body: AFAIK you can't because the ActionListener will be created first and at that time must have access to the final variable login which isn't initialized yet. The order of calls would be like this: create an instance of the ActionListener pass that instance to the LoginFrame constructor assign the created frame to login Now assume the ActionListener constructor would access login - it wouldn't be initialized yet and would cause an error. To fix this you'd need to create the frame first and then set the ActionListener, i.e. final LoginFrame login = new LoginFrame(); login.addActionListener( new ActionListener() { ... } );
score: 3
type: AcceptedAnswer
upvote count: 3
type: Answer
accepted answer of: http://stackoverflow.com/q/22683800

http://stackoverflow.com/q/22715607
has comment: http://stackoverflow.com/comment/34617379
tagged with: arraylist
has comment: http://stackoverflow.com/comment/34620237
upvote count: 0
tagged with: user-interface
answer count: 1
has comment: http://stackoverflow.com/comment/34617661
favorite count: 0
tagged with: binary
type: UnansweredQuestion
has title: Updating gui binary arraylist
has answer: http://stackoverflow.com/a/22716840
has comment: http://stackoverflow.com/comment/34615859
has comment: http://stackoverflow.com/comment/34616547
tagged with: java
has comment: http://stackoverflow.com/comment/34617040
downvote count: 1
type: Question
has comment: http://stackoverflow.com/comment/34617794
has comment: http://stackoverflow.com/comment/34622425
has body: The goal of this program is to read a binary file into an arraylist then display it in the gui window. There are 5 indexs and i use curIndex to update it. My problem I believe lays in the refreshUI(). I cant get it to update with the new the index. I also am not sure how to set the fields in the refresh. If you could point me in the right direction that would be awesome! thank YOU ArrayList&lt;SalesAgent&gt; salesForce = new ArrayList&lt;&gt;(); int curIndex = 0; public RecordViewerPanel() throws ClassNotFoundException, IOException { initComponents(); ObjectInputStream input = new ObjectInputStream( new BufferedInputStream( new FileInputStream("sales.bin"))); while (curIndex &lt; 5) { String first = input.readUTF(); String last = input.readUTF(); double sales = input.readDouble(); Date date = (Date) input.readObject(); salesForce.add(new SalesAgent(first, last, sales, date)); refreshUI(); } } private void refreshUI() { salesForce.get(curIndex); lastTextField.setText(salesForce.getLast()); salesTextField.setText(String.valueOf(salesForce.getSales())); dateTextField.setText(String.valueOf(salesForce.getDate())); jPanel2.repaint(); curIndex++; } /** * This method is called from within the constructor to initialize the form. * WARNING: Do NOT modify this code. The content of this method is always * regenerated by the Form Editor. */ @SuppressWarnings("unchecked") nextButton.setText("&gt;&gt;"); nextButton.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { nextButtonActionPerformed(evt); } }); javax.swing.GroupLayout jPanel2Layout = new javax.swing.GroupLayout(jPanel2); jPanel2.setLayout(jPanel2Layout); jPanel2Layout.setHorizontalGroup( jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(jPanel2Layout.createSequentialGroup() .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING, false) .addGroup(jPanel2Layout.createSequentialGroup() .addG…
has comment: http://stackoverflow.com/comment/34617529
score: -1
has comment: http://stackoverflow.com/comment/34616642

http://stackoverflow.com/comment/34566423
comment on: http://stackoverflow.com/q/22688682
has text: try any of the O(n log n) algos..but for 12 items it shouldnt matter
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/50396353
has text: `UTC+1` is *not* a [proper offset](https://en.wikipedia.org/wiki/UTC_offset). Offsets must have a padding leading zero, as required by standards and by date-time libraries. So it should have been `UTC+01` or `UTC+01:00`. But experimenting with that string in Java 8 showed incorrect number of beats, too low by 42 (no kidding). The doc suggests using "GMT" as in "GMT-8:00". So in trying "GMT+01:00" I got results consistent with the .beats web site. Edited the code example above accordingly. Saved one line of code which I used to assign a `beats` variable to make the example more obvious.
score: 0
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/22693795

http://stackoverflow.com/a/22782778
downvote count: 0
upvote count: 2
answers question: http://stackoverflow.com/q/22782293
type: Answer
has body: Check whether the server is Running in Debugging mode. If so, then check whether the above mentioned method is called from somewhere.
score: 2

http://stackoverflow.com/comment/34747016
type: QuestionComment
comment on: http://stackoverflow.com/q/22788693
score: 0
has text: Is the button an off the shelf usb quiz button, or have you just wired a button to a usb port?
type: Comment

http://stackoverflow.com/comment/34578940
score: 0
type: Comment
comment on: http://stackoverflow.com/a/22694872
has text: I agree, but optimization was not the question. This code is just the fix of the code in the OP.
type: AnswerComment

http://stackoverflow.com/a/22719127
answers question: http://stackoverflow.com/q/22718898
upvote count: 1
type: Answer
downvote count: 0
score: 1
has body: One possibility: although you can't change the actual length of the array, you can use another variable to keep track of the "real" length (i.e. the number of elements in the array that you know are valid): int currentLength = employees.length; for (int i = 0; i &lt; currentLength; i++) { if (employees[i].getFirstName().equals(name)){ employees[i] = employees[currentLength - 1]; // employees[currentLength - 1] = null; ... could help reclaim storage currentLength--; break; } if (i == currentLength - 1) { System.out.println("That requested person is not employed at this firm.") } The program just "knows" that array elements from employees[currentLength] through employees[employees.length - 1] aren't meaningful. You could also set those meaningless elements to null so that there aren't unused references that could prevent some objects from being garbage-collected (this would be important in a larger program). This approach can be a bit error-prone, because you have to remember to use currentLength instead of employees.length. Overall, I think it's better to use an ArrayList, which has a way to delete elements.

http://stackoverflow.com/comment/34552495
score: 0
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/22653428
has text: If you are NOT sure that property file is NOT updated with the drop-down items then you can first ensure that both the lists having same size, if yes then ONLY carry on with the comparison or else, fail the test there on. See Updated code for that.

http://stackoverflow.com/a/22713127
has comment: http://stackoverflow.com/comment/34611502
has body: From the JVM specs it is 255 "An array type descriptor is valid only if it represents 255 or fewer dimensions." You may also check Array type descriptor may have more than 255 dimensions JVMS-2 has the assertions about array dimensions: "4.10 Limitations of the Java Virtual Machine ... The number of dimensions in an array is limited to 255 by the size of the dimensions opcode of the multianewarray instruction and by the constraints imposed on the multianewarray, anewarray, and newarray instructions by ?4.8.2. ..." and "4.4.1 The CONSTANT_Class_info Structure ... An array type descriptor is valid only if it represents 255 or fewer dimensions." It looks like the last assertion is applied to the chapter 4.4.1 only. But the chapters: 2.7.5 Fully Qualified Names 4.2 The Internal Form of Fully Qualified Class and Interface Names 4.3 Descriptors (4.3.2 Field Descriptors and 4.3.3 Method Descriptors) say nothing about a number of dimensions limitation. Further, the following chapters: 4.4.6 The CONSTANT_NameAndType_info Structure 4.5 Fields 4.6 Methods refer to definitions of field descriptors and method descriptors (descriptor_index) and also say nothing about a dimensions limitation. So according to JVMS-2 the descriptor_index of CONSTANT_NameAndType_info, field_info or method_info structures may refer to field descriptor representing more than 255 dimensions or method descriptor with similar ParameterDescriptor or ReturnDescriptor.
has comment: http://stackoverflow.com/comment/34611160
type: Answer
upvote count: 4
downvote count: 0
answers question: http://stackoverflow.com/q/22713069
score: 4

http://stackoverflow.com/comment/37468384
comment on: http://stackoverflow.com/a/24237904
type: Comment
has text: If i change bookmark i found nothing in bookmark property(action), no zoom level.
score: 0
type: AnswerComment

http://stackoverflow.com/comment/34770393
comment on: http://stackoverflow.com/q/22785971
score: 0
type: Comment
type: QuestionComment
has text: What are you trying to achieve? You don't have permission to open layout file, and you need ids of all components doesn't sounds ok.

http://stackoverflow.com/comment/82397532
type: AnswerComment
has text: Is there a way you could pass an argument to the script?
type: Comment
comment on: http://stackoverflow.com/a/27170167
score: 0

http://stackoverflow.com/a/22652574
upvote count: 1
score: 1
downvote count: 0
type: Answer
has body: I'm confused because your first thing is absolutely correct, but then your main method doesn't do what you wrote. It just prints the CPU time (since the epoch) and does not compute the actual wall-time. The easiest way to change your program is to create a method (function) which does what your main method does, then simply insert the initial part. Here is an excerpt: private static void doMain(){ try { BufferedReader br = new BufferedReader(new FileReader("key.txt")); String key = br.readLine(); br.close(); FileInputStream fis = new FileInputStream("original.txt"); FileOutputStream fos = new FileOutputStream("encrypted.txt"); encrypt(key, fis, fos); FileInputStream fis2 = new FileInputStream("encrypted.txt"); FileOutputStream fos2 = new FileOutputStream("decrypted.txt"); decrypt(key, fis2, fos2); } catch (Throwable e) { e.printStackTrace(); } } Then your main method would simply be: public static void main(String ...args){ long startTime = System.nanoTime(); // call function doMain(); long endTime = System.nanoTime(); long timeDifference = endTime - startTime; } A better way to calculate the average time is to to do this several times (a single run which needs nanosecond precision isn't going to be very accurate). So you could do something like: public static void main(String ...args){ long startTime = System.nanoTime(); // call function for(int i = 0; i &lt; NUM; ++i) doMain(); long endTime = System.nanoTime(); long timeDifference = endTime - startTime; double avgTime = (double)timeDifference / (double)NUM; } I will strongly caution you though that this may not be accurate. There are two things you need to be wary of when trying to time things: 1) will the OS assume the data is already in RAM and 2) will the architecture assume the data is already in the cache. If you run this many times, you will likely be running at the speed of RAM and not at the speed of reading/writing the disk. To truly get an average speed, you need to ensure that the OS has to read/write t…
answers question: http://stackoverflow.com/q/22652351

http://stackoverflow.com/comment/34652344
type: Comment
score: 0
has text: your if statement's condition does not seem to make much sense to me
type: QuestionComment
comment on: http://stackoverflow.com/q/22735957

collections
tags question: http://stackoverflow.com/q/22710182
tags question: http://stackoverflow.com/q/22676304
tags question: http://stackoverflow.com/q/22763790
tags question: http://stackoverflow.com/q/22750152
tags question: http://stackoverflow.com/q/22792357
tags question: http://stackoverflow.com/q/22726220
tags question: http://stackoverflow.com/q/22723465
tags question: http://stackoverflow.com/q/22741687
tags question: http://stackoverflow.com/q/22719952
tags question: http://stackoverflow.com/q/22752206
tags question: http://stackoverflow.com/q/22662606
tags question: http://stackoverflow.com/q/22671315
tags question: http://stackoverflow.com/q/22663107
type: Tag
tags question: http://stackoverflow.com/q/22719783
tags question: http://stackoverflow.com/q/22648377
tags question: http://stackoverflow.com/q/22783030
tags question: http://stackoverflow.com/q/22799393
tags question: http://stackoverflow.com/q/22672781
tags question: http://stackoverflow.com/q/22721385
tag name: collections
tags question: http://stackoverflow.com/q/22660268
tags question: http://stackoverflow.com/q/22649050
tags question: http://stackoverflow.com/q/22715670
tags question: http://stackoverflow.com/q/22682358
tags question: http://stackoverflow.com/q/22721654
tags question: http://stackoverflow.com/q/22652788
tags question: http://stackoverflow.com/q/22658322
tags question: http://stackoverflow.com/q/22657379

http://stackoverflow.com/comment/34746716
type: AnswerComment
type: Comment
has text: Yes I create the test root using the command i specified in the original post and than i feed it to the tested class
comment on: http://stackoverflow.com/a/22785104
score: 0

http://stackoverflow.com/a/22786006
score: 2
has comment: http://stackoverflow.com/comment/34742226
has comment: http://stackoverflow.com/comment/34742748
has comment: http://stackoverflow.com/comment/34758296
has body: As i can see you already know Thread.sleep is static method and only sleeps the current thread running there are 2 places where you are using sleep(). BackgroundTestRunnerThread.sleep(sleepTime * 1000); in run() method:This can not be an issue as it will be always called in BackgroundTestRunnerThread thread not in main thread. pause(int milliseconds) method: I can not see your main thread code but chances are you are calling the pause method from main assuming it will sleep the BackgroundTestRunnerThread thread but because it might be getting called from main thread it will make main thread sleep not the other one. Hope this helps.
accepted answer of: http://stackoverflow.com/q/22782836
has comment: http://stackoverflow.com/comment/34762699
type: AcceptedAnswer
downvote count: 0
answers question: http://stackoverflow.com/q/22782836
has comment: http://stackoverflow.com/comment/34762882
upvote count: 2
type: Answer

http://stackoverflow.com/comment/34569617
type: Comment
has text: There are a lot of reasons why you would need it. The most common case is with a large or complex application with many threads that need the closure on an application-level as they may not have insight into each other. Otherwise it's just good practice, you should call System.exit(0) where your application is supposed to terminate gracefully, and define error codes otherwise. It is impossible for java -jar to hang on linux and not on windows, its your jar itself that is hanging.
comment on: http://stackoverflow.com/a/22690273
score: 0
type: AnswerComment

http://stackoverflow.com/comment/34774256
has text: There are a few issues with this answer, in general it does show a correct approach. The issues are that 1) You cannot call any stream operation on a `List<E>`, you first need to call `stream()` on the list to obtan a `Stream<E>`; 2) You are currently printing out the `bar` value, while the OP intends to print out the `foo` value.
type: AnswerComment
score: 2
comment on: http://stackoverflow.com/a/22800184
type: Comment

http://stackoverflow.com/q/22648993
duplicate of: http://stackoverflow.com/q/18564029
type: UnansweredQuestion
has title: How to change the code in Lucene 4.0
tagged with: lucene
type: Question
has body: Here is the code: protected Document getDocument(File f) throws Exception { Document doc = new Document(); doc.add(new Field("contents", new FileReader(f),Field.TermVector.WITH_POSITIONS_OFFSETS)); FileReader fr = new FileReader(f); doc.add(new Field("filename", f.getName(), Field.Store.YES, Field.Index.NOT_ANALYZED)); doc.add(new Field("fullpath", f.getCanonicalPath(), Field.Store.YES, Field.Index.NOT_ANALYZED)); return doc; } I change the version from 3.6 to 4.0. So there are some method are deprecated. FOr example: doc.add(new Field) the Field is deprecated. Field.TermVector the TremVector is deprecated.And the Field.Index the Index is also deprecated.
favorite count: 0
has comment: http://stackoverflow.com/comment/34496909
has answer: http://stackoverflow.com/a/22654297
downvote count: 2
score: -2
answer count: 1
tagged with: java
linked to: http://stackoverflow.com/q/18564029
upvote count: 0

instantiation
type: Tag
tags question: http://stackoverflow.com/q/22694596
tags question: http://stackoverflow.com/q/22758214
tags question: http://stackoverflow.com/q/22790290
tag name: instantiation

http://stackoverflow.com/comment/34747590
comment on: http://stackoverflow.com/q/22785838
score: 0
has text: this is right, thank you! i fixed it. did not fix the problem though ;)
type: Comment
type: QuestionComment

http://stackoverflow.com/a/22762583
has body: No, it is not correct. The draw() always uses the left, lower corner as position. The origin is used for scaling and rotation only. So for you this means, that you have to subtract the origin from your position: batch.draw(sprite.getTexture(), this.x - spriteOriginX, this.y - spriteOriginY, spriteOriginX, spriteOriginY, spriteWidth, spriteHeight, 1.0f, 1.0f, this.directionFaced, sprite.getRegionX(), sprite.getRegionY(), sprite.getRegionWidth(), sprite.getRegionHeight(), false, false ); By doing this you just "push" the left lower corner (which is the position) to the left and down, by half width and half height, so that your position really defines the center of the sprite. Again: The origin is only used for rotation and scaling. If you set a rotation in the draw() method it will be rotated arround the origin (in your case the middle).
has comment: http://stackoverflow.com/comment/34701143
upvote count: 8
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/34701523
type: Answer
score: 8
accepted answer of: http://stackoverflow.com/q/22761894
answers question: http://stackoverflow.com/q/22761894

http://stackoverflow.com/comment/34686893
type: QuestionComment
score: 0
has text: Sorry, my bad, first of all, the program has a 7*11 Maze, "B" presents obstacle and a fixed ending point which presents as "X" and what the program would do is, you can enter a coordinate into it to make it as your starting point. Then the program would find a way from your starting point to the end (also the path will be shown in "O"). I tried to use recursion during this process, however it wouldn't work, and I don't know why.. @Lutz Horn
comment on: http://stackoverflow.com/q/22754766
type: Comment

http://stackoverflow.com/a/22733165
answers question: http://stackoverflow.com/q/22733132
score: 4
has body: The .class file is machine-readable. The machine that reads it is the Java Virtual Machine, which interprets it and compiles it to native code (executable by your computer). You don't need the .java files to run Java code. The .class files are all you need.
type: Answer
upvote count: 4
downvote count: 0

http://stackoverflow.com/q/22735326
has comment: http://stackoverflow.com/comment/34651273
has comment: http://stackoverflow.com/comment/34651277
tagged with: java
has answer: http://stackoverflow.com/a/22735471
has answer: http://stackoverflow.com/a/22735361
type: Question
tagged with: android-layout
has body: I have this Button: &lt;Button android:id="@+id/button1" android:layout_width="130dp" android:layout_height="35dp" android:layout_alignRight="@+id/editText2" android:layout_alignTop="@+id/imageView1" android:layout_marginTop="23dp" android:text="Increase" /&gt; How can i make it so that whenever the button is clicked, the count in a textview goes up, for example if the number is first 0, and then you click the button it changes to 1?
score: 0
answer count: 3
tagged with: button
type: UnansweredQuestion
tagged with: android
has answer: http://stackoverflow.com/a/22735495
has title: Numbers increasing when button clicked

http://stackoverflow.com/comment/34656868
score: 0
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/22737993
has text: Yes. It is drawing the image, but I think that it is too large to display in my small area. So basically, for some reason it is not resizing the image with my calls.

http://stackoverflow.com/q/22675322
tagged with: memory
has answer: http://stackoverflow.com/a/55574870
type: Question
answer count: 2
upvote count: 1
has body: Using Processing, I am working on a project that pairs video clips and strings from a txt file at random. Whenever I run the program, eventually it stops and I receive a mess of the same error: JNA: Callback org.gstreamer.elements.AppSink$3@1bf404f threw the following exception: java.lang.OutofMemoryError: Java heap space I am suspecting that there is a memory leak with how I am handling the creation and deallocation of my Movie object, but I can't figure out what's wrong. setup() is where I first instantiate the Movie object in order to prep for the first iteration. In my draw(), to me it looks like I am resetting the Movie object to null each time before instantiating it again, which to my mind should take care of the memory issue but that does not seem to be the case. Can anyone provide a solution? In my preferences, I do have my memory increased to 256 MB but I know that increasing the memory only delays the inevitable error. Thank You! Here is my code: import processing.video.*; PFont font; String[] posts; // strings loaded in setup() String[] videos = {"1a.mov", "2a.mov", "3a.mov", "4a.mov", "5a.mov", "6a.mov", "7a.mov", "8a.mov", "9a.mov"}; // video clips String post; Post first; // First post Post p; // Next iteration of posts Movie myMovie; String clip; int count; // Iteration counter int a = 0; // image() float duration = 0; // Movie duration float time = 0; // Movie time void setup(){ size(displayWidth, displayHeight); background(0); posts = loadStrings("posts.txt"); // load strings from file font = loadFont("HelveticaNeue-Bold-48.vlw"); // load font post = posts[int(random(posts.length))]; // use random post textFont(font); // Set text font textSize(50); textAlign(CENTER); fill(255, 248, 43); // Yellow fill if (frame != null){ frame.setResizable(true); // resizable window } /** Random generation of initial clip and post */ clip = videos[int(random(videos.length))]; myMovie = new Movie(this, clip); makeTint(); myMovie.play(); count++; first = new Post(pos…
favorite count: 0
has title: Memory Leak in Processing
has answer: http://stackoverflow.com/a/22675471
accepted answer: http://stackoverflow.com/a/22675471
score: 0
tagged with: heap-memory
tagged with: memory-leaks
possible better answer: http://stackoverflow.com/a/55574870
downvote count: 1
tagged with: processing
type: AnsweredQuestion
tagged with: java

http://stackoverflow.com/q/22744770
has body: I have a server that can let user to upload the file. After the user uploads the file, I send a post request to this server In doGet Method, I did this: if (path.endsWith("/upload")) { out.println("&lt;html&gt;"); out.println("&lt;body&gt;"); out.print("&lt;form action=\"/MySelf/upload\" method=\"POST\" enctype=\"multipart/form-data\"&gt;"); out.print("&lt;input name=\"file\" type=\"file\" size=\"50\"&gt;"); out.print("&lt;input name=\"submit\" type=\"submit\" value=\"submit\"&gt;"); out.print("&lt;/form&gt;"); out.println("&lt;/body&gt;"); out.println("&lt;/html&gt;"); } In doPost method, I can do this: if (path.endsWith("/upload")) { Part filePart = request.getPart("file"); String filename = getFilename(filePart); //Wanna send this filePart to other servers(for example:127.0.0.1:8888,127.0.0.1:8889 etc.) } Now, I wanna send this filePart to other servers now, how can I use HttpURLConnection to do this?
accepted answer: http://stackoverflow.com/a/22745160
score: 0
has title: How to receive a file and send it to different servers
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/22745160
tagged with: java
tagged with: servlets
tagged with: post
type: Question
answer count: 1
tagged with: web
tagged with: file-upload

http://stackoverflow.com/q/22699650
score: 1
tagged with: java
upvote count: 1
type: Question
has body: i want to call soap function with a few parameters. I did it python but how can i do it on java ? my code on python : url = 'http://78.188.50.246:8086/iskultur?singleWsdl' client = Client(url) d = dict(UserId='a', UserPass='b', Barkod=str(value)) result = client.service.Stok(**d) return int(result) how can i do it on java ? Thanks for all
has answer: http://stackoverflow.com/a/22700115
answer count: 1
downvote count: 0
accepted answer: http://stackoverflow.com/a/22700115
favorite count: 0
has title: Java soap client to wsdl url
tagged with: soap
type: AnsweredQuestion

http://stackoverflow.com/comment/34614203
comment on: http://stackoverflow.com/q/22714741
type: Comment
type: QuestionComment
score: 1
has text: If you need to check if the hunger drops below `20`, why you are comparing `hungry <= 0`? Also, try to follow Java naming conventions. Use names like `someVar` for variables/methods and use names like `SomeClass` for classes.

http://stackoverflow.com/a/22742721
downvote count: 0
type: Answer
score: 2
upvote count: 2
has comment: http://stackoverflow.com/comment/34675703
answers question: http://stackoverflow.com/q/22742612
has body: Check this version of your code. The main new thing is the Updater class which implements Runnable. See how it is used here. See also the changes in private void start(). See also the enabled flag in the Updater class. import java.awt.Font; import java.awt.GridBagConstraints; import java.awt.GridBagLayout; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import javax.swing.JButton; import javax.swing.JFrame; import javax.swing.JLabel; import javax.swing.SwingUtilities; public class MainFrame extends JFrame { public static final long serialVersionUID = 380931874973423432L; private Updater currentUpdater = null; private Thread currentWorker = null; private int cnt = 0; private JLabel countLabel1 = new JLabel("0"); private JLabel statusLabel = new JLabel("Initialized."); private JButton startButton = new JButton("Start"); public MainFrame(String title) { super(title); setLayout(new GridBagLayout()); countLabel1.setFont(new Font("serif", Font.BOLD, 28)); GridBagConstraints gc = new GridBagConstraints(); gc.fill = GridBagConstraints.NONE; gc.gridx = 0; gc.gridy = 0; gc.weightx = 1; gc.weighty = 1; add(countLabel1, gc); gc.gridx = 0; gc.gridy = 1; gc.weightx = 1; gc.weighty = 1; add(statusLabel, gc); gc.gridx = 0; gc.gridy = 2; gc.weightx = 1; gc.weighty = 1; add(startButton, gc); startButton.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent arg0) { start(); } }); setSize(400, 400); setDefaultCloseOperation(EXIT_ON_CLOSE); setVisible(true); } private void start() { cnt++; Thread cw = this.currentWorker; if (currentUpdater != null) { currentUpdater.setEnabled(false); } Updater newUpdater = new Updater(this, cnt); Thread newWorker = new Thread(newUpdater); try{ if (cw!=null) cw.join(); }catch(InterruptedException ex){ ex.printStackTrace(); } this.currentUpdater = newUpdater; this.currentWorker = newWorker; newWorker.start(); } public JLabel getCountLabel1() { return countLabel1; } public void setCountLabel1(JLabel count…

http://stackoverflow.com/q/22764576
favorite count: 0
tagged with: atmosphere
tagged with: jakarta-ee
type: AnsweredQuestion
downvote count: 0
score: 1
tagged with: java
linked to: http://stackoverflow.com/q/7328544
type: Question
accepted answer: http://stackoverflow.com/a/22765946
answer count: 1
has body: The pubsub example of atmosphere is deployed to weblogic 12c. with the below small change i deployed the app var request = { url :document.location.toString()+'ws/pubsub/' + getElementByIdValue('topic'), Gives the following error... On server side org.atmosphere.websocket.protocol.SimpleHttpProtocol BEA-000000 Status code higher or equal than 400 Status 405 Message Method Not Allowed In script console(chrome) Network ERROR: 405:Method Not Allowed ERROR: 405:Method Not Allowed message=testing pubsub sent trying to use websocket console GET =1396276957934">http://localhost:7001/atmosphere/ws/pubsub/Test?X-Atmosphere-Transport=close&amp;X-Atmosphere-tracking-id=&amp;=1396276957934 400 (Bad Request) atmosphere.js:1816 WebSocket connection to 'ws://localhost:7001/atmosphere/ws/pubsub/Test?X-Atmosphere-tracking-id=0&amp;X-Atmosphere-Framework=2.1.4-javascript&amp;X-Atmosphere-Transport=websocket&amp;X-Atmosphere-TrackMessageSize=true&amp;X-Cache-Date=0&amp;X-atmo-protocol=true' failed: Received a broken close frame containing a reserved status code.
has title: Atmosphere Pubsub example error on weblogic 12c
upvote count: 1
has answer: http://stackoverflow.com/a/22765946

http://stackoverflow.com/comment/34718965
score: 0
comment on: http://stackoverflow.com/q/22772664
type: Comment
type: QuestionComment
has text: Does 'frank' has to be part of the regexp or do you only want to get only "number" words?

http://stackoverflow.com/a/22750918
score: 0
type: AcceptedAnswer
has body: Try: imgv.setImageResource(R.drawable.player1); Instead of: imgv=setImageResource(R.drawable.player1); Because setImageResource is a method of the ImageView.
type: Answer
accepted answer of: http://stackoverflow.com/q/22750896
answers question: http://stackoverflow.com/q/22750896

http://stackoverflow.com/comment/34781721
type: Comment
type: QuestionComment
score: 3
has text: You can't. `MouseEvent` carries with it information about the mouse, buttons, modifiers, etc, the `ActionEvent` carries none of this information and in fact, could be generated by the keyboard or programmatically. Supply a use case for your problem, maybe we can figure out a better solution
comment on: http://stackoverflow.com/q/22807961

http://stackoverflow.com/comment/34687163
score: 0
type: Comment
comment on: http://stackoverflow.com/a/22755216
type: AnswerComment
has text: How to receive returned value of method `abc` and `xyz`?

http://stackoverflow.com/comment/34749544
score: 1
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/22789866
has text: Feeling like a dum-dum, so here's a real protip: do not use https when connecting to localhost.

http://stackoverflow.com/a/22651332
has body: use Integer(Object Reference)array instead of int array (primitive). So u can get reference back and u can use it later for further processing.
type: Answer
has comment: http://stackoverflow.com/comment/34500836
score: 0
answers question: http://stackoverflow.com/q/22651308

http://stackoverflow.com/a/22679062
has comment: http://stackoverflow.com/comment/35575359
type: Answer
accepted answer of: http://stackoverflow.com/q/22678755
has comment: http://stackoverflow.com/comment/34549969
score: 0
has body: You need to initialize the objects in the hashArray array. hashArray[index] = new LinkList(); hashArray[index].insertLink(value); Side note: when commenting in your file, don't use /** text **/ since that is reserved for Javadoc.
answers question: http://stackoverflow.com/q/22678755
type: AcceptedAnswer

http://stackoverflow.com/a/22692804
type: Answer
accepted answer of: http://stackoverflow.com/q/22690905
answers question: http://stackoverflow.com/q/22690905
score: 0
has body: As this solved your problem, posting it as an answer. Firstly, you need to ensure that you're either passing the request along the application filter chain, or you're redirecting it: @Override public void doFilter(ServletRequest request, ServletResponse response, FilterChain filterChain) throws IOException, ServletException { Boolean filtered = false; System.out.println("request intercepted"); if (!filtered) { filtered = true; ((HttpServletResponse) response).sendRedirect("/Servlet1"); return; } filterChain.doFilter(request, response); } Then you need to ensure that the filter knows when an incoming request has already been redirected, so that it doesn't redirect it again: @Override public void doFilter(ServletRequest request, ServletResponse response, FilterChain filterChain) throws IOException, ServletException { Boolean filtered = false; System.out.println("request intercepted"); if (request.getAttribute("filtered") != null) { filtered = (Boolean) request.getAttribute("filtered"); } if (!filtered) { request.setAttribute("filtered", Boolean.TRUE); ((HttpServletResponse) response).sendRedirect("/Servlet1"); return; } filterChain.doFilter(request, response); }
type: AcceptedAnswer

http://stackoverflow.com/comment/34667529
score: 0
comment on: http://stackoverflow.com/q/22743793
type: Comment
type: QuestionComment
has text: No, I use: import java.util.ArrayList; import java.util.Iterator;

http://stackoverflow.com/comment/34572730
type: Comment
comment on: http://stackoverflow.com/a/22691683
score: 1
type: AnswerComment
has text: Oops, my bad :). Then I got nothing for you, so much changed in JIT under the covers between Java 6 and 7.

http://stackoverflow.com/q/22745989
has comment: http://stackoverflow.com/comment/34670009
type: AnsweredQuestion
tagged with: java
has comment: http://stackoverflow.com/comment/34670114
tagged with: multithreading
has answer: http://stackoverflow.com/a/22746043
accepted answer: http://stackoverflow.com/a/22746043
has title: Multithreading - Synchronizing the block for all instances of an Object
type: Question
has comment: http://stackoverflow.com/comment/34669970
score: 0
answer count: 1
has comment: http://stackoverflow.com/comment/34670091
has comment: http://stackoverflow.com/comment/34670249
has body: I have a class as Calculate. I created two threads both working on different instances of this class and tried to get the value of i. But both are giving me same values. I want if one thread of a instance is working then the thread working on other instance should wait. public class Calculate { private int i=2; public void showNumber(){ synchronized(Calculate.class){ i=i+2; } System.out.println(Thread.currentThread()+"Value of i is "+i); } } class Test1 implements Runnable{ Calculate c=null; public Test1(Calculate c){ this.c=c; } @Override public void run() { System.out.println(Thread.currentThread()+" Running"); c.showNumber(); } } public class ThreadingPractise { public static void main(String[] args) { Calculate c=new Calculate(); Calculate c1=new Calculate(); Thread t1=new Thread(new Test1(c),"t1"); Thread t2=new Thread(new Test1(c1),"t2"); t1.start(); t2.start(); } }
has comment: http://stackoverflow.com/comment/34670127

http://stackoverflow.com/comment/34622444
type: AnswerComment
score: 0
comment on: http://stackoverflow.com/a/22698882
has text: Yes, it is. After persist proyecto object and flush, I check all the properties of proyecto. All of them are correct and its primary key (id) as well. Then, I create incidencia object with this proyecto, add incidencia to proyecto, set a back reference on the incidencia object (I think, this is redundant) and finally, flush. But the exception is still thrown.
type: Comment

http://stackoverflow.com/q/22721400
duplicate of: http://stackoverflow.com/q/22591499
type: Question
answer count: 1
has body: I've been reading a few articles about the new Java 8 features. With the introduction of Extension Methods i.e. methods that are prefixed with the default keyword and provide an implementation. I checked a couple of questions here where people have asked about the differences in abstract classes and interfaces like the one here and here and the biggest difference seems to be that abstract classes allowed you to specify default implementations. Does this mean that the difference between Abstract Classes and Interfaces is largely cosmetic and given the fact that a class can implement multiple interfaces; they give more flexibility in both design and implementation. I can see that abstract classes are here to stay, primarily for being backward compatible with older code. Would I be right in not using Abstract Classes going forward and use Interfaces only? If not could you provide an example, just having some fields defined in the abstract class doesn't count. I'm looking for a compelling use case where Abstract Classes are still a better fit when compared to Interfaces. On the flip side the purists would argue that the default implementations pollute the interfaces which should only specify the contract and the behavior should always be in the Concrete classes(A part of the behavior could be in abstract classes). Is there any merit to this argument?
tagged with: abstract-class
linked to: http://stackoverflow.com/q/22591499
upvote count: 1
has comment: http://stackoverflow.com/comment/34626720
favorite count: 0
tagged with: interface
has answer: http://stackoverflow.com/a/22721486
accepted answer: http://stackoverflow.com/a/22721486
linked to: http://stackoverflow.com/q/2845601
tagged with: java-8
has comment: http://stackoverflow.com/comment/34626649
has title: Are abstract classes of any use in Java 8
type: AnsweredQuestion
linked to: http://stackoverflow.com/q/761194
tagged with: oop
downvote count: 0
score: 1
tagged with: java

hid
tags question: http://stackoverflow.com/q/22670649
tag name: hid
type: Tag

http://stackoverflow.com/comment/34547350
type: Comment
comment on: http://stackoverflow.com/a/22677384
has text: If you explain it in a little more detail, I may be able to help you. Why are you trying to do things with buttons in an activity that doesn't have buttons in the view?
type: AnswerComment
score: 0

http://stackoverflow.com/comment/34753855
type: AnswerComment
comment on: http://stackoverflow.com/a/22791349
type: Comment
has text: @user2051194 Then your styles are correct. Apply `Theme.Bessel` in your `AndroidManifest` to your `application` tag or each individual `activity` tag if you don't want your entire app to inherit the theme.
score: 0

http://stackoverflow.com/q/22744799
has comment: http://stackoverflow.com/comment/34667940
has comment: http://stackoverflow.com/comment/34667952
has body: I am working on an android Temperature converter app(which does not work). At first I saw this message on LogCat the application may be doing too much work on its main thread I then removed the code that was never used. Now, this is the error: java.lang.RuntimeException: Unable to start activity Code: Main_Activity.java package com.example.tempconverter; import android.support.v7.app.ActionBarActivity; import android.os.Bundle; import android.view.View; import android.view.View.OnClickListener; import android.widget.Button; import android.widget.EditText; public class MainActivity extends ActionBarActivity { @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); final EditText editCelsius = (EditText) findViewById(R.id.editCelsius); final EditText editFahrenheit = (EditText) findViewById(R.id.editFahrenheit); Button buttonConvert =(Button)findViewById(R.id.buttonConvert); buttonConvert.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { // TODO Auto-generated method stub double celsius = Double.valueOf(editCelsius.getText().toString()); double fahrenheit = (celsius * 9)/5 +32; editFahrenheit.setText(String.valueOf(fahrenheit)); } }); } } The code in 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.tempconverter.MainActivity$PlaceholderFragment" &gt; &lt;TextView android:id="@+id/textCelsius" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_alignParentLeft="true" android:layout_alignParentTop="true" android:…
tagged with: eclipse
accepted answer: http://stackoverflow.com/a/22744966
has comment: http://stackoverflow.com/comment/34667928
downvote count: 0
answer count: 1
favorite count: 0
tagged with: android
has comment: http://stackoverflow.com/comment/34667932
has title: java.lang.RuntimeException: Unable to start activity and skipping frames
score: 2
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/22744966
upvote count: 2
has comment: http://stackoverflow.com/comment/34667874
tagged with: java
type: Question

http://stackoverflow.com/comment/34615372
type: Comment
comment on: http://stackoverflow.com/a/22679157
type: AnswerComment
score: 0
has text: try updating your ~/.bashrc by adding the export PATH to it, this way the PATH var gets set to include jdk everytime you login with that user

http://stackoverflow.com/q/22733176
has body: I am pretty new to dropwizard and guice. When I hit my api from an ajax code locally, I get the following error on my browser's console. No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin 'null' is therefore not allowed access. After researching the error many people are suggesting adding CrossORiginFilter to my dropwizard code. which is done thru env.addFilter But I am trying to use Guice. here is my main class public static void main( String[] args ) throws Exception { new TListService().run( args ); } @Override public void initialize( Bootstrap&lt;TListServiceConfiguration&gt; bootstrap ) { bootstrap.setName( "tlist" ); bootstrap.addBundle( GuiceBundle.&lt; TListServiceConfiguration &gt; newBuilder().addModule( new JpaPersistModule( this.getClass().getPackage().getName() ) ).setConfigClass( TListServiceConfiguration.class ) .enableAutoConfig( this.getClass().getPackage().getName() ).build() ); } @Override public void run( TListServiceConfiguration config, Environment env ) throws Exception { } and here is my ajax code: $(document).ready(function() { $('#btnSend').click(function(){ var apiUrl = $('#txtServer').val() + $("#selectApi").val(); console.log("URL: " + apiUrl); var postData = JSON.parse($('#textData').val()); console.log(postData); console.log(JSON.stringify(postData)); $.ajax({ url: apiUrl, async: false, type: 'POST', dataType:"json", contentType:"application/json; charset=UTF-8", data: JSON.stringify(postData), }) .done(function(data) { console.log("success"); console.log(data); }) .fail(function() { console.error("Error"); }) .always(function() { console.log("complete"); }); }); });
upvote count: 3
tagged with: cross-domain
answer count: 2
tagged with: dropwizard
tagged with: guice
has comment: http://stackoverflow.com/comment/34688201
favorite count: 0
tagged with: ajax
has comment: http://stackoverflow.com/comment/34682283
possible better answer: http://stackoverflow.com/a/23218869
has answer: http://stackoverflow.com/a/23218869
has answer: http://stackoverflow.com/a/22768420
accepted answer: http://stackoverflow.com/a/22768420
type: AnsweredQuestion
score: 3
downvote count: 0
tagged with: java
has title: Add CrossOriginFilter to dropwizard using guice
has comment: http://stackoverflow.com/comment/34681628
type: Question

http://stackoverflow.com/q/22769681
possible better answer: http://stackoverflow.com/a/22769759
downvote count: 0
has answer: http://stackoverflow.com/a/22769759
has answer: http://stackoverflow.com/a/22769888
has comment: http://stackoverflow.com/comment/34713339
favorite count: 0
accepted answer: http://stackoverflow.com/a/22769888
has body: What is the simplest way to access an unnamed request parameter in a Spring MVC controller? Is there an annotation for this similar to @RequestParam? HTTP Delete request with unnamed parameter: http://localhost/myEndPoint?someUnnamedParam Controller: public class MyController { @RequestMapping(value = {"/myEndPoint"}, method = RequestMethod.DELETE) public void deleteThing() { // Do something with unnamed param } } Details: Spring 3.0.7
tagged with: spring
has comment: http://stackoverflow.com/comment/34713272
tagged with: spring-mvc
type: AnsweredQuestion
score: 1
has comment: http://stackoverflow.com/comment/34713194
tagged with: java
upvote count: 1
has title: Spring MVC: Get Unnamed Request Parameter
has comment: http://stackoverflow.com/comment/34713229
type: Question
answer count: 2

http://stackoverflow.com/a/22754147
has body: You only need one line to extract each part: String function = input.replaceAll("\\(.*", ""); String parameter = input.replaceAll(".*\\(|\\).*", "");
downvote count: 0
type: Answer
score: 1
upvote count: 1
has comment: http://stackoverflow.com/comment/34685174
answers question: http://stackoverflow.com/q/22753698

http://stackoverflow.com/a/22766816
upvote count: 2
accepted answer of: http://stackoverflow.com/q/22766746
type: Answer
answers question: http://stackoverflow.com/q/22766746
score: 2
has comment: http://stackoverflow.com/comment/34711180
has comment: http://stackoverflow.com/comment/34711218
has comment: http://stackoverflow.com/comment/34711840
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/34711343
has body: You can use a mocking library such as Mockito. For instance: final ProductItem mock = mock(ProductItem.class); when(mock.getTotal()).thenReturn(something); // same for .getTotalTax(), .getShipping() Then you can test your .getSubtotal() method: // Using BigDecimal's .compareTo() for reliable results... // "0" and "0.0" are not .equals() with BigDecimal! assertTrue(xxx.getSubtotal(mock).compareTo(expectedResult) == 0); Note that methods which you do not stub this way will return default values: 0 for primitives, null for objects and false for booleans. Note 2: requires that ProductItem is not final and that methods you stub are not final either; otherwise you'll have to use PowerMockito and have to write quite some glue as well... Note 3: works for abstract classes and interfaces as well; you can mock(Comparator.class) for instance

http://stackoverflow.com/comment/34844871
type: Comment
comment on: http://stackoverflow.com/a/22793510
has text: You are correct that I am not getting a good connection. But this derives from the in = OpenHttpConnection("http://www.wolframalpha.com/v2/input="+currencyVal+firstSelect+"-"+secondSelect+"&appid=J6HA6V-YHRLHJ8A8Q"); section of the code. For some reason or another nothing is being passed to the OpenHttpConnection(String urlString) even though I am sending it arguments.
type: AnswerComment
score: 0

wifi
tag name: wifi
type: Tag
tags question: http://stackoverflow.com/q/22780441
tags question: http://stackoverflow.com/q/22749300
tags question: http://stackoverflow.com/q/22732129

http://stackoverflow.com/q/22786203
has comment: http://stackoverflow.com/comment/34742571
has title: Android programming: How do I get out of a while loop?
accepted answer: http://stackoverflow.com/a/22786337
tagged with: button
favorite count: 0
has body: My program should repeat a method until a button is pressed. I tried this, but is doesn't work: @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); tts = new TextToSpeech(this, this); Button button1 = (Button)findViewById(R.id.button1); Button button2 = (Button)findViewById(R.id.button2); button1.setOnClickListener(this); button2.setOnClickListener(this); } public void onClick (View v){ switch(v.getId()) { case R.id.button1: mainprogram(); break; case R.id.button2: perform = false; break; } } public void mainprogram(){ while(perform == true){ speak(); } } (Of course I programmed the "speak()" method) Could you tell me where the problem is or if there are any methods to solve it?
has answer: http://stackoverflow.com/a/22786377
tagged with: android
tagged with: break
answer count: 4
type: AnsweredQuestion
score: 2
possible better answer: http://stackoverflow.com/a/22786377
upvote count: 3
tagged with: java
downvote count: 1
type: Question
has answer: http://stackoverflow.com/a/22786337
has answer: http://stackoverflow.com/a/22786246
linked to: http://stackoverflow.com/q/106591
has answer: http://stackoverflow.com/a/22786312
tagged with: while-loop
has comment: http://stackoverflow.com/comment/34742480

http://stackoverflow.com/q/22767115
has comment: http://stackoverflow.com/comment/34708723
upvote count: 1
answer count: 1
has comment: http://stackoverflow.com/comment/34731156
favorite count: 0
has title: Spring not instantiating an object correctly. WHY?
tagged with: zk
tagged with: spring
type: AnsweredQuestion
downvote count: 0
has comment: http://stackoverflow.com/comment/34708644
has body: I am learning how to use ZKoss, Maven and Spring just now by my own and i am having some issues that i don't ubnderstand and i would be really grateful if someone could help me. To me it looks like Spring is not instantiating correctly my calculator object, in "CalculadoraServlet". Here is the code: Zkoss (inidex.zul): <?page title="Auto Generated index.zul"?> Num1: <textbox id="num1" value="${win$composer.current.num1}" /> Num2: <textbox id="num2" value="${win$composer.current.num2}" /> Resultado <textbox id="result" value="${win$composer.current.result}" /> CalculadoraServlet: @Controller public class CalculadoraServlet extends SelectorComposer<Component>{ /** * */ private static final long serialVersionUID = 1L; @Autowired private Calculadora servicioCalculadora; @Wire private Textbox num1; @Wire private Textbox num2; @Wire private Textbox result; @Listen("onClick = #submitButton") public void calcula() throws IOException { int numero1=Integer.parseInt(num1.getValue()); int numero2=Integer.parseInt(num2.getValue()); int resultado=servicioCalculadora.sumar(numero1, numero2); String resul=Integer.toString(resultado); result.setValue(resul); System.out.println(resultado); } } And finaly Calculadora: package sdec; public class Calculadora { public Calculadora(){ //"Traza". Se mostrará cada vez que inicie la app y spring instancie un obj calculadora System.out.println("Calculadora inicializada por Spring"); } public int sumar(int num1, int num2){ return num1+num2; } } Thank you a lot in advance!! I am a junior programmer and this is prooving a bit difficult to understand! =( EDIT: (adding applicationContext file): <?xml version="1.0" encoding="UTF-8"?> <beans xmlns="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:p="http://www.springframework.org/schema/p" xmlns:context="http://www.springframework.org/schema/context" xmlns:oxm="http://www.springframework.org/schema/oxm" xmlns:aop="http://www.springframework.org/…
tagged with: maven
accepted answer: http://stackoverflow.com/a/22778113
type: Question
tagged with: spring-mvc
score: 1
tagged with: java
has comment: http://stackoverflow.com/comment/34731458
has answer: http://stackoverflow.com/a/22778113

http://stackoverflow.com/q/22802710
has answer: http://stackoverflow.com/a/22814902
upvote count: 2
score: 2
type: AnsweredQuestion
has title: Rally Java API to pull just Team members from Project
tagged with: project
tagged with: java
accepted answer: http://stackoverflow.com/a/22814902
type: Question
has body: I would like to write a Java API to retrieve just the team members for each project in Rally and push to db. Is there any query which could help me with this request? The project could be identified by naming convention, as our workspace has hierarchical based projects where only last tier of hierarchy holds the team members list. Please do mail me if you need further details Thanks Sree
tagged with: api
answer count: 1
downvote count: 0
favorite count: 0
tagged with: rally

http://stackoverflow.com/comment/34575948
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/22693266
type: Comment
has text: I would suggest that you read this blog - [link](http://blog.cloudera.com/blog/2011/04/hbase-dos-and-donts/) and see if HBase is a good fit in your usecase. The move from RDBMS to NoSQL totally depends on the use case. If you are worried about constrains and transaction management the stick with Oracle or any other RDBMS. NoSQL is best when you need flexibility in the data model structure, where each record may not have same set of attributes.

http://stackoverflow.com/a/22744119
downvote count: 0
has body: String s = "32; Potatoe; Vegetables; 21.30; 12.20; 15 21 32 45;"; String[] splittedWords; splittedWords = s.split(";"); You can use the method split to seperate words along delimiters. It will return a list of Strings. If you want to parse the values in the string to an Integer you can use this: for (String string : splittedWords) { if(string.matches("[^a-z \\.]+")==true) { int value = Integer.parseInt(string); System.out.println(value); } } the only integer in your samplestring is 32, though. Thats why this code will only output "32".
score: 1
type: Answer
has comment: http://stackoverflow.com/comment/34677345
answers question: http://stackoverflow.com/q/22744012
upvote count: 1
has comment: http://stackoverflow.com/comment/34713994
has comment: http://stackoverflow.com/comment/34673485

http://stackoverflow.com/comment/34727948
has text: Thank you! Is there a reason why we start from n-1 and keep going down? Could you also start with x[0] and keep going up until you get to the value of n?
type: AnswerComment
score: 0
type: Comment
comment on: http://stackoverflow.com/a/22777970

http://stackoverflow.com/comment/34649172
comment on: http://stackoverflow.com/q/22734112
has text: check to be 100% sure the file is being created.
type: Comment
type: QuestionComment
score: 0

http://stackoverflow.com/q/22799067
upvote count: 1
downvote count: 1
type: Question
accepted answer: http://stackoverflow.com/a/22799271
tagged with: arrays
answer count: 6
tagged with: int
score: 0
has body: I have a String array that contains {127,a,0,10}. I want to grab the numbers in that array and place them into an int array that will now contain {127,0,10}. I tried to use parseInt on each individual value in the String array but it does not worked on characters in a string. Thank you!
tagged with: parseint
tagged with: string
has answer: http://stackoverflow.com/a/22799095
favorite count: 0
possible better answer: http://stackoverflow.com/a/22799160
has answer: http://stackoverflow.com/a/22799160
has answer: http://stackoverflow.com/a/22799271
has answer: http://stackoverflow.com/a/22799126
has title: How do I grab the numbers in a String array and place them into an int array
has answer: http://stackoverflow.com/a/22799237
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/22799176
tagged with: java
linked to: http://stackoverflow.com/q/5439529

http://stackoverflow.com/comment/35245749
has text: I was referring to the comment from DB5 on my original question which provided the obvious solution.
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/22665427
type: Comment

http://stackoverflow.com/q/22746318
has title: manipulating time in java swing
tagged with: timer
has comment: http://stackoverflow.com/comment/34673993
has body: I was trying to manipulate an amateur animation using Swing in Java. The goal was to start an animation if I hover over a certain button. That was easy. But the problem is, I want to manipulate the speed of the timer of the animation according to the coordinates of the button. For example, the more right I go on the button the more speedy the animation gets (delay time decreases) and vice-versa. The code I wrote works if I move the arrow out of the button then enter again. Then the delay changes according to co-ordinates. But not if I move the arrow within the region of the button. I used mouseEntered here. That may cause cause the problem. But the mouseMove function seems not to work too. Here's my code: private void jButton1MouseEntered(java.awt.event.MouseEvent evt) { // TODO add your handling code here: PointerInfo inf = MouseInfo.getPointerInfo(); Point a = inf.getLocation(); double x = a.getX(); final int n = (int) (x - 161); //String str=""+x; //Output.setText(str); ActionListener taskPerformer = null; taskPerformer = new ActionListener() { @Override public void actionPerformed(ActionEvent evt) { //...Perform a task... //if(t&gt;0)timer.setDelay(1000); if (t &gt; 0) { timer.setDelay(500 + 50 * n); } if (label1 == 0) { jTextField1.setText(" A"); } else if (label1 == 1) { jTextField1.setText(" B"); } else if (label1 == 2) { jTextField1.setText(" C"); } else if (label1 == 3) { jTextField1.setText(" D"); } else if (label1 == 4) { jTextField1.setText(" E"); } else if (label1 == 5) { jTextField1.setText(" F"); } else if (label1 == 6) { jTextField1.setText(" G"); } if (label1 &gt;= 7) { label1 = 0; } else { label1++; } t++; //System.out.printf("Reading SMTP Info. %d\n",x); //System.out.printf("Reading SMTP Info. %d\n",label1t); //jLabel3.setText("fsd"); } private Object getContentPane() { throw new UnsupportedOperationException("Not supported yet."); } }; timer = new Timer(500, taskPerformer); timer.start(); //timer.setRepeats(false); try { Thread.sleep(10); } catch…
tagged with: swing
tagged with: jbutton
type: AnsweredQuestion
tagged with: java
type: Question
answer count: 1
has answer: http://stackoverflow.com/a/22750745
score: 0
accepted answer: http://stackoverflow.com/a/22750745
linked to: http://stackoverflow.com/q/7201509

http://stackoverflow.com/a/22720803
has body: I would use Hashmap &lt;String, List&lt;Object&gt;&gt; dataMap; So that you get a list of objects when you use the statement dataMap.get("DATA ID1"); You can go through the List items to find out the type and process the data accordingly.
has comment: http://stackoverflow.com/comment/34625591
has comment: http://stackoverflow.com/comment/34625681
answers question: http://stackoverflow.com/q/22720725
has comment: http://stackoverflow.com/comment/34626914
downvote count: 0
type: Answer
has comment: http://stackoverflow.com/comment/34635109
score: 1
upvote count: 1

http://stackoverflow.com/q/22651308
has body: So here I have a piece of code that takes a string named key ("ALICE") and passes it into the method keyReader() to get the position of the alphabet of each index - to clarify A would be 1, L would be 12, I would be 9, C would be 3, and E would be 5. These numbers are stored into an array named keyArray[]. My problem is now using keyArray[] with these 5 elements that are stored in it and passing it into the method keyNumber() as a parameter in order change each number to base 27 and add it to a total which is keyNo in this case. Any help and or suggestions are appreciated. public class Problem2 { public static void main(String[] args) { String key = "ALICE"; //VARIABLE - Will be read from text file String cipherThis = "JLMRSULTQTXLRCQQEBCHQFWWE"; //VARIABLE - Will be read from text file int noKey = 0; int[] keyArray = new int[5]; keyReader(key, keyArray); //reads the key keyNumber(noKey, keyArray); //evaluates the keyNumber of keyReader } //Method for reading each letter of the key private static void keyReader(String key, int[] keyArray) { for (int x = 0; x &lt; 5; x++) { keyArray[x] = key.charAt(x) - 64; } } //Method for evaluating the key number private static void keyNumber(int noKey, int[] keyArray) { int i = 0; //Counter for the numbers of the letters stored into the array using the keyReader() method int k = 4; //Counter for the 5 letters of the key (4,3,2,1,0) while (i &lt; 5) { while (k &gt;= 0) { noKey += Math.pow(27, k) * keyArray[i]; k--; i++; } } } }
score: 0
answer count: 3
linked to: http://stackoverflow.com/q/12757841
has comment: http://stackoverflow.com/comment/34500840
has title: Need help passing an array with elements already stored into it as a parameter for a method (JAVA)
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/22651332
tagged with: parameter-passing
has answer: http://stackoverflow.com/a/22651473
tagged with: java
has comment: http://stackoverflow.com/comment/34500853
tagged with: methods
type: Question
has answer: http://stackoverflow.com/a/22651391
has comment: http://stackoverflow.com/comment/34500826
tagged with: arrays

http://stackoverflow.com/q/22745386
score: -1
has comment: http://stackoverflow.com/comment/34669002
upvote count: 0
answer count: 1
accepted answer: http://stackoverflow.com/a/22745647
has comment: http://stackoverflow.com/comment/34669069
favorite count: 0
has comment: http://stackoverflow.com/comment/34669106
type: AnsweredQuestion
tagged with: java
has body: for (int i = 1; i &lt; text.length; i++) { JOptionPane.showMessageDialog(frame, text[i]); } I was wondering if I could create a string out of the array "text" after the "text[1]"(the second index) If I can, how would I do it? In this specific program I'm writing when the user types "say some text" I want a popup to appear saying "some text" but text.toString(); Didn't work at all and it doesn't allow me to set a starting point. Any help is apreciated! EDIT: I posted all the code on pastebin here.
downvote count: 1
type: Question
has answer: http://stackoverflow.com/a/22745647
has comment: http://stackoverflow.com/comment/34669152
has title: Create string of specific indexes of array in java?
has comment: http://stackoverflow.com/comment/34669469

http://stackoverflow.com/comment/34536573
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/22666439
has text: Yup, you're right. I was using it in Activity. I'm such a dumbass :) if you could post your comment as answer, I'll mark it correct.
score: 0

http://stackoverflow.com/comment/34728872
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/22776968
has text: Solitirios deserves the credit for the answer for pointing out the actual issue and guiding Dileep to the root cause.
score: 0

http://stackoverflow.com/q/22676743
tagged with: java
has comment: http://stackoverflow.com/comment/34545929
has answer: http://stackoverflow.com/a/22677594
type: Question
has comment: http://stackoverflow.com/comment/34545807
has body: I have a custom class "Something" which holds some ints and strings. I'm making a page to allow the user to see each current Something's description, and a button to edit or delete next to each one. I have overridden toString() in the Something class, so that it can return a description to be put into the TextView field. list_task_edit.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="wrap_content" android:paddingBottom="@dimen/activity_vertical_margin" android:paddingLeft="@dimen/activity_horizontal_margin" android:paddingRight="@dimen/activity_horizontal_margin" android:paddingTop="@dimen/activity_vertical_margin" android:orientation="vertical" tools:context=".EditTaskList"&gt; ... &lt;ListView android:id="@+id/edit_task_listview" android:layout_width="match_parent" android:layout_height="match_parent"&gt; &lt;/ListView&gt; ... &lt;/LinearLayout&gt; edit_task_list_item.xml &lt;LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent" android:layout_height="match_parent" android:orientation="horizontal" &gt; &lt;TextView android:id="@+id/edit_task_name" android:layout_weight="1" android:layout_width="0dp" android:layout_height="wrap_content" /&gt; &lt;Button android:id="@+id/edit_task_edit" android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="@string/button_edittask" android:onClick="" /&gt; &lt;Button android:id="@+id/edit_task_delete" android:layout_width="wrap_content" android:text="@string/button_delete_task" android:layout_height="wrap_content" android:onClick="deleteTask" /&gt; &lt;/LinearLayout&gt; (I haven't put a method for editTask yet, as I'm not up to there) public class EditTaskList extends Activity { private static ArrayList&lt;Something&gt; list; ArrayAdapter&lt;Something&gt; arrayAdapter; @Override protected void onCreate(Bundle sav…
accepted answer: http://stackoverflow.com/a/22677594
has answer: http://stackoverflow.com/a/23418269
tagged with: listview
has comment: http://stackoverflow.com/comment/34547189
score: 0
answer count: 2
has comment: http://stackoverflow.com/comment/34547210
possible better answer: http://stackoverflow.com/a/23418269
tagged with: adapter
has comment: http://stackoverflow.com/comment/34546261
tagged with: android
linked to: http://stackoverflow.com/q/13412341
has comment: http://stackoverflow.com/comment/34546091
type: AnsweredQuestion
has title: View.gettag returning null, what have I missed in ListView/ArrayAdapter setup?

http://stackoverflow.com/comment/34617312
type: Comment
score: 0
comment on: http://stackoverflow.com/q/22716293
has text: I think especially of interest is what value your `contentCounter` variable is at
type: QuestionComment

http://stackoverflow.com/comment/53096842
score: 1
type: AnswerComment
has text: Thanks man, exactly my problem was about a file having the same name as the directory I wanted to create! these lines helped me : listnames.delete(); listnames.mkdirs();
type: Comment
comment on: http://stackoverflow.com/a/22676917

http://stackoverflow.com/comment/34652134
type: AnswerComment
score: 0
type: Comment
comment on: http://stackoverflow.com/a/22734696
has text: Thanks a bunch Mr Shai. The infinite scrolling approach is a nice idea here. Limiting the server response will solve the long network delay and reduce server response time( thus increasing the real time feel). But what of the out of memory issue, because am expecting the list to grow up to 1000 elements. May be i should delete the oldest responses, n re-fetch them whenever the user gets closer, but this will increase the size of server downloads( because of the audios, photos and future planned videos). What do you think of this? Should i used some sort of local storage or what?

http://stackoverflow.com/comment/88084323
score: 2
has text: This is awesome, please keep it up
comment on: http://stackoverflow.com/a/48983463
type: AnswerComment
type: Comment

http://stackoverflow.com/comment/34691408
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/22756486
has text: If you're looking for a complete mail system, I'm afraid Grails can't help you, since it is web application framework. Complete mail system has to contain SMTP mail servers, POP3/IMAP servers etc. Best option you have IMHO is to use one of already existing systems you are referring to - Gmail, Hotmail or other.
score: 0

http://stackoverflow.com/q/22759428
type: AnsweredQuestion
favorite count: 0
has answer: http://stackoverflow.com/a/22759499
type: Question
downvote count: 2
score: -2
answer count: 1
accepted answer: http://stackoverflow.com/a/22759499
has title: Array with Strings as index
tagged with: java
tagged with: hashmap
upvote count: 0
tagged with: arrays
has body: I am supposed to store and keep track of a lots of counters (multiple counters for each meter, there are multiple meters spitting readings). Is it OK to use one HashMap for each type of counter, so that the key becomes the meter id and value becomes the counter. In this case I will have as many HashMaps as type of counters. Or shall I use something like a HashMap of a HashMap. And is there any way I can simply use Arrays for such a use case. For that I would need to replace/map Array index to meterid. Not sure if that is possible at all, but it will be much efficient if I am not wrong as HashMap uses Array itself so Array got to be faster.

http://stackoverflow.com/comment/34738470
comment on: http://stackoverflow.com/q/22783879
type: Comment
type: QuestionComment
has text: please help me my project deploy well jsp page run i enter user name password but when submit then such error occur thanx.
score: 0

http://stackoverflow.com/q/22663380
has answer: http://stackoverflow.com/a/22664361
tagged with: android
type: AnsweredQuestion
tagged with: scene2d
tagged with: java
type: Question
tagged with: libgdx
has body: i am currently going through some tutorials on android development and libgdx/scene2d atm but got stuck on the touchevents: For starters i am implementing a board game. By now i managed to draw the board and some meeples (player tokens) as well as adjust their position to the correct coordinates. When i started using libgdx i also successfully implemented a first test to see if the touchinput is working. The test looked something like this: if(Gdx.input.isTouched()){ touchPos.set(Gdx.input.getX(), Gdx.input.getY(), 0); camera.unproject(touchPos); stone.x=touchPos.x - stone.width/2; stone.y=touchPos.y - stone.height/2; By now i rearranged my code to use scene2d because of some very convenient features. However it seems like i can't manage to get touchevents to work with scene2d despite i followed some rather simple tutorials. Since some of them reference some recent major changes to scene2d, i wondered if those tutorials might be outdated and hope you guys can help me fix my problem :) I will try and only paste the relevant parts of my code in here to present a minimal example of my non-working code. Of course i am also glad about any hints on how to "improve" my code in general since i am still learning and probably break some conventions here ^^ Lets start with my actor-class: //deleted: imports public class Player extends Actor{ private int xval; //x Position of the Player on the board private int yval; //y Position of the Player on the board private Color color; private TextureRegion playerTexture; //deleted: some variables that are unimportant for touchevents public Player(int x, int y, TextureRegion texture){ //initializing some Variables with default values this.xval = x; this.yval = y; color = new Color(1,1,1,1); playerTexture = texture; this.setTouchable(Touchable.enabled); //this should be set by default, but i added it just to be sure. //setBounds seems to be necessary in addition to the "touchable" flag to be able to "grab" or "touch" Actors. //getX and g…
has title: Touchevents using libgdx and scene2d
score: 0
accepted answer: http://stackoverflow.com/a/22664361
answer count: 1

http://stackoverflow.com/q/22740745
accepted answer: http://stackoverflow.com/a/22742220
tagged with: eclipse
tagged with: jpa
answer count: 1
score: 0
has answer: http://stackoverflow.com/a/22742220
type: AnsweredQuestion
has body: How to manage the composite primary key in the following situation. I have two classes Employee and Overtime with OnetoMany Relationship. package com.gorakh.model; import javax.persistence.Entity; import javax.persistence.GeneratedValue; import javax.persistence.GenerationType; import javax.persistence.Id; import javax.persistence.JoinColumn; import javax.persistence.ManyToOne; @Entity public class Employee { @Id @GeneratedValue(strategy = GenerationType.IDENTITY) int empId; String first_name; String last_name; String phone; String start_date; String street_name; String region_name; String country_name; double salary; @ManyToOne @JoinColumn(name="dept_id",referencedColumnName="dept_id") Department dept_id; @ManyToOne @JoinColumn(name="type_id",referencedColumnName="type_id") Type type; public int getEmpId() { return empId; } public void setEmpId(int empId) { this.empId = empId; } public String getFirst_name() { return first_name; } public void setFirst_name(String first_name) { this.first_name = first_name; } public String getLast_name() { return last_name; } public void setLast_name(String last_name) { this.last_name = last_name; } public String getPhone() { return phone; } public void setPhone(String phone) { this.phone = phone; } public String getStart_date() { return start_date; } public void setStart_date(String start_date) { this.start_date = start_date; } public String getStreet_name() { return street_name; } public void setStreet_name(String street_name) { this.street_name = street_name; } public String getRegion_name() { return region_name; } public void setRegion_name(String region_name) { this.region_name = region_name; } public String getCountry_name() { return country_name; } public void setCountry_name(String country_name) { this.country_name = country_name; } public double getSalary() { return salary; } public void setSalary(double salary) { this.salary = salary; } public Department getDept_id() { return dept_id; } public void setDept_id(Department de…
tagged with: spring
type: Question
has title: Composite Primary Key in @ManytoOne in JPA with Linked Class
tagged with: java

http://stackoverflow.com/comment/34707242
comment on: http://stackoverflow.com/q/22766272
score: 1
has text: 1st april is tomorrow:)
type: QuestionComment
type: Comment

http://stackoverflow.com/q/22697071
score: 0
tagged with: java
accepted answer: http://stackoverflow.com/a/22770909
type: Question
has comment: http://stackoverflow.com/comment/34649670
has title: Oracle ATG Scheduler: Month oddity
linked to: http://stackoverflow.com/q/344380
tagged with: atg
answer count: 1
tagged with: atg-dynamo
has body: The basic usage for the ATG scheduler(added as a property in your ATG properties file): schedule=calendar mos dates wkdays mo-occurs hrs mins The docs for this are here. The description for the month(mos) is extremely baffling to me: Parameter | Values | Description mos | 0..11 | The months when the task occurs, where 0 represents December. Is there any valid reason for this bizarre break from normal month representation, ie 1-12? I am at a loss to understand why they did this. It doesn't even line up with the way java.util.Calendar behaves: Link Is there some logical explanation as to why they did this?
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/22770909

tablemodel
type: Tag
tag name: tablemodel
tags question: http://stackoverflow.com/q/22680424

http://stackoverflow.com/q/22701969
tagged with: opencv
score: 0
answer count: 2
has answer: http://stackoverflow.com/a/22703221
has answer: http://stackoverflow.com/a/22876308
has body: I have downloaded the Google Mirror Java Quick Start example from here: https://github.com/googleglass/mirror-quickstart-java And I have followed the instructions here: https://developers.google.com/glass/develop/mirror/quickstart/java I have successfully been able to upload the quick start example to one of my projects in Google App Engine. This has taken me a lot of time and effort to figure out. I am wondering if there is any way to use OpenCV in any of its forms (including JavaCV) with this quickstart example. In other words, is it possible to run OpenCV in any of its forms on Google App Engine? My goal is to send an image to App Engine through the Mirror API and return an image processed by OpenCV as a result.
tagged with: google-glass
tagged with: google-app-engine
possible better answer: http://stackoverflow.com/a/22876308
has title: Google Mirror API
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/22703221
tagged with: java
type: Question

http://stackoverflow.com/a/22715663
has body: You are using input.readLine() two times.So take it by storing in the string temp variable. String temp=input.readLine(); if(Integer.parseInt(temp)&gt;10) //or whatever you want { //put your code here }
type: Answer
answers question: http://stackoverflow.com/q/22715457
score: 0

http://stackoverflow.com/q/22796223
answer count: 2
tagged with: user-interface
has comment: http://stackoverflow.com/comment/34760977
has answer: http://stackoverflow.com/a/22796546
has title: Checkbox group error
has body: The method add(JCheckBox) is undefined for the type CheckboxGroup Any ideas fellows? private CheckboxGroup group2; group2 = new CheckboxGroup(); group2.add(firstbox); group2.add(secBox); group2.add(thirdbox); edit,asked to add more code. firstbox = new JCheckBox("checkbox"); // Setting Label JPanel panel = new JPanel(); panel.add(new JLabel("|")); panel.add(firstbox); panel.add(RadButton1); panel.add(RadButton2); panel.add(RadButton3); group = new ButtonGroup(); group.add(RadButton1); group.add(RadButton2); group.add(RadButton3); add(panel);
possible better answer: http://stackoverflow.com/a/22796478
has answer: http://stackoverflow.com/a/22796478
type: AnsweredQuestion
score: 0
tagged with: java
accepted answer: http://stackoverflow.com/a/22796546
type: Question

http://stackoverflow.com/a/24765278
type: Answer
has comment: http://stackoverflow.com/comment/92269510
upvote count: 3
has comment: http://stackoverflow.com/comment/92291647
has comment: http://stackoverflow.com/comment/39834352
score: 3
has comment: http://stackoverflow.com/comment/92335294
answers question: http://stackoverflow.com/q/22766988
accepted answer of: http://stackoverflow.com/q/22766988
has body: You may use Redisson based on Redis server. It implements familiar Java data structures including java.util.Lock with distributed and scalable abilities. Including ability to setup lock release timeout. Usage example: Config config = new Config(); // for single server config.useSingleServer() .setAddress("127.0.0.1:6379"); // or // for master/slave servers config.useSentinelConnection() .setMasterName("mymaster") .addSentinelAddress("127.0.0.1:26389", "127.0.0.1:26379"); Redisson redisson = Redisson.create(config); Lock lock = redisson.getLock("anyLock"); try { // unlock automatically after 10 seconds of hold lock.lock(10, TimeUnit.SECONDS); } finally { lock.unlock(); } ... redisson.shutdown();
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/92269370

regex
tags question: http://stackoverflow.com/q/22755023
tags question: http://stackoverflow.com/q/22760517
tags question: http://stackoverflow.com/q/22745081
tags question: http://stackoverflow.com/q/22734490
tags question: http://stackoverflow.com/q/22696821
tags question: http://stackoverflow.com/q/22735957
tags question: http://stackoverflow.com/q/22740753
tags question: http://stackoverflow.com/q/22672755
tags question: http://stackoverflow.com/q/22655754
tag name: regex
tags question: http://stackoverflow.com/q/22706979
tags question: http://stackoverflow.com/q/22684339
tags question: http://stackoverflow.com/q/22783064
tags question: http://stackoverflow.com/q/22657842
tags question: http://stackoverflow.com/q/22772664
tags question: http://stackoverflow.com/q/22751564
tags question: http://stackoverflow.com/q/22676883
tags question: http://stackoverflow.com/q/22655351
tags question: http://stackoverflow.com/q/22703290
tags question: http://stackoverflow.com/q/22721249
tags question: http://stackoverflow.com/q/22725615
tags question: http://stackoverflow.com/q/22702173
tags question: http://stackoverflow.com/q/22665956
tags question: http://stackoverflow.com/q/22677768
tags question: http://stackoverflow.com/q/22688284
tags question: http://stackoverflow.com/q/22786872
tags question: http://stackoverflow.com/q/22726243
tags question: http://stackoverflow.com/q/22669882
tags question: http://stackoverflow.com/q/22764232
tags question: http://stackoverflow.com/q/22717642
tags question: http://stackoverflow.com/q/22738968
tags question: http://stackoverflow.com/q/22790139
tags question: http://stackoverflow.com/q/22759983
tags question: http://stackoverflow.com/q/22675381
tags question: http://stackoverflow.com/q/22687590
tags question: http://stackoverflow.com/q/22669034
tags question: http://stackoverflow.com/q/22752394
tags question: http://stackoverflow.com/q/22722028
tags question: http://stackoverflow.com/q/22710976
tags question: http://stackoverflow.com/q/22718859
tags question: http://stackoverflow.com/q/22736350
tags question: http://stackoverflow.com/q/22675330
tags question: http://stackoverflow.com/q/22701236
tags question: http://stackoverflow.com/q/22777954
tags question: http://stackoverflow.com/q/22706068
tags question: http://stackoverflow.com/q/22769443
tags question: http://stackoverflow.com/q/22783173
tags question: http://stackoverflow.com/q/22731120
tags question: http://stackoverflow.com/q/22778732
tags question: http://stackoverflow.com/q/22738935
tags question: http://stackoverflow.com/q/22701953
tags question: http://stackoverflow.com/q/22740376
tags question: http://stackoverflow.com/q/22765326
tags question: http://stackoverflow.com/q/22718744
tags question: http://stackoverflow.com/q/22742890
tags question: http://stackoverflow.com/q/22743815
tags question: http://stackoverflow.com/q/22793989
tags question: http://stackoverflow.com/q/22799007
tags question: http://stackoverflow.com/q/22652881
tags question: http://stackoverflow.com/q/22764310
tags question: http://stackoverflow.com/q/22703415
tags question: http://stackoverflow.com/q/22653916
tags question: http://stackoverflow.com/q/22730661
tags question: http://stackoverflow.com/q/22673705
tags question: http://stackoverflow.com/q/22706042
tags question: http://stackoverflow.com/q/22795237
tags question: http://stackoverflow.com/q/22712745
tags question: http://stackoverflow.com/q/22792025
tags question: http://stackoverflow.com/q/22706439
type: Tag
tags question: http://stackoverflow.com/q/22719773
tags question: http://stackoverflow.com/q/22735515
tags question: http://stackoverflow.com/q/22652858
tags question: http://stackoverflow.com/q/22753979

http://stackoverflow.com/comment/34509350
has text: i want to retrieve every word page content in seperate String Object.
comment on: http://stackoverflow.com/q/22655754
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/q/22690163
has comment: http://stackoverflow.com/comment/34569310
tagged with: jsp
has comment: http://stackoverflow.com/comment/34573528
has comment: http://stackoverflow.com/comment/34569881
has title: Why is an image input sending a bad request when a submit input doesn't?
score: 0
has comment: http://stackoverflow.com/comment/34571356
accepted answer: http://stackoverflow.com/a/22692561
answer count: 1
has comment: http://stackoverflow.com/comment/34571693
has body: I have a JSP with a Spring form tag () on it within a Spring MVC application. I have an input that is type image and I am trying to submit the form to the controller. The form in JSP: &lt;form:form action="/spae/welcome" modelAttribute="action" method="post"&gt; &lt;form:input type="image" src="/spae/resources/images/img.png" path="id" name="userAction" value="expand_2" style="width:20px;height:20px;" onclick="increaseJSCounter('1');"/&gt; &lt;/form:form&gt; However, when I click this input to submit the form, I get an Error 400 bad request, but when I change the input type to "submit" it successfully submits and the application runs correctly. Does anyone no how to get this image input/submit to work properly? To help I am adding the code for the controller method below: @RequestMapping(value="/welcome", method = RequestMethod.POST) public String updateService(@RequestParam("userAction") String userAction, @ModelAttribute("action") UserInteraction action, ModelMap model) { /** set User authority and name here **/ if(userAction.equals("Search")){ System.out.println(action.getSearchField()); System.out.println(action.getSearchInput()); /** call service parameter update for search here **/ }else if(userAction.equals("Update")){ for(int i=0;i&lt;action.getRetroUpdates().length;i++){ System.out.println(action.getRetroUpdates()); } System.out.println(action.getUpdateStatus()); /** call service parameter update for UPdating retros here **/ }else if(userAction.substring(0, 6).equals("expand")){ spaeUser.setRetroDetailid(Integer.parseInt(userAction.substring(7))); }else{ /** for admin/retro r **/ } model.addAttribute("retroView",getRetroView.getData()); model.addAttribute("action", new UserInteraction()); return "welcome"; } And the model attributes class: public class UserInteraction { private String id; /*other variables not relevent to this issue */ public String getId(){ return this.id; } public void setId(String id){ this.id = id; } /*other appropriate getters and sett…
has answer: http://stackoverflow.com/a/22692561
tagged with: spring
has comment: http://stackoverflow.com/comment/34569638
tagged with: spring-mvc
has comment: http://stackoverflow.com/comment/34570500
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/34569263
has comment: http://stackoverflow.com/comment/34569592
has comment: http://stackoverflow.com/comment/34570653
tagged with: java
tagged with: forms
has comment: http://stackoverflow.com/comment/34569969
type: Question

http://stackoverflow.com/comment/34650427
type: AnswerComment
has text: doesnt work, splits at any whitespace then meaning each word is then treated as a sentence
score: 0
type: Comment
comment on: http://stackoverflow.com/a/22734766

http://stackoverflow.com/q/22690966
answer count: 1
tagged with: java
tagged with: eclipse
linked to: http://stackoverflow.com/q/20828050
accepted answer: http://stackoverflow.com/a/22691169
has body: I have this edittext: &lt;EditText android:id="@+id/editTextNew" android:layout_width="fill_parent" android:layout_height="fill_parent" android:layout_marginBottom="50dp" android:layout_alignParentLeft="true" android:layout_alignParentTop="true" android:layout_marginTop="50dp" android:padding="25dp" android:maxLength="200" android:gravity="top|left" android:background="#fff" android:lineSpacingMultiplier="1.5" android:inputType="textMultiLine|textCapSentences" &gt; &lt;/EditText&gt; It has a max of 200 characters, how can i make it so that when the last character has been typed, the screen fades out and a "next button" appears?
type: AnsweredQuestion
tagged with: xml-layout
duplicate of: http://stackoverflow.com/q/20828050
type: Question
tagged with: android
tagged with: http://stackoverflow.com/tag/xml
has title: Android: New activity when maximum characters reached in EditText
has answer: http://stackoverflow.com/a/22691169
score: 0

http://stackoverflow.com/comment/34621546
type: Comment
comment on: http://stackoverflow.com/a/22708818
type: AnswerComment
has text: The camel-spring-2.0-M3.jar **is** in the WEB-INF/lib folder :(
score: 0

http://stackoverflow.com/a/22713070
has comment: http://stackoverflow.com/comment/34611201
accepted answer of: http://stackoverflow.com/q/22713069
downvote count: 0
answers question: http://stackoverflow.com/q/22713069
has comment: http://stackoverflow.com/comment/34610986
score: 12
has comment: http://stackoverflow.com/comment/34611171
has body: The number of array dimensions are limited to 255. The interesting thing is that there is no such limitation in Java programming language defined by JLS, but you can see in the JVM specification, that the array dimension is stored in 1 byte. However, you can hardly meet this limitation on your day-to-day development. :-)
type: AcceptedAnswer
upvote count: 12
type: Answer

http://stackoverflow.com/comment/34690369
score: 2
comment on: http://stackoverflow.com/q/22757105
has text: What is your question?
type: Comment
type: QuestionComment

http://stackoverflow.com/a/22806938
has comment: http://stackoverflow.com/comment/34781104
downvote count: 0
type: Answer
answers question: http://stackoverflow.com/q/22805909
upvote count: 2
has body: a bit odd but.. you can probably get all the runing threads through Set&lt;Thread&gt; threadSet = Thread.getAllStackTraces().keySet(); then filter it to identify the thread from the executor service. then do a .join() on each of those threads. as i said, a bit odd but it should fit your needs ...
score: 2

http://stackoverflow.com/comment/34634309
has text: It could be a Java 8 bug that hasn't been fixed yet.
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/22723313
score: 0

http://stackoverflow.com/q/22685363
type: Question
has comment: http://stackoverflow.com/comment/34563624
tagged with: arrays
accepted answer: http://stackoverflow.com/a/22685737
score: 0
has comment: http://stackoverflow.com/comment/34560372
answer count: 1
has title: Display of JLabel array is to slow
favorite count: 0
tagged with: jlabel
has comment: http://stackoverflow.com/comment/34560361
has comment: http://stackoverflow.com/comment/34561868
has comment: http://stackoverflow.com/comment/34563250
linked to: http://stackoverflow.com/q/21142686
upvote count: 1
tagged with: swing
has comment: http://stackoverflow.com/comment/34560895
has answer: http://stackoverflow.com/a/22685737
has comment: http://stackoverflow.com/comment/34560428
has comment: http://stackoverflow.com/comment/34560708
has comment: http://stackoverflow.com/comment/34560508
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/34563607
tagged with: java
has comment: http://stackoverflow.com/comment/34560559
has body: I'm currently developping a roguelike game, using Swing. I'm using an array of JLabel to display the tiles. When the user input a direction, I redraw the whole tab using the following method (I'm using simplified variable name here) : for (int i=0 ; i&lt;array.length ; i++){ for(int j=0 ; j&lt;array[i].length ; j++){ this.remove(array[i][j]); array[i][j] = new JLabel(new ImageIcon(TILEARRAY[i][j])); this.add(array[i][j]); this.validate(); } } But it's very heavy to deal with, about 0.5s to redraw the whole panel, and when I press the direction, it can't draw fast enough to have a real-time display (it actually does the loop, along the waiting time, and when the whole displacement has been done, draws). I'd like to know if there's a easier and faster way to achieve this, with a " smooth " feeling (let's say like in Stone Soup Dungeon Crawl (tiles version)), using Swing. Every suggestion on an efficient 2D library for Java is welcome too. I know there is Slick2D, but is there any good other library for this kind of games ? Thanks (sorry if my english is bad, I'm not a native speaker of English)
downvote count: 1

http://stackoverflow.com/comment/34649698
type: QuestionComment
has text: Are you sure you're executing `java WhileDemo` in the directory where the `WhileDemo.class` file is stored?
comment on: http://stackoverflow.com/q/22734404
score: 0
type: Comment

http://stackoverflow.com/q/22710936
score: 0
tagged with: java
accepted answer: http://stackoverflow.com/a/22711072
type: Question
tagged with: listview
has body: I add items to ArrayList and then add it to adapter. here is my adapter public class LazyAdapterInventory extends BaseAdapter { private Activity activity; private ArrayList&lt;HashMap&lt;String, String&gt;&gt; data; private LayoutInflater inflater=null; public LazyAdapterInventory(Activity a, ArrayList&lt;HashMap&lt;String, String&gt;&gt; d) { activity = a; data=d; inflater = (LayoutInflater)activity.getSystemService(Context.LAYOUT_INFLATER_SERVICE); imageLoader=new ImageLoader(activity.getApplicationContext()); } public int getCount() { return data.size(); } public void clearCache() { imageLoader.clearCache(); } public Object getItem(int position) { return data.get(position); } public long getItemId(int position) { return position; } public View getView(final int position, final View convertView, ViewGroup parent) { View vi=convertView; if(convertView==null) vi = inflater.inflate(R.layout.item_list_all, null); final TextView title = (TextView)vi.findViewById(R.id.title); // title HashMap&lt;String, String&gt; song = new HashMap&lt;String, String&gt;(); song = data.get(position); title.setText(convertFromUTF8(song.get("key_title"))); return vi; } } here is my MainActivity public class UserInfoActivity extends SherlockActivity { ArrayList&lt;HashMap&lt;String, String&gt;&gt; friendsList = new ArrayList&lt;HashMap&lt;String, String&gt;&gt;(); LazyAdapterInventory friendsadapter; private GridView friendslist; protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_user_info); friendsadapter=new LazyAdapterInventory(this, friendsList); friendslist=(GridView)findViewById(R.id.friends_list); friendslist.setAdapter(friendsadapter); GetInfoList().executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR); } } here is get class GetInfoList extends AsyncTask&lt;String, String, String&gt; { protected String doInBackground(String... args) { JSONObject json = jParser.makeHttpRequest(URL, "GET", param); JSONObject friendsli…
answer count: 1
has answer: http://stackoverflow.com/a/22711072
tagged with: android
type: AnsweredQuestion
has title: Why the gridview doesn't show any item? It showed only after Resume Activity

http://stackoverflow.com/comment/34709310
score: 0
type: Comment
has text: I am not trying to direct attention away from the real problem. It is really annoying having people I don't know changing something that I actually understand to something that I don't understand properly
type: QuestionComment
comment on: http://stackoverflow.com/q/22750648

http://stackoverflow.com/comment/34763669
score: 0
type: Comment
has text: In particular, when you wrote `new BigInteger(512*512*512, ...)`, you were trying to create a 134217728-bit prime number, which is certainly *not* what you want.
type: AnswerComment
comment on: http://stackoverflow.com/a/22797717

http://stackoverflow.com/q/22799106
accepted answer: http://stackoverflow.com/a/22799205
tagged with: java
has title: How to list methods that are not inherited?
type: Question
score: 0
has answer: http://stackoverflow.com/a/22799205
has body: I have the following two Java classes (Command and Player). I would like to be able to list from the Command class all the public methods from the Player class, without having to hard-code them. I tried several ways, including an interface, or the command pattern, but I am not fluent in Java and I did not manage to make them work. It seems to me that using Java's reflection API would be easier. However, when I use it to print the public methods from the Player class, I get extraneous methods, which I assume were inherited from the Object class. Is there a way to only include those methods I defined myself (i.e. those starting with "public method: public void Player.")? Thank you, LC Here is the output I get: public method: public void Player.search(Command) public method: public Room Player.getCurrentRoom() public method: public void Player.engage() public method: public void Player.trade(Command) public method: public void Player.goRoom(Command) public method: public void Player.takeItem(Command) public method: public void Player.dropItem(Command) public method: public void Player.lock(Command) public method: public void Player.unlock(Command) public method: public final void java.lang.Object.wait(long,int) throws java.lang.InterruptedException public method: public final native void java.lang.Object.wait(long) throws java.lang.InterruptedException public method: public final void java.lang.Object.wait() throws java.lang.InterruptedException public method: public boolean java.lang.Object.equals(java.lang.Object) public method: public java.lang.String java.lang.Object.toString() public method: public native int java.lang.Object.hashCode() public method: public final native java.lang.Class java.lang.Object.getClass() public method: public final native void java.lang.Object.notify() public method: public final native void java.lang.Object.notifyAll() Here is the Command class: import java.lang.reflect.Method; public class Command { // a constant array that holds all v…
answer count: 1
has comment: http://stackoverflow.com/comment/34766257
has comment: http://stackoverflow.com/comment/34766277
has comment: http://stackoverflow.com/comment/34766295
tagged with: reflection
type: AnsweredQuestion

http://stackoverflow.com/q/22706453
tagged with: android
accepted answer: http://stackoverflow.com/a/22706572
has body: I am working on a simple timer like: timer.schedule(new timerTask(), 100, 100); // Timer public class timerTask extends TimerTask { @Override public void run() { if (stop==false){ tcount=tcount+1; } } }; The result is a string e.g. 260 that means 260 second is spent So are there any way to convert it to 00:00:00 (performance is a concern as convert run frequentlly!) So is the approach 260/60/60 = hr etc... the most appropriate one? Thanks for helping
has title: Format time counter string e.g. 260 to 00:00:00 in android
type: AnsweredQuestion
tagged with: java
type: Question
has answer: http://stackoverflow.com/a/22706572
tagged with: date
score: 0
answer count: 1
tagged with: string
tagged with: time

blobstore
tags question: http://stackoverflow.com/q/22727041
type: Tag
tags question: http://stackoverflow.com/q/22750329
tag name: blobstore
tags question: http://stackoverflow.com/q/22707077

http://stackoverflow.com/a/28375778
score: 5
upvote count: 5
type: Answer
downvote count: 0
has body: You can delete multiple items from your DefaultListModel if you start deleting from the highest selected index to the lowest. Something like this: @Override public void actionPerformed(ActionEvent e) { switch(e.getActionCommand()){ case "Remove": { int index = this.list[0].getSelectedIndices().length - 1; while (this.list[0].getSelectedIndices().length != 0) { this.defaultListModel[0].removeElementAt(this.list[0].getSelectedIndices()[index--]); } } ...
answers question: http://stackoverflow.com/q/22743922

http://stackoverflow.com/comment/34723957
score: 0
type: Comment
has text: I'm thinking that the counts should work for some range not equal to a power of 2 (minus 1), so long as ONLY one number in the range is missing. And actually one could make the parity scheme work, by artificially cycling through the numbers from the end of the range to the next power of 2 (or otherwise figuring out the correct fudge factor).
comment on: http://stackoverflow.com/a/22774972
type: AnswerComment

http://stackoverflow.com/a/22797399
score: 1
downvote count: 0
type: Answer
has body: The default layout for JFrame is BorderLayout. Without specifying a region, each component you add is being placed into BorderLayout.CENTER. Since button3 was the last to be added, it replaced button2 (button2 replaced button1 when it was added). You could create a JPanel using FlowLayout, and add the three buttons there. Then add the JPanel to the JFrame.
upvote count: 1
answers question: http://stackoverflow.com/q/22796676

http://stackoverflow.com/comment/34757401
type: Comment
has text: @LouisWasserman , I agreed , but to cache the numbers between -128 to 127 , do we need to pay extra Objects each time when we change the values ?
comment on: http://stackoverflow.com/a/22793997
type: AnswerComment
score: 0

http://stackoverflow.com/a/22768699
has comment: http://stackoverflow.com/comment/34713752
downvote count: 0
has body: Well, it's hard to tell without seeing your whole program. But it looks to me like if (weather[j].charAt(j) == 1) { tally[j]++; } return tally; should be if (weather[i].charAt(j) == '1') { tally[j]++; } // omit the return tally, we don't want to do that until the end
type: AcceptedAnswer
answers question: http://stackoverflow.com/q/22768507
type: Answer
accepted answer of: http://stackoverflow.com/q/22768507
has comment: http://stackoverflow.com/comment/34711446
score: 3
upvote count: 3
has comment: http://stackoverflow.com/comment/34712850
has comment: http://stackoverflow.com/comment/34712899

http://stackoverflow.com/comment/34770135
comment on: http://stackoverflow.com/q/22775838
type: Comment
type: QuestionComment
score: 1
has text: When moving to Java7, there is a different jar for the SQL Server jdbc driver. This article, http://technet.microsoft.com/en-us/library/ms378422.aspx explains some of this. Sounds like your classpath still has the older, sqljdbc.jar on the path BEFORE the sqljdbc4.jar driver. This should work fairly easily. You might want to break it down to a very small test case just to prove it to yourself first.

http://stackoverflow.com/q/22712935
accepted answer: http://stackoverflow.com/a/22714320
answer count: 4
linked to: http://stackoverflow.com/q/4469717
type: AnsweredQuestion
favorite count: 0
possible better answer: http://stackoverflow.com/a/22713035
type: Question
has answer: http://stackoverflow.com/a/22713035
tagged with: android
has body: Still i am getting file name like below: B-13-4-006.jpg and B-5-7-008.jpg but now i want to show 0 as prefix if value less than &lt; 9 else as it is, in short want to show values in double figures, see my code below using to file name "B-" + // prefix LoginActivity.strEventID + "-" + // eventID LoginActivity.strOperativeID + "-" + // operativeID getNextNumber() + // counter ".jpg" but i require, files name should look like below: B-13-04-006.jpg and B-05-07-008.jpg
has title: show 0 as prefix if value is less than 9
has answer: http://stackoverflow.com/a/22714320
upvote count: 2
tagged with: java
has comment: http://stackoverflow.com/comment/34610750
has comment: http://stackoverflow.com/comment/34610765
downvote count: 5
has comment: http://stackoverflow.com/comment/34610834
score: -3
has answer: http://stackoverflow.com/a/22713061
has answer: http://stackoverflow.com/a/22713098

http://stackoverflow.com/q/22653130
has answer: http://stackoverflow.com/a/27637160
upvote count: 3
type: UnansweredQuestion
type: Question
has title: Interact with EBean Model classes in PlayFramework through h2-browser and console
tagged with: java
has body: Is it possible to interactively execute commands in the Play Console to change the Model of a Play application and see the changes in the in-memory database? I know that it is possible to browse the in-memory database through the h2-browser command in a Play application. The steps that I follow are: Start play console Execute h2-browser Execute run Go to http://localhost:9000 to refresh application and start Database Go to http://192.168.56.1:8082/ to connect to the Database I also know that it is possible to start the console and execute Scala commands. For example, if I have a model entity Person and I execute: &gt; play console ... scala&gt; import Models.Person scala&gt; val john = new Person("john") scala&gt; john.save() It raises an exception: avax.persistence.PersistenceException: The default EbeanServer has not been defined? This is normally set via the ebean.datasource.default property. Otherwise it should be registered programatically via registerServer() at com.avaje.ebean.Ebean$ServerManager.getPrimaryServer(Ebean.java:178) at com.avaje.ebean.Ebean$ServerManager.access$300(Ebean.java:128) at com.avaje.ebean.Ebean.save(Ebean.java:453) at play.db.ebean.Model.save(Model.java:91) ... I think the reason is that it is using a different Play application...is it possible to refer to the application that is running on the other window? Or to execute run on Play in the background and be able to open the console later?
tagged with: playframework
answer count: 1
downvote count: 0
favorite count: 0
score: 3
tagged with: ebean
tagged with: playframework-2.2
tagged with: playframework-2.0

http://stackoverflow.com/a/23374467
upvote count: 1
answers question: http://stackoverflow.com/q/22780964
downvote count: 0
type: Answer
score: 1
has body: What about using an xPath inside of a try-catch, passing the elementype, attribute and text as follows? try { driver.FindElement( By.XPath(string.Format("//{0}[contains(@{1}, '{2}')]", strElemType, strAttribute, strText))); return true; } catch (Exception) { return false; }

http://stackoverflow.com/a/22757458
has body: super.getForeground() is returning disabled color in the next call because once you set it to disabled color it will propagate to super class also as shown below: Here is code directly from JComponent public void setForeground(Color fg) { Color oldFg = getForeground(); super.setForeground(fg); if ((oldFg != null) ? !oldFg.equals(fg) : ((fg != null) &amp;&amp; !fg.equals(oldFg))) { // foreground already bound in AWT1.2 repaint(); } } No need to override getForeground() method just call setForeground() method form setEnabled() method. Store default foreground color somewhere before updating and use it in further calls. Can you try this one class MyPane extends JTextPane { private static final long serialVersionUID = 1L; private boolean m_enabled = true; private Color defaultForegroundColor, disabledTextColor; public MyPane() { defaultForegroundColor = getForeground(); disabledTextColor = getDisabledTextColor(); } public void setEnabled(boolean enabled) { m_enabled = enabled; if (m_enabled) { setForeground(defaultForegroundColor); } else { setForeground(disabledTextColor); } } @Override public boolean isEnabled() { return true; } }
type: Answer
upvote count: 1
score: 1
accepted answer of: http://stackoverflow.com/q/22755927
downvote count: 0
answers question: http://stackoverflow.com/q/22755927
type: AcceptedAnswer

http://stackoverflow.com/comment/34547501
comment on: http://stackoverflow.com/a/22675396
type: AnswerComment
score: 0
type: Comment
has text: From the API docs - This is a scaling factor for the Density Independent Pixel unit, following the same conventions as android.util.DisplayMetrics#density, where one DIP is one pixel on an approximately 160 dpi screen.

http://stackoverflow.com/q/22660033
has answer: http://stackoverflow.com/a/22660408
has comment: http://stackoverflow.com/comment/34515549
has comment: http://stackoverflow.com/comment/34515782
type: AnsweredQuestion
has title: ClassNotFoundException in java networking?
has comment: http://stackoverflow.com/comment/34515629
score: 0
tagged with: java
has body: I am writing a multi-threaded java chat application, I am getting a Class Not Found Exception when I send a MessageStructure object over the network to the server side. Server Side: @Override public void run() { while(true) { try { MessageStructure message=(MessageStructure)input.readObject(); ServerSocket.ProcessIncomingMessage(ThreadId, message); } catch (IOException ex) { Logger.getLogger(ChatServerThread.class.getName()).log(Level.SEVERE, null, ex); } catch (ClassNotFoundException ex) { Logger.getLogger(ChatServerThread.class.getName()).log(Level.SEVERE, null, ex); } } Client Side: public void SendMessage(MessageStructure message) { try { output.writeObject(message); output.flush(); } catch (IOException ex) { Logger.getLogger(ClientSideSocket.class.getName()).log(Level.SEVERE, null, ex); } } Stack Trace: java.lang.ClassNotFoundException: nu.connect.client.MessageStructure at java.net.URLClassLoader$1.run(URLClassLoader.java:366) at java.net.URLClassLoader$1.run(URLClassLoader.java:355) at java.security.AccessController.doPrivileged(Native Method) at java.net.URLClassLoader.findClass(URLClassLoader.java:354) at java.lang.ClassLoader.loadClass(ClassLoader.java:423) at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:308) at java.lang.ClassLoader.loadClass(ClassLoader.java:356) at java.lang.Class.forName0(Native Method) at java.lang.Class.forName(Class.java:266) at java.io.ObjectInputStream.resolveClass(ObjectInputStream.java:622) at java.io.ObjectInputStream.readNonProxyDesc(ObjectInputStream.java:1593) at java.io.ObjectInputStream.readClassDesc(ObjectInputStream.java:1514) at java.io.ObjectInputStream.readOrdinaryObject(ObjectInputStream.java:1750) at java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1347) at java.io.ObjectInputStream.readObject(ObjectInputStream.java:369) at nu.connect.server.ChatServerThread.run(ChatServerThread.java:56) public class MessageStructure implements Serializable{ public String MessageType; public String reciever; …
type: Question
tagged with: chat
tagged with: network-programming
has comment: http://stackoverflow.com/comment/34515820
accepted answer: http://stackoverflow.com/a/22660408
has comment: http://stackoverflow.com/comment/34515495
answer count: 1
has comment: http://stackoverflow.com/comment/34515879
has comment: http://stackoverflow.com/comment/34516021
tagged with: serialization
tagged with: exception

http://stackoverflow.com/q/22648384
favorite count: 0
upvote count: 11
type: AnsweredQuestion
has title: How to make an executable jar file using IntelliJ from a Selenium/TestNG java file?
tagged with: selenium
score: 11
type: Question
tagged with: java
accepted answer: http://stackoverflow.com/a/22673644
has body: I've been Googling for days trying to figure out how to do this, if anybody has done this before I would greatly appreciate the help. I have an automation test project I've created in IntelliJ that automates a user interacting with a Web Application. I'd like to put that automated test (created in Java, using Selenium and TestNG) into an executable jar file that others can run by double-clicking the jar file. Every time I attempt to create a jar file by navigating to Project Structure -> Artifact -> + -> Jar -> From modules with dependencies, it ends up creating a jar that claims it, "Could not find or load the main class <package.MainClass> " when I attempt to run it with the following command: java -jar MyProject.jar Any idea why I continually get this error, or have a way to do this successfully? Also, here is my pom.xml: TestAutomation TestAutomation 1.0-SNAPSHOT org.apache.maven.plugins maven-assembly-plugin true com.test.automation.Executable jar-with-dependencies org.seleniumhq.selenium selenium-server 2.39.0 org.seleniumhq.selenium selenium-java 2.40.0 junit junit 4.11 test org.testng testng 6.1.1 test
tagged with: intellij-idea
has answer: http://stackoverflow.com/a/22673644
answer count: 1
downvote count: 0
tagged with: executable-jar
tagged with: jar

http://stackoverflow.com/comment/34671454
has text: @WarrenDew I don't know what this has to do with my answer. Nor does the first side to do application I/O determine which is the SSL client. It is configured into the SSL socket which is the client and which the server. Your own answer appears comprehensive enough, although I haven't read it, that you don't need to polish the apple by adding information to mine, especially misinformation.
comment on: http://stackoverflow.com/a/22738533
type: AnswerComment
score: 0
type: Comment

http://stackoverflow.com/comment/34756182
has text: @spoderman69 replace word emulator with word device in my previous comment and read it again.
score: 0
type: Comment
comment on: http://stackoverflow.com/a/22792679
type: AnswerComment

http://stackoverflow.com/a/22671546
score: 0
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/22666373
answers question: http://stackoverflow.com/q/22666373
type: Answer
has comment: http://stackoverflow.com/comment/34638056
has body: Your code should work. But I think you can achieve the same by following way, xhtml: &lt;h:selectOneMenu id="listExample"&gt; &lt;f:selectItems value="#{myBean.ddl_example_options}"/&gt; &lt;/h:selectOneMenu&gt; JSF Managed Bean: public class MyBean implements Serializable{ List&lt;SelectItem&gt; ddl_example_options; String ddl_example; public List&lt;SelectItem&gt; getDdl_example_options() { return ddl_example_options; } public void setDdl_example_options(List&lt;SelectItem&gt; ddl_example_options) { this.ddl_example_options = ddl_example_options; } public String getDdl_example() { return ddl_example; } public void setDdl_example(String ddl_example) { this.ddl_example = ddl_example; } private void setDdl_example(){ ddl_example_options=new ArrayList&lt;&gt;(); ddl_example_options.add(new SelectItem("1","Option-1")); ddl_example_options.add(new SelectItem("2","Option-2")); } @PostConstruct public void init(){ setDdl_example(); } public MyBean() { } }
has comment: http://stackoverflow.com/comment/34641389

http://stackoverflow.com/q/22733474
tagged with: java
type: Question
tagged with: resources
tagged with: r.java-file
possible better answer: http://stackoverflow.com/a/22733596
has body: Yesterday I was working on my Android app and it was running fine. But today when i opened it, I am getting the error R cannot be resolved to a variable and i am not sure why this is happening. In the console i am getting this error [2014-03-29 11:04:59 - RockPaperScissors] C:\Users\hosfo_000\workspace2\RockPaperScissors\res\menu\main.xml:6: error: Error: No resource found that matches the given name (at 'title' with value '@string/action_settings'). Does anyone have any ideas what might be causing this? I already tried cleaning the project but that did not work. EDIT Line 6 of my main.XML is &lt;item So i added the rest of that item. My entire main.xml consists of this item. &lt;item android:id="@+id/action_settings" android:orderInCategory="100" android:title="@string/action_settings" app:showAsAction="never"/&gt;
score: 0
answer count: 2
accepted answer: http://stackoverflow.com/a/22733515
has answer: http://stackoverflow.com/a/22733596
tagged with: android
has title: Android development R cannot be resolved to a variable (no resource found error)
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/22733515
has comment: http://stackoverflow.com/comment/34648006

http://stackoverflow.com/q/22732530
linked to: http://stackoverflow.com/q/1585811
tagged with: tomcat
favorite count: 0
has answer: http://stackoverflow.com/a/22732607
has body: I am using Java/Eclipse to connect to MySQL database but encountering the following error. Error Message: Unable to connect to databasejava.lang.ClassNotFoundException: com.mysql.jdbc.Driver Code: &lt;% try { Class.forName("com.mysql.jdbc.Driver").newInstance(); Connection myCon = DriverManager.getConnection("jdbc:mysql://localhost/myDB", "root", "password"); if(! myCon.isClosed()) out.println("Successfully connected to " + "MySQL server!"); myCon.close(); }catch(Exception ex){ out.println("Unable to connect to database" + ex); } %&gt; I know that this question has already been asked here but still I am unable to sort this thing out. Environmental variables: JAVA_HOME: C:\Program Files\Java\jdk1.7.0_51 CLASSPATH: .%JAVA_HOME%\lib;C:\Program Files\MySQL\Connector J 5.1.29; How can I can solve this issue?
tagged with: jdbc
has answer: http://stackoverflow.com/a/22732627
answer count: 4
has comment: http://stackoverflow.com/comment/34646570
has comment: http://stackoverflow.com/comment/34666626
score: 2
type: AnsweredQuestion
possible better answer: http://stackoverflow.com/a/22732607
upvote count: 2
tagged with: java
linked to: http://stackoverflow.com/q/2353141
tagged with: mysql
type: Question
duplicate of: http://stackoverflow.com/q/2353141
has title: java.lang.ClassNotFoundException: com.mysql.jdbc.Driver.
accepted answer: http://stackoverflow.com/a/22732627
tagged with: eclipse
has answer: http://stackoverflow.com/a/22732596
downvote count: 0
has answer: http://stackoverflow.com/a/30476314

http://stackoverflow.com/q/22676910
tagged with: java
has answer: http://stackoverflow.com/a/22677243
has answer: http://stackoverflow.com/a/22677172
upvote count: 1
downvote count: 1
has comment: http://stackoverflow.com/comment/34546358
type: Question
has comment: http://stackoverflow.com/comment/34546237
linked to: http://stackoverflow.com/q/218384
has comment: http://stackoverflow.com/comment/34546027
score: 0
has comment: http://stackoverflow.com/comment/34546440
answer count: 2
has comment: http://stackoverflow.com/comment/34546069
has comment: http://stackoverflow.com/comment/34546491
favorite count: 0
has comment: http://stackoverflow.com/comment/34546448
has comment: http://stackoverflow.com/comment/34546086
has comment: http://stackoverflow.com/comment/34546250
type: UnansweredQuestion
has title: NullPointerException when accessing array elements
has comment: http://stackoverflow.com/comment/34546458
has body: I'm using BlueJ to create an array. The array is of 10 objects inherited from another class. Now, my problem is that every time I try to find an object within the array (using the findInventoryItem, I get a java.lang.NullPointerException: null error. Now the "inventoryItem" object comes from another class. I am using inventoryItems as the actual array name. the objects that go into it are the inventoryItem of class InventoryItem import java.util.ArrayList; import java.util.Iterator; import java.util.Random; /** * THIS IS THE MODIFIED VERSION OF THE ARRAY LIST MANAGER CLASS * * @author RAGEED A BASRAWI * @version VERSION 1 */ public class HomeInventoryManagerARRAYClass { private InventoryItem inventoryItem; private InventoryItem[] inventoryItems; /** * Initialise the home inventory manager. */ public HomeInventoryManagerARRAYClass() { InventoryItem inventoryItem; inventoryItems = new InventoryItem[10]; } /** * Add an inventory item to the list. * */ public void addInventoryItem(InventoryItem inventoryItem) { Random random = new Random(); inventoryItems[random.nextInt(9 - 0 + 1) + 0] = inventoryItem; } /** * Try to find an inventory item in the inventory list with the given partNumber. * */ public InventoryItem findInventoryItem(int partNumber) { for(int index = 0; index &lt; 9; index ++) { if (inventoryItem.getPartNumber() == partNumber) { return inventoryItem; } if (inventoryItem.getPartNumber() != partNumber) { System.out.println("The entry " + partNumber + " does not exist. Pleast try again."); } } return inventoryItem; } /** * Locate an inventory item with the given partNumber, and return how * many of this item are in inventory. If the partNumber does not * match any item, return zero. */ public int numberInInventory(int partNumber) { InventoryItem inventoryItems = findInventoryItem(partNumber); if(inventoryItems != null)//There aren't too many ways to write a statement to be NOT NULL. Its kind of annoying... -___- { return inventoryItems.getQuantity(); } else {…

http://stackoverflow.com/comment/34530334
comment on: http://stackoverflow.com/q/22667855
type: Comment
type: QuestionComment
has text: `Shape` is an `abstract` class, it doesn't have the functions defined in the extended classes like `Circle` etc. In case you want to use a specific method you need to cast the `shape` object e.g. for `Circle` you can use `((Circle) shape).getRadius();` and accordingly for other subclasses of `Shape`.
score: 0

http://stackoverflow.com/comment/34579610
has text: Ah…no. Parameters are one way in JSR-352. The way to share that type of information within the JSR is using the `JobContext`'s transientData (assuming that you don't need it persisted for restart). There isn't a way to store values within JSR-352 at a job level and make them available on restart (within Spring Batch, you can use the JobExecution's ExecutionContext for that functionality).
type: AnswerComment
comment on: http://stackoverflow.com/a/22690445
type: Comment
score: 1

http://stackoverflow.com/comment/34682453
comment on: http://stackoverflow.com/a/22723250
type: Comment
has text: 1-2. I am not exactly sure how to write the bit7 and bit2. Also the byte3 of AUTH0(what will i set in byte 0-2?). I try to write in page38 with nfc.transceive(new byte[]{ (byte)0xA2, 0x38, 0x00, 0x00 }); but i still have an error with TagLost. can you give example of these?. 3. Yes it fails reading from page3 and up. 4. I see. I also not mentioned I dont detect NDEF message whenever I scan the tag in NXP Tagreader I get No NFC data set storage in NDEF Tab and the memory size is 32pages with 4 bytes page (but i see 40 pages in docs).
score: 0
type: AnswerComment

http://stackoverflow.com/comment/34508860
has text: You should show a code example of how to use `Thread.currentThread().isInterrupted()`. Yes, you may not check for it. Also, there are daemon threads.
type: AnswerComment
score: 0
type: Comment
comment on: http://stackoverflow.com/a/22655822

http://stackoverflow.com/a/22668080
score: 4
accepted answer of: http://stackoverflow.com/q/22665198
has comment: http://stackoverflow.com/comment/34530703
answers question: http://stackoverflow.com/q/22665198
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/34559784
has body: No, tasks could definitely complete after you return from your shutdownAndAwaitTermination() method, because you don't actually await termination. If the waiting thread is interrupted, or if it takes too long, you stop waiting, even though tasks may still be running. Even if you call shutdownNow(), your tasks may not respond to interruption (and in general, ExecutorService isn't guaranteed to use interruption). So tasks may still be running. If you want to ensure task completion happens-before returning from this method, you have to keep trying until awaitTermination() returns true, in spite of interrupts, etc. That would be a bad design, so it would be better if your tasks returned their results via a Future instead of producing side-effects non-atomically. That way, tasks that complete successfully can be acted upon, while tasks that do not complete can be ignored.
type: Answer
upvote count: 4
downvote count: 0
has comment: http://stackoverflow.com/comment/34531055

http://stackoverflow.com/q/22681424
has title: What should the declaration of a helper class, with only static methods, be?
score: 4
has answer: http://stackoverflow.com/a/22681474
accepted answer: http://stackoverflow.com/a/22681474
upvote count: 4
possible better answer: http://stackoverflow.com/a/22681483
tagged with: helper
downvote count: 0
favorite count: 0
has body: I've got a class here, that only contains static methods, so I call it a helper class, an example: public class FileUtils { public static String readFileEntry(final Path path, final String entryKey) throws IOException { } public static String readAndModifyFileEntry(final Path path, final String entryKey, final UnaryOperator&lt;String&gt; operator) throws IOException { } } How should I declare the class (abstract, final, static, etc.), such that it is not possible to instantiate the class? As you are not supposed to do so. If that is not possible, then what is the best practice? I'm using Java 8 if that is of any extra help.
has answer: http://stackoverflow.com/a/22681494
tagged with: static
linked to: http://stackoverflow.com/q/10141159
has comment: http://stackoverflow.com/comment/34553941
answer count: 4
has answer: http://stackoverflow.com/a/22681484
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/34553837
has answer: http://stackoverflow.com/a/22681483
tagged with: java
type: Question
has comment: http://stackoverflow.com/comment/34553879
linked to: http://stackoverflow.com/q/1326230

http://stackoverflow.com/q/22719496
has comment: http://stackoverflow.com/comment/34623661
has answer: http://stackoverflow.com/a/26438270
accepted answer: http://stackoverflow.com/a/22720684
has title: File upload write path Glassfish 4
possible better answer: http://stackoverflow.com/a/26438270
tagged with: path
has comment: http://stackoverflow.com/comment/34623109
has comment: http://stackoverflow.com/comment/34623303
has comment: http://stackoverflow.com/comment/34623142
score: 0
tagged with: glassfish-4
tagged with: file
type: Question
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/22720684
tagged with: java
answer count: 2
has body: In order to get a file from HTML and copy it into a specific folder using Java and Glassfish 4. This is my jsp : <%@page contentType="text/html" pageEncoding="UTF-8"%> Register Register ! Username: E-mail: Password: Select File to Upload: <% String message = (String) request.getAttribute("erreur"); if(message != null) out.println( message ); %> This is my Servlet : @WebServlet(name = "RegisterServlet", urlPatterns = {"/Register"}) @MultipartConfig(fileSizeThreshold=1024*1024*10, // 10 MB maxFileSize=1024*1024*50, // 50 MB maxRequestSize=1024*1024*100 // 100 MB ) public class RegisterServlet extends HttpServlet { @EJB MyuserService MyuserService; private static final String SAVE_DIR = "uploads"; @Override protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException { req.getRequestDispatcher("/register.jsp").forward(req, resp); } @Override protected void doPost(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException { String username = req.getParameter("username"); String email = req.getParameter("mail"); String password = req.getParameter("password"); // Test des champs if(username == null || email == null || password == null){ String erreur = "Merci de remplir les champs pour charger le formulaire!"; req.setAttribute("erreur", erreur); doGet(req, resp); } else{ Myuser user = new Myuser(); user.setEmail(email); user.setPassword(password); user.setUserName(username); user.setCreationDate(new Timestamp(new java.util.Date().getTime())); user.setUserRole(Utils.__USERROLE_UTILISATEUR__); // gets absolute path of the web application String appPath = System.getProperty("user.dir"); // constructs path of the directory to save uploaded file String savePath = appPath + File.separator + SAVE_DIR; // creates the save directory if it does not exists File fileSaveDir = new File(savePath); if (!fileSaveDir.exists()) { fileSaveDir.mkdir(); } for (Part part : req.getParts()) { if (part.getName().equalsIgno…

http://stackoverflow.com/comment/46945889
comment on: http://stackoverflow.com/q/22769467
score: 0
type: Comment
type: QuestionComment
has text: Please refer http://stackoverflow.com/questions/28410215/spring-boot-rest-service-with-oauth2-security-credentials-from-database/29383551#29383551

http://stackoverflow.com/comment/34736985
comment on: http://stackoverflow.com/q/22782848
has text: @Duncan FYI class level variable is used in RestCLientUtil class is populated through property file in real time
type: Comment
type: QuestionComment
score: 0

http://stackoverflow.com/comment/34696628
type: Comment
type: QuestionComment
has text: @KazJaw Thanks, we already have an OfficeConverter programmed in C# using Word, Excel and Powerpoint interop for converting Office Documents to PDF and PNG. We use it via Webservice. Of course, it is possible that we use interop for resaving the document. But that's kind of solution we like to avoid, because it costs "much" processing time.
comment on: http://stackoverflow.com/q/22656578
score: 0

http://stackoverflow.com/comment/34625222
score: 0
type: Comment
comment on: http://stackoverflow.com/q/22720675
type: QuestionComment
has text: You can't use a placeholder in `PropertyPlaceholderConfigurer` config (spring needs `PropertyPlaceholderConfigurer` to handle `${xxx}` vars)

http://stackoverflow.com/a/22708179
type: Answer
has body: Following piece of code should help: int noOfRowsBeforeAJAXCall = driver.findElement(By.id("id-213")).findElements(By.tagName("tr")).size(); int noOfRowsAfterAJAXCall; driver.findElement(By.id("123")).click(); while(1) { noOfRowsAfterAJAXCall = driver.findElement(By.id("id-213")).findElements(By.tagName("tr")).size(); // Check whether row nos. increased if(noOfRowsAfterAJAXCall&gt;noOfRowsBeforeAJAXCall) break; // Re-check after 1 sec Thread.sleep(1000m); }
has comment: http://stackoverflow.com/comment/34602714
answers question: http://stackoverflow.com/q/22707284
score: 0

http://stackoverflow.com/q/22780304
has comment: http://stackoverflow.com/comment/34732467
has body: I am trying to update a small alpha version of a enterprise application originally written in Java6. Now I want to use: Java 7 JSF latest Maven EJB 3.2 with Glassfish So far I can deploy my EAR file on Glassfish without problems. My webapp can be loaded, the first JSF pages navigate fine. And my JSF backing bean seems to also load my Stateless session beans fine. Debugging showed me, I can get from one SSB to another coming from my backing bean. The last and final step that I am missing is my entity manager and persistence. My class is annoated with @Stateless and i am using: @PersistenceContext(unitName = "myProjectPU") protected EntityManager entityManager; But the entity manager is null :( My persistence.xml: <?xml version="1.0" encoding="UTF-8"?> jdbc/myProject <property name="javax.persistence.schema-generation.create-database-schemas" value="true" /> Any ideas? Does the persistence.xml have to be inside the ear maven module? Right now its in the ejb maven module, where my classes which use the entity manager reside.
tagged with: ejb-3.2
has comment: http://stackoverflow.com/comment/34732845
has title: EntityManager in SSB null
type: AnsweredQuestion
tagged with: java
type: Question
accepted answer: http://stackoverflow.com/a/23042763
score: 0
tagged with: nullpointerexception
has answer: http://stackoverflow.com/a/23042763
answer count: 1
tagged with: entitymanager

http://stackoverflow.com/q/22715836
has comment: http://stackoverflow.com/comment/34616272
linked to: http://stackoverflow.com/q/11238593
linked to: http://stackoverflow.com/q/11483647
has answer: http://stackoverflow.com/a/22715907
answer count: 2
score: 2
possible better answer: http://stackoverflow.com/a/22716017
type: AnsweredQuestion
has title: Unused methods in java.util.HashSet in JDK8
has comment: http://stackoverflow.com/comment/34616655
downvote count: 0
has answer: http://stackoverflow.com/a/22716017
favorite count: 0
has body: When looking at the implementation of java.util.HashSet&lt;E&gt;: You see that there are methods writeObject and readObject that are not being used at all, they are furthermore private, so they could neither be used by extending the class. Why are these methods in the implementation of Java 8, JDK 8? Code copied for clarity: /* * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved. * ORACLE PROPRIETARY/CONFIDENTIAL. Use is subject to license terms. * * * * * * * * * * * * * * * * * * * * */ package java.util; import java.io.InvalidObjectException; /** * This class implements the &lt;tt&gt;Set&lt;/tt&gt; interface, backed by a hash table * (actually a &lt;tt&gt;HashMap&lt;/tt&gt; instance). It makes no guarantees as to the * iteration order of the set; in particular, it does not guarantee that the * order will remain constant over time. This class permits the &lt;tt&gt;null&lt;/tt&gt; * element. * * &lt;p&gt;This class offers constant time performance for the basic operations * (&lt;tt&gt;add&lt;/tt&gt;, &lt;tt&gt;remove&lt;/tt&gt;, &lt;tt&gt;contains&lt;/tt&gt; and &lt;tt&gt;size&lt;/tt&gt;), * assuming the hash function disperses the elements properly among the * buckets. Iterating over this set requires time proportional to the sum of * the &lt;tt&gt;HashSet&lt;/tt&gt; instance's size (the number of elements) plus the * "capacity" of the backing &lt;tt&gt;HashMap&lt;/tt&gt; instance (the number of * buckets). Thus, it's very important not to set the initial capacity too * high (or the load factor too low) if iteration performance is important. * * &lt;p&gt;&lt;strong&gt;Note that this implementation is not synchronized.&lt;/strong&gt; * If multiple threads access a hash set concurrently, and at least one of * the threads modifies the set, it &lt;i&gt;must&lt;/i&gt; be synchronized externally. * This is typically accomplished by synchronizing on some object that * naturally encapsulates the set. * * If no such object exists, the set should b…
type: Question
duplicate of: http://stackoverflow.com/q/11238593
accepted answer: http://stackoverflow.com/a/22715907
tagged with: java-8
linked to: http://stackoverflow.com/q/5911833
upvote count: 2
tagged with: java
has comment: http://stackoverflow.com/comment/34616527
has comment: http://stackoverflow.com/comment/34616606

http://stackoverflow.com/a/22731011
upvote count: 16
answers question: http://stackoverflow.com/q/22730690
downvote count: 0
score: 16
has body: simply said , Static Variables are stored in HEAP. Classes and all of the data applying to classes (not instance data) is stored in the Permanent Generation section of the heap. If you need elaborated answer , refer this static allocation in java - heap, stack and permanent generation
type: Answer

http://stackoverflow.com/a/22712740
has body: When you are using shiro, ShiroFilter should be the first filter in your filter chain try changing your web.xml to Pretty Filter com.ocpsoft.pretty.PrettyFilter ShiroFilter org.apache.shiro.web.servlet.ShiroFilter ShiroFilter /* REQUEST FORWARD INCLUDE ERROR Pretty Filter /* FORWARD REQUEST ERROR org.apache.shiro.web.env.EnvironmentLoaderListener
type: Answer
upvote count: 1
downvote count: 0
score: 1
answers question: http://stackoverflow.com/q/22674937

http://stackoverflow.com/a/22730573
type: Answer
score: 0
answers question: http://stackoverflow.com/q/22730174
has body: You can use 9-patch image for this.

http://stackoverflow.com/a/22726738
answers question: http://stackoverflow.com/q/22715623
type: Answer
has body: Don't show ads in preferences. This is really poor UX. And the PreferenceActvity mechanism is not well setup to handle it. How long are your users going spend in your preferences screen? Put the ads in the main body of your app instead.
has comment: http://stackoverflow.com/comment/34640078
has comment: http://stackoverflow.com/comment/34663645
has comment: http://stackoverflow.com/comment/34675776
score: 0

jboss5.x
tag name: jboss5.x
tags question: http://stackoverflow.com/q/22754033
type: Tag

http://stackoverflow.com/q/22683400
type: UnansweredQuestion
type: Question
has answer: http://stackoverflow.com/a/22684203
has answer: http://stackoverflow.com/a/22683556
tagged with: java
tagged with: eclipse
has body: I wrote the code in VS C++ and I have to run it on android ,I know about JNI approach but what I want to know is that , if i make .exe of that code in c/c++ VS then i call it in java android , then it will work or I can do it or not
score: 0
answer count: 3
has answer: http://stackoverflow.com/a/22683553
has title: C/C++ .exe can run on eclipse
tagged with: android
tagged with: c++

http://stackoverflow.com/comment/34691334
comment on: http://stackoverflow.com/a/22757475
has text: My point was just that you have to escape the \\ first, otherwise you will escape all those previously inserted \\s as well. But as pointed out by fge, there are indeed more severe problems...
score: 0
type: AnswerComment
type: Comment

http://stackoverflow.com/q/22717099
answer count: 1
has title: Convert an RGB image to gray_scale HSV in java
type: AnsweredQuestion
tagged with: hsv
tagged with: java
type: Question
has comment: http://stackoverflow.com/comment/34619518
tagged with: image
has comment: http://stackoverflow.com/comment/34687275
has comment: http://stackoverflow.com/comment/34686544
has answer: http://stackoverflow.com/a/22717504
accepted answer: http://stackoverflow.com/a/22717504
score: 0
has body: I want to convert a RGB image into HSV and return a gray_scale image, finally. I ve got the following code in order to read and convert my image: BufferedImage lum = new BufferedImage(original.getWidth(), original.getHeight(), original.getType()); for(int i=0; i&lt;original.getWidth(); i++) { for(int j=0; j&lt;original.getHeight(); j++) { // Get pixels by R, G, B alpha = new Color(original.getRGB(i, j)).getAlpha(); red = new Color(original.getRGB(i, j)).getRed(); green = new Color(original.getRGB(i, j)).getGreen(); blue = new Color(original.getRGB(i, j)).getBlue(); float[] hsv = Color.RGBtoHSB(red, green, blue, null); int hue = (int) Math.round(360 * hsv[0]); red = (int) (0.21 * red + 0.71 * green + 0.07 * blue); // Return back to original format newPixel = colorToRGB(alpha, red, red, red); // Write pixels into image lum.setRGB(i, j, hue); } } return lum; What have to do in order to return a hsv gray_scale image? Is the above the proper way to do so?

http://stackoverflow.com/q/22781273
type: Question
has body: I have an EditText and displaying values in that. I am using a StringBuilder str = str.insert(0, value); System.out.println("str2:-"+str); showOutputEdit.setText(str.toString()); If I use simple digits, it displays the digits correctly like input:- 1,2,3 ouput:- 3,2,1 but if use any symbol, they get reversed in the EditText but not in android log input:- 1,+,9 edittext output:- 1,+,9 log output:- 9,+,1 I am confused, why are they getting reversed in EditText? str2:-٩+١value + showOutputEdit.getText().toString()٩+١ Edittext:- 9+1
tagged with: java
has comment: http://stackoverflow.com/comment/34734060
has answer: http://stackoverflow.com/a/22781319
answer count: 1
has title: EditText doing reverse to string
tagged with: android
has comment: http://stackoverflow.com/comment/34734452
type: UnansweredQuestion
score: 0

akka
type: Tag
tags question: http://stackoverflow.com/q/22782671
tags question: http://stackoverflow.com/q/22808521
tag name: akka
tags question: http://stackoverflow.com/q/22807748

http://stackoverflow.com/a/22779340
upvote count: 1
has comment: http://stackoverflow.com/comment/34774081
score: 1
has comment: http://stackoverflow.com/comment/34773644
answers question: http://stackoverflow.com/q/22779037
has body: Struts2 uses the concept of ResourceBundle to load properties files and achive the goals of internalization (i18n) as well as localization (l10n). The resource bundle is used to keep the key and value pairs for respective languages such as English Resource Bundle can have value as English Text and France Resource Bundle can have value as France Text but the keys are same across. Resource Bundle can be place in the following places ActionClass.properties Interface.properties BaseClass.properties ModelDriven’s Model Package.properties I18n message key Global resource properties The resource properties are being searched in the above order. At first it looks the resource properties with action class name.properties, if does not found then it looks for interface.properties else goes on till Global resource properties. There are many tutorials which explain in detail about how to use Resource Bundles in Struts 2. Have a look at the following links: http://www.journaldev.com/2304/struts2-resource-bundles-and-localization-example http://javatechig.com/java/struts/struts2-localization-example http://www.javabeat.net/struts-2-resource-bundle-example/ =============== Update Regarding loading UTF-8 encoded properties file in Struts 2, you can refer http://javatechig.com/java/struts/struts2-localization-example and see how the Japanese text is being used after encoding it to UTF-8. Since, you mentioned about native2ascii, I am assuming that you know about how to convert a given text to UTF-8 encoding.
downvote count: 0
has comment: http://stackoverflow.com/comment/34735514
type: Answer
has comment: http://stackoverflow.com/comment/34731105

http://stackoverflow.com/comment/34747247
type: Comment
type: QuestionComment
has text: its not in any package, its in c:\
comment on: http://stackoverflow.com/q/22788638
score: 0

http://stackoverflow.com/q/22725141
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/34633657
has body: i have a GUI that accepts an entry and then processes the data, but i want to be able to display the entries in a queue and then display them in a JList. i have the GUI code with the JList and the queue but i dont know how to link them and make the JList a representation of the queue. GUI Class: public class ServerPlayergameMain extends javax.swing.JFrame implements Runnable { public serverPlayerQueue serverQueue = new serverPlayerQueue(); Thread run; public ServerPlayergameMain() { initComponents(); } public void run(){ String commandMessage = command.getText(); serverQueue.addToQueue(commandMessage); command.setText(" "); repaint(); validate(); } @SuppressWarnings("unchecked") // &lt;editor-fold defaultstate="collapsed" desc="Generated Code"&gt; private void initComponents() { command = new javax.swing.JTextField(); jLabel1 = new javax.swing.JLabel(); jButton1 = new javax.swing.JButton(); jScrollPane1 = new javax.swing.JScrollPane(); jList1 = new javax.swing.JList(); jButton2 = new javax.swing.JButton(); jButton3 = new javax.swing.JButton(); jLabel2 = new javax.swing.JLabel(); setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE); setResizable(false); command.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { commandActionPerformed(evt); } }); command.addKeyListener(new java.awt.event.KeyAdapter() { public void keyPressed(java.awt.event.KeyEvent evt) { commandKeyPressed(evt); } }); jLabel1.setText("Enter your command:"); jButton1.setText("Go!"); jButton1.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { jButton1ActionPerformed(evt); } }); jList1.setModel(new javax.swing.AbstractListModel() { String[] strings = { "Item 1", "Item 2", "Item 3", "Item 4", "Item 5" }; public int getSize() { return strings.length; } public Object getElementAt(int i) { return strings[i]; } }); jScrollPane1.setViewportView(jList1); jButton2.s…
tagged with: swing
type: Question
has title: display JList from a queue and refreshes after button click
tagged with: java
score: 0
answer count: 1
has answer: http://stackoverflow.com/a/22725277
accepted answer: http://stackoverflow.com/a/22725277
has comment: http://stackoverflow.com/comment/34633728
tagged with: jlist

http://stackoverflow.com/comment/34639886
comment on: http://stackoverflow.com/q/22728909
type: Comment
type: QuestionComment
has text: An alternative could be instantiatind an unique global SharepPreference editor and keep it alive till the app is finished? so you would always do your commits on the same object. Maybe it's not the most elegant or efficient solution.
score: 1

http://stackoverflow.com/a/22680278
type: Answer
upvote count: 3
answers question: http://stackoverflow.com/q/22680210
score: 3
has body: concat function not change the string but it returns the result which is not assigned in your case: String concat(String textToAppend) so change: s1 = s1.concat("abc");
downvote count: 0

http://stackoverflow.com/comment/53503634
score: 7
comment on: http://stackoverflow.com/a/22793119
type: AnswerComment
type: Comment
has text: Rather than using an `int[]` array it's best to use an [AtomicInteger](http://docs.oracle.com/javase/8/docs/api/java/util/concurrent/atomic/AtomicInteger.html). This will also ensure that if the elements are encountered out of order we at least get a unique index for each element.

http://stackoverflow.com/comment/34550040
type: Comment
has text: Probably it's there, but minimized. Have you tried to search the Android-thingy icon all over the place?
comment on: http://stackoverflow.com/q/22678968
score: 0
type: QuestionComment

http://stackoverflow.com/a/22802776
has body: AFAIK There is no way for you to achieve what you are looking for. If all ID's were created and defined in the xml layout file - you will have to call them in you code - but you will have to know their given ID's. If you create your ID's via the code for example textView.setId(1234); - then you are able to keep track of all names and do whatever you want with them. So, unfortunately I don't think what you want is possible.
score: 0
type: Answer
answers question: http://stackoverflow.com/q/22785971

http://stackoverflow.com/q/22752810
has answer: http://stackoverflow.com/a/22753759
has comment: http://stackoverflow.com/comment/34683024
tagged with: android
has comment: http://stackoverflow.com/comment/34686202
has comment: http://stackoverflow.com/comment/34682773
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/34683250
has comment: http://stackoverflow.com/comment/34684185
tagged with: java
type: Question
has comment: http://stackoverflow.com/comment/34685408
has comment: http://stackoverflow.com/comment/34682903
accepted answer: http://stackoverflow.com/a/22753759
has comment: http://stackoverflow.com/comment/34682705
has comment: http://stackoverflow.com/comment/34682729
has body: Displaying two random numbers and counting scores for odd and even turns. When one of it reaches to 100, the application stops. This is my code.. public class Board_Play1 extends Activity { int d=0,a=0,b=0,turn=2; Random random = new Random(); @Override protected void onCreate(final Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.board_play1); EditText diceno = (EditText) findViewById(R.id.editText1); EditText p1 = (EditText) findViewById(R.id.editText2); EditText p2 = (EditText) findViewById(R.id.editText3); diceno.setText(String.valueOf(d)); p1.setText(String.valueOf(a)); p2.setText(String.valueOf(b)); while(a!=100 &amp;&amp; b!=100) { if(turn%2==0) { Button button = (Button) findViewById(R.id.button1); button.setOnClickListener(new OnClickListener() { @Override public void onClick(View view) { // TODO Auto-generated method stub d=random.nextInt(6)+1; EditText diceno = (EditText) findViewById(R.id.editText1); diceno.setText(String.valueOf(d)); } }); } else { d=random.nextInt(6)+1; diceno.setText(String.valueOf(d)); } if(turn%2==0) a+=d; else b+=d; if(a&gt;100) a-=d; if(b&gt;100) b-=d; p1.setText(String.valueOf(a)); p2.setText(String.valueOf(b)); turn++; } a=0;b=0; } } When I run this.. It goes like.. everything is completed. All the time p2 editText gets 100 and p1 will have some number less than 100 and diceno has a value 100-p1. But well that's not the main question I want to ask. It is that I added Buttons and onClickListener methods that run only when user clicks on that particular button. But nothing such is happening. As soon as I open the app it gets their max. values and user got nothing to do. Why is it being that way? Help what to do so that I start with values 0 in both p1 and p2.
has comment: http://stackoverflow.com/comment/34683717
has title: Application runs without any user interaction
has comment: http://stackoverflow.com/comment/34682999
has comment: http://stackoverflow.com/comment/34686441
tagged with: android-button
score: 0
has comment: http://stackoverflow.com/comment/34685380
answer count: 1
has comment: http://stackoverflow.com/comment/34682697

http://stackoverflow.com/comment/34748167
comment on: http://stackoverflow.com/q/22785447
has text: The problem with this question is that you modified it after edit to be totally different question, actually, it is now 2 different questions. At first part you are requiring usage of passwordHash before form submit and at second part you are now using plain input values. First one would require tweaking with javascript and other doesnt. Make separate questions, this is madness
type: Comment
type: QuestionComment
score: 0

http://stackoverflow.com/q/22684115
tagged with: java
tagged with: file
has title: How to edit parts of a line in a text file in java
downvote count: 1
has answer: http://stackoverflow.com/a/22684318
type: Question
score: -1
has answer: http://stackoverflow.com/a/22684167
has comment: http://stackoverflow.com/comment/34558966
answer count: 2
upvote count: 0
has comment: http://stackoverflow.com/comment/34559182
favorite count: 0
type: UnansweredQuestion
tagged with: line
has body: I'm trying to delete the last four characters of all the lines in a text file. Let's say I have domain.txt and the content: 123.com student.com tech.net running into hundreds of lines. How do I delete the last four characters (the extensions) to remain: 123 student tech etc.

http://stackoverflow.com/a/22708523
type: Answer
score: 1
has body: see the &lt;uses-sdk android:minSdkVersion="see here" android:targetSdkVersion="see here" /&gt; for compatibility in your manifest
has comment: http://stackoverflow.com/comment/47577406
upvote count: 1
has comment: http://stackoverflow.com/comment/34602955
downvote count: 0
answers question: http://stackoverflow.com/q/22708452

bukkit
tag name: bukkit
tags question: http://stackoverflow.com/q/22717159
tags question: http://stackoverflow.com/q/22674995
tags question: http://stackoverflow.com/q/22752192
tags question: http://stackoverflow.com/q/22699883
type: Tag
tags question: http://stackoverflow.com/q/22677581
tags question: http://stackoverflow.com/q/22695718
tags question: http://stackoverflow.com/q/22796290

http://stackoverflow.com/comment/34791302
score: 0
type: Comment
type: QuestionComment
has text: I add"-XX:PermSize=512M -XX:MaxPermSize=128M" in eclipse.ini, then made it~thanks
comment on: http://stackoverflow.com/q/22807059

http://stackoverflow.com/comment/34622425
score: 0
type: Comment
type: QuestionComment
has text: I suspect that you're not handling your indices correctly (as per my answer). If my answer doesn't answer your question, then again, consider creating and posting a [minimal example program](http://stackoverflow.com/help/mcve).
comment on: http://stackoverflow.com/q/22715607

http://stackoverflow.com/comment/34665349
score: 0
comment on: http://stackoverflow.com/q/22742172
type: QuestionComment
type: Comment
has text: 5 is appearing 4 times & 2 is appearing 3 times.

http://stackoverflow.com/comment/34613290
comment on: http://stackoverflow.com/a/22700790
type: Comment
score: 0
type: AnswerComment
has text: Ok, try this: `@Override public String toString() { return String.valueOf(activity.getString(activity.getResources().getIdentifier(this.fileName, "string", activity.getPackageName()))); }`

http://stackoverflow.com/q/22650121
tagged with: java
has body: I am working on this program and keep getting this result. To convert fractional measures, enter the fractional measure you want to convert: 3/4 Enter the fractional amount to reduce/increase it by: 1/2 The converted measurement is: Fraction@6750cf54 The part is bold is the problem. This is my main program. import java.util.*; // Scanner import java.io.*; // PrintStream public class Pierre1 extends Object { public static void main(String args[]) { PrintStream theScreen = new PrintStream(System.out); Scanner theKeyboard = new Scanner(System.in); theScreen.println("\nTo convert fractional measures,"); theScreen.print(" enter the fractional measure you want to convert: "); Fraction oldMeasure = new Fraction(); oldMeasure.read(theKeyboard); theScreen.print("\nEnter the fractional amount to reduce/increase it by: "); Fraction scaleFactor = new Fraction(1,6); scaleFactor.read(theKeyboard); Fraction newMeasure = oldMeasure.times(scaleFactor); theScreen.print("\nThe converted measurement is: "); theScreen.print(newMeasure); theScreen.println(); theScreen.println(); } } This is my other program. import java.util.*; // Scanner import java.io.*; // PrintStream public class Fraction extends Object { private int myNumerator = 0; private int myDenominator = 0; public void print(PrintStream out) { System.out.print(myNumerator + "/" + myDenominator); } public Fraction() { myNumerator = 0; myDenominator = 1; } public Fraction(int numerator, int denominator) { myNumerator = numerator; myDenominator = denominator; } private int numerator() { return myNumerator; } private int denominator() { return myDenominator; } public void read (Scanner in) { String fraction = in.next(); StringTokenizer parser = new StringTokenizer(fraction, "/", false); if (parser.countTokens() != 2) throw new RuntimeException("Bad Fraction Format"); myNumerator = Integer.parseInt(parser.nextToken()); myDenominator = Integer.parseInt(parser.nextToken()); } Fraction times(Fraction rightOperand) { Fraction result = …
has title: Fraction.java Keep getting object address not the values I want
has comment: http://stackoverflow.com/comment/34498851
answer count: 1
score: 0
tagged with: fractions
has comment: http://stackoverflow.com/comment/34498566
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/22650167
type: Question
has comment: http://stackoverflow.com/comment/34498697

http://stackoverflow.com/comment/34726509
type: QuestionComment
has text: @ZiaUrRehman check out my ans
type: Comment
comment on: http://stackoverflow.com/q/22776830
score: 0

http://stackoverflow.com/a/22788485
score: 1
upvote count: 1
answers question: http://stackoverflow.com/q/22786872
has body: Try this : While reading each line from the file, replace '\' by '\\'. Then : String lLine = "C\\Windows\\SysWOW64\\ntdll.dll"; Pattern lPattern = Pattern.compile("C\\\\Windows\\\\SysWOW64\\\\ntdll\\.dll"); Matcher lMatcher = lPattern.matcher(lLine); if(lMatcher.find()) { System.out.println(lMatcher.group()); } lLine = "C\\Windows\\SysWOW64\\ntdll.dll (some developer stuff here...)"; lMatcher = lPattern.matcher(lLine); if(lMatcher.find()) { System.out.println(lMatcher.group()); }
type: Answer
downvote count: 0

binary-tree
tag name: binary-tree
tags question: http://stackoverflow.com/q/22793036
tags question: http://stackoverflow.com/q/22720605
tags question: http://stackoverflow.com/q/22733348
type: Tag
tags question: http://stackoverflow.com/q/22750289
tags question: http://stackoverflow.com/q/22669671
tags question: http://stackoverflow.com/q/22765052
tags question: http://stackoverflow.com/q/22735857
tags question: http://stackoverflow.com/q/22735636
tags question: http://stackoverflow.com/q/22707163

http://stackoverflow.com/comment/34663647
type: QuestionComment
comment on: http://stackoverflow.com/q/22742238
score: 0
has text: Hmm correct but not what i am looking for. For example i have this website localhost:8080/folder/sample.jsp how do i get a .xml file from that?
type: Comment

http://stackoverflow.com/q/22794514
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/34757840
has comment: http://stackoverflow.com/comment/34757826
has comment: http://stackoverflow.com/comment/34757994
tagged with: war
has answer: http://stackoverflow.com/a/22825287
has answer: http://stackoverflow.com/a/22794996
type: Question
tagged with: spring-mvc
tagged with: java
tagged with: image
has title: Unable to access Images inside a War file
score: 0
has answer: http://stackoverflow.com/a/22794792
accepted answer: http://stackoverflow.com/a/22825287
has comment: http://stackoverflow.com/comment/34757805
has body: I have a war file that I have deployed which contains an images folder in the WEB-APP directory. I tried accessing the images stored in the folder using "localhost:8080/testapp/images/image1.jpg" but I am getting a 404 response. Can someone please help me with this? Thanks in advance.
has comment: http://stackoverflow.com/comment/34757922
possible better answer: http://stackoverflow.com/a/22794792
has comment: http://stackoverflow.com/comment/34757887
has answer: http://stackoverflow.com/a/22795250
tagged with: spring
answer count: 4
has comment: http://stackoverflow.com/comment/34757858

http://stackoverflow.com/a/22808664
answers question: http://stackoverflow.com/q/22808565
has body: In your JSP use, &lt;% Cookie cookie = null; Cookie[] cookies = null; cookies = request.getCookies(); if( cookies != null) { for (int i = 0; i &lt; cookies.length; i++){ cookie = cookies[i]; String b = cookie.getComment(); request.setAttribute("xyz", b); } } %&gt; and then you can use is by ${xyz} in htmls and use b if you want to use it in JSP code.
type: AcceptedAnswer
downvote count: 0
type: Answer
accepted answer of: http://stackoverflow.com/q/22808565
score: 2
has comment: http://stackoverflow.com/comment/34819959
upvote count: 2

http://stackoverflow.com/comment/34640547
has text: You will need a LogginHelper who handles all your Loggers.
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/22729271

http://stackoverflow.com/q/22698837
has title: how to solve java.lang.AbstractMethodError
tagged with: java
has comment: http://stackoverflow.com/comment/34587143
has comment: http://stackoverflow.com/comment/34586926
type: Question
tagged with: hibernate
score: 0
tagged with: jboss7.x
linked to: http://stackoverflow.com/q/5525987
type: UnansweredQuestion
has body: I have a project runned at Jboss7 with the dependencies as follow: org.hibernate hibernate-core 3.6.10.Final compile org.hibernate hibernate-envers 3.6.10.Final compile org.hibernate.javax.persistence hibernate-jpa-2.0-api 1.0.1.Final compile org.hibernate hibernate-validator 4.2.0.Final compile org.hibernate hibernate 3.2.5.ga provided jasperreports jasperreports 3.5.3 When i try call this.getEntityManager().persist(entity) is throwed: 17:40:44,258 WARNING [javax.enterprise.resource.webcontainer.jsf.lifecycle] (http-localhost-127.0.0.1-8080-5) #{veiculoBean.incluir}: java.lang.AbstractMethodError: javax.faces.FacesException: #{veiculoBean.incluir}: java.lang.AbstractMethodError at com.sun.faces.application.ActionListenerImpl.processAction(ActionListenerImpl.java:118) [jsf-impl-2.1.7-jbossorg-2.jar:] at javax.faces.component.UICommand.broadcast(UICommand.java:315) [jboss-jsf-api_2.1_spec-2.0.1.Final.jar:2.0.1.Final] at javax.faces.component.UIViewRoot.broadcastEvents(UIViewRoot.java:794) [jboss-jsf-api_2.1_spec-2.0.1.Final.jar:2.0.1.Final] at javax.faces.component.UIViewRoot.processApplication(UIViewRoot.java:1259) [jboss-jsf-api_2.1_spec-2.0.1.Final.jar:2.0.1.Final] at com.sun.faces.lifecycle.InvokeApplicationPhase.execute(InvokeApplicationPhase.java:81) [jsf-impl-2.1.7-jbossorg-2.jar:] at com.sun.faces.lifecycle.Phase.doPhase(Phase.java:101) [jsf-impl-2.1.7-jbossorg-2.jar:] at com.sun.faces.lifecycle.LifecycleImpl.execute(LifecycleImpl.java:118) [jsf-impl-2.1.7-jbossorg-2.jar:] at javax.faces.webapp.FacesServlet.service(FacesServlet.java:593) [jboss-jsf-api_2.1_spec-2.0.1.Final.jar:2.0.1.Final] at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:329) [jbossweb-7.0.13.Final.jar:] at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:248) [jbossweb-7.0.13.Final.jar:] at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:275) [jbossweb-7.0.13.Final.jar:] at org.a…
answer count: 0

http://stackoverflow.com/comment/34499044
has text: @Joey, we were _all_ beginners once, sometimes people forget that.
score: 2
comment on: http://stackoverflow.com/a/22650244
type: AnswerComment
type: Comment

http://stackoverflow.com/comment/70575250
type: QuestionComment
comment on: http://stackoverflow.com/q/22756186
has text: you can see here:http://corejavaexample.blogspot.in/2013/04/how-to-upload-file-in-jsp.html
score: 0
type: Comment

http://stackoverflow.com/comment/34605069
type: QuestionComment
has text: my major task is to set jlabel text on the top of the jlabel
score: 0
comment on: http://stackoverflow.com/q/22709058
type: Comment

http://stackoverflow.com/a/22689870
accepted answer of: http://stackoverflow.com/q/22689772
answers question: http://stackoverflow.com/q/22689772
has body: Does your code look like this? import java.util.ArrayList; import java.util.List; public class Example { public static void main(String[] args) throws Exception { List&lt;String&gt; myList = new ArrayList&lt;String&gt;(); } }
type: Answer
upvote count: 2
downvote count: 1
score: 1
type: AcceptedAnswer

http://stackoverflow.com/comment/34680492
type: Comment
type: QuestionComment
score: 0
has text: yes I have, i did [\^], and (\^)
comment on: http://stackoverflow.com/q/22751564

http://stackoverflow.com/comment/34565634
comment on: http://stackoverflow.com/a/22665634
has text: Thank you @Zeus ! That was helpful. I don't have now to worry about the amount of the table I have.
type: AnswerComment
score: 0
type: Comment

http://stackoverflow.com/a/22689399
type: Answer
upvote count: 1
answers question: http://stackoverflow.com/q/22689299
score: 1
downvote count: 0
has comment: http://stackoverflow.com/comment/34568747
has body: You'll need to reference the file from the classpath instead. Try in = this.getClass().getClassLoader().getResourceAsStream("om/infosys/gidl2/shiplabel/mybatis/config/nWMS_database.properties"); Make sure that the resource-dev directory is considered a source dir so that it gets included in the WEB-INF/classes of your war file.

http://stackoverflow.com/a/22721564
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/22721529
answers question: http://stackoverflow.com/q/22721529
downvote count: 0
has body: You can do this: public class IntArrayDemo { private static final int DEFAULT_SIZE = 10; private int [] values; public IntArrayDemo() { this(DEFAULT_SIZE); } public IntArrayDemo(int size) { if (size &lt; 0) throw new IllegalArgumentException("size cannot be negative"); this.values = new int[size]; } }
type: Answer
upvote count: 7
score: 7

http://stackoverflow.com/q/22733147
has title: Android Drawer Layout is Displaying under fragment content
tagged with: android-fragments
has comment: http://stackoverflow.com/comment/34647501
tagged with: java
has answer: http://stackoverflow.com/a/27838199
has body: I am adding a drawer layout to my Activity which uses fragments. I've implemented this just as described here per the android documentation. And the drawer layout Adapter and View all work in that they show up, but the drawer extends "under" the fragment content. Here is a picture of what is happening: Does anyone know why this might be? My code for the activity's xml, and the activity add fragment is below: @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_alarm_list); // for drawer navigation FragmentManager fragmentManager = getFragmentManager(); FragmentTransaction fragmentTransaction = fragmentManager .beginTransaction(); fragmentTransaction.replace(android.R.id.content, new AlarmListFragment()); fragmentTransaction.commit(); setUpDrawer(fragmentManager); } private void setUpDrawer(FragmentManager fm) { String[] drawerItems = getResources().getStringArray( R.array.drawer_array); DrawerLayout drawer = (DrawerLayout) findViewById(R.id.drawer_layout); ListView drawerList = (ListView) findViewById(R.id.left_drawer); // Set the adapter for the list view drawerList.setAdapter(new ArrayAdapter<String>(this, R.layout.item_nav_drawer, drawerItems)); // Set the list's click listener drawerList.setOnItemClickListener(new DrawerItemClickListener(drawer,drawerList,drawerItems,fm)); } Layout: <?xml version="1.0" encoding="utf-8"?> <android.support.v4.widget.DrawerLayout xmlns:android="http://schemas.android.com/apk/res/android" android:id="@+id/drawer_layout" android:layout_width="match_parent" android:layout_height="match_parent" > </android.support.v4.widget.DrawerLayout> Do I have to set a z-index somewhere? I can provide any further info needed I'd just really like to figure this out!
type: Question
upvote count: 4
tagged with: android-layout
answer count: 2
downvote count: 0
score: 4
tagged with: listview
has answer: http://stackoverflow.com/a/34857749
favorite count: 0
type: UnansweredQuestion
tagged with: android

http://stackoverflow.com/comment/34665716
type: QuestionComment
comment on: http://stackoverflow.com/q/22743607
has text: well, what are the x and y fields for both the dot and player if not positions?
score: 0
type: Comment

http://stackoverflow.com/comment/34597556
type: QuestionComment
has text: upload logcat n code snippet please
type: Comment
comment on: http://stackoverflow.com/q/22705426
score: 0

http://stackoverflow.com/a/29053564
upvote count: 2
score: 1
has body: In case of JBoss... right click on project → Build Java path → add external JAR files. Then browse to jboss-folder → Common → lib → servlet-api.jar . . Click OK, refresh the project, and run it...
downvote count: 1
answers question: http://stackoverflow.com/q/22756153
has comment: http://stackoverflow.com/comment/49645444
type: Answer

http://stackoverflow.com/q/22756578
score: 0
has body: Hi i am trying to make java desktop application where i am receiving value from seril port in my java string variable and i am receiving data through a hardware device and this will throw data continuously i am storing that data in a string variable now i want to get only some specific data from that. so how can i achieve this i am receiving data in following format $GPRMC,235949.799,V,,,,,0.00,0.00,050180,,,N*46 $GPVTG,0.00,T,,M,0.00,N,0.00,K,N*32 $GPGGA,235949.799,,,,,0,0,,,M,,M,,*4F $GPGSA,A,1,,,,,,,,,,,,,,,*1E $GPGSV,1,1,00*79 $GPGLL,,,,,235949.799,V,N*7D $GPTXT,01,01,02,ANTSTATUS=OPEN*2B this string is continuously receiving i want to get from this string only first line from every String Here is my code public class ListPortClass { private int times = 0; public static void main(String[] s) { BufferedReader br = null; try { String sCurrentLine; CommPortIdentifier portIdentifier = CommPortIdentifier.getPortIdentifier("COM6"); if (portIdentifier.isCurrentlyOwned()) { System.out.println("Port in use!"); } else { System.out.println(portIdentifier.getName()); SerialPort serialPort = (SerialPort) portIdentifier.open("ListPortClass", 300); int b = serialPort.getBaudRate(); System.out.println(Integer.toString(b)); serialPort.setSerialPortParams(300, SerialPort.DATABITS_8, SerialPort.STOPBITS_1, SerialPort.PARITY_NONE); OutputStream mOutputToPort = serialPort.getOutputStream(); InputStream mInputFromPort = serialPort.getInputStream(); String mValue = "DEBUG_GPS"; System.out.println("beginning to Write . \r\n"); mOutputToPort.write(mValue.getBytes()); System.out.println("DEBUG_GPS Command Written to Port. \r\n"); mOutputToPort.flush(); System.out.println("Waiting for Reply \r\n"); Thread.sleep(500); byte mBytesIn [];// = new byte[48]; //for(int i=0;i&lt;=mBytesIn.length;i++){ mInputFromPort.read(); try{ while(true){ int a = mInputFromPort.read(); char c=(char)a; //String c =String.valueOf(a); //System.out.print(c); String temp = Character.toString(c); System.out.print(te…
answer count: 1
has title: How to read particular string?
has answer: http://stackoverflow.com/a/22756631
has comment: http://stackoverflow.com/comment/34689475
tagged with: serial-port
has comment: http://stackoverflow.com/comment/34689551
type: UnansweredQuestion
tagged with: java
type: Question
tagged with: rxtx

http://stackoverflow.com/q/22791828
tagged with: java
has answer: http://stackoverflow.com/a/22815328
has comment: http://stackoverflow.com/comment/34753673
type: Question
has answer: http://stackoverflow.com/a/22792579
has title: Java error handling, what's the correct way to handle this?
downvote count: 0
has comment: http://stackoverflow.com/comment/34760093
answer count: 3
tagged with: exception
favorite count: 0
has body: What's in java the correct method to handle method params/inner errors? All the three methods do the same thing, with a little difference in the second one where exception also have a "caused by" section. Please not that in the third method, the return must be repeated every time i want to exit from it. Consider also that exception handling is quite expensive in java (i've read this somewhere). Thanks!! public static String method(String arg) { block: { if (arg == null) { logger.error("arg is null"); break block; } try { ... return "ok"; } catch (Exception e) logger.error("help!", e); } } return "ko"; } public static String method(String arg) { try { if (arg == null) { throw new Exception("arg is null"); } ... return "ok"; } catch (Exception e) { logger.error("help!", e); return "ko"; } } public static String method(String arg) { String result = "ko"; if (arg == null) { logger.error("arg is null"); return result; } try { .. result = "ok"; } catch(Exception e) { logger.error("help!", e); } return result; } EDIT: Also, in the second method, you can differentiate inner method errors by using RuntimeException (or a custom one), bad idea?
has answer: http://stackoverflow.com/a/22797992
type: UnansweredQuestion
tagged with: error-handling
upvote count: 1
score: 1

http://stackoverflow.com/a/22757886
has comment: http://stackoverflow.com/comment/34693133
upvote count: 1
type: Answer
downvote count: 0
score: 1
has body: Try with following formation: For publicly use, define method in .h file. +( NSString *) GetMonth:(NSString *) month; And put body of method in .m file. +( NSString *) GetMonth:(NSString *) month { . . . //your code; }
answers question: http://stackoverflow.com/q/22757839

http://stackoverflow.com/comment/34685678
type: Comment
has text: hey, i tried checking for errors in the androidmanifest.xml but as far as i know, it was fine. What might be the error? thanks
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/22754437

http://stackoverflow.com/comment/34732136
has text: @Eugene The query already takes a huge amount of time to complete so using limit would have to be a last resort at the moment. I was using mysql-connector-java-5.1.29 I will try with it upgraded to 5.1.30 unless there are any preferable drivers?
type: Comment
type: QuestionComment
score: 0
comment on: http://stackoverflow.com/q/22779520

http://stackoverflow.com/comment/34956251
type: Comment
has text: @Sean87 Hey.. It's because Moto G does not destroy activities by default and may be nexus does. Try using destroy activities option checked from developer tools of moto g and you will be able to find out exact problem at least.
score: 0
type: QuestionComment
comment on: http://stackoverflow.com/q/22724970

http://stackoverflow.com/comment/34526429
score: 0
comment on: http://stackoverflow.com/q/22665919
type: Comment
type: QuestionComment
has text: Also, is your `service` a `mock()` or a `spy()`?

http://stackoverflow.com/q/22724760
score: 0
answer count: 1
has answer: http://stackoverflow.com/a/22724881
favorite count: 0
has title: Basic Array Skills: Label Each Element
upvote count: 1
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/34633017
has comment: http://stackoverflow.com/comment/34632982
tagged with: java
accepted answer: http://stackoverflow.com/a/22724881
downvote count: 1
type: Question
has body: I have to perform the following basic skills with arrays: Here is a list of everything I had to do: a) Create an array x of doubles with an initializer list that contains the following values: 8, 4, 5, 21, 7, 9, 18, 2, and 100. b) Print the number of items in the array. c) Print the first array item. d) Print the last array item. Be careful to choose the right index. e) Use a standard for loop to print all the values in the array. f) Use a standard for loop to print all the values in the array with labels to indicate the location of each element, such as [0] = xx g) Use a standard for loop to print all the values in the array in reverse order. h) Use an enhanced for loop to print all the values in the array. I am having a lot of trouble with f), I saw that you could label using "JLabel" which I did not learn in my class but I wasn't sure if it could be applied here, here is my code so far. If "JLabel" can't be used, what else would I be able to do? Any help will be appreciated, Thanks!!! public static void main(String[] args) { double[] x = {8, 4, 5, 21, 7, 9, 18, 2, 100}; double temp; System.out.println("The number of items in the array is " + x.length); System.out.println("The first array item is " + x[0]); System.out.println("The last array item is " + x[8]); for(int i = 0; i &lt; 9; i++) { System.out.println(x[i] + " "); } //F //JLabel labels[] = new JLabel[8]; //for (int i = 0; i &lt; 9; i++) //{ //labels[i] = new JLabel("Label" + i); //} for(int i =x.length - 1; i &gt;= 0; i--) { System.out.println(x[i] + " "); } for (double val : x) { System.out.println(val + " "); } } }
tagged with: arrays

http://stackoverflow.com/q/22720966
tagged with: android
has body: Here is my Json : [ { "canaldsc":"PHARMA", "cadenadsc":null, "formatodsc":"DEL AHORRO", "estadodsc":null, "ciudaddsc":"VALLE DE MEXICO", "regiondsc":"CENTRO SUR", "proyectotiendaid":null, "proyectoid":"79", "planid":"54", "proyectodsc":"Concurso", "vigencia":"0000-00-00", "activo":"1", "usuarioproyectotiendaid":"65280", "proyecto":null, "fechainicio":"2014-03-24", "lunes":"7", "martes":"7", "miercoles":"7", "jueves":"7", "viernes":"7", "sabado":"7", "domingo":"7" }, { "canaldsc":"PHARMA", "cadenadsc":null, "formatodsc":"DEL AHORRO", "estadodsc":null, "ciudaddsc":"VALLE DE MEXICO", "regiondsc":"CENTRO SUR", "proyectotiendaid":null, "proyectoid":"79", "planid":"54", "proyectodsc":"Concurso", "vigencia":"0000-00-00", "activo":"1", "usuarioproyectotiendaid":"65284", "proyecto":null, "fechainicio":"2014-03-24", "lunes":"7", "martes":"7", "miercoles":"7", "jueves":"7", "viernes":"7", "sabado":"7", "domingo":"7" } ] In reality, there is more than 2 objects, but I cut it to simplify My Model Class : public class PdvResult { public PdvResult() { } public String canaldsc; public String cadenadsc; public String formatodsc; public String estadodsc; public String ciudaddsc; public String regiondsc; public String proyectotiendaid; public String proyectoid; public String planid; public String proyectodsc; public String vigencia; public String activo; public String usuarioproyectotiendaid; public String proyecto; public String fechainicio; public String lunes; public String martes; public String miercoles; public String jueves; public String viernes; public String sabado; public String domingo; } It should be corresponds in the names so that the mapping can happen. In my Java, I use List&lt;PdvResult&gt; pdvs = (List&lt;PdvResult&gt;)gson.fromJson(reader, new TypeToken&lt;PdvResult&gt;() {}.getType()); but pdvs return null. What's wrong with my code????
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/22723898
has comment: http://stackoverflow.com/comment/34627660
tagged with: java
tagged with: http://stackoverflow.com/tag/json
tagged with: gson
has title: parse JSON with GSON returns null
type: Question
has comment: http://stackoverflow.com/comment/34625954
accepted answer: http://stackoverflow.com/a/22723898
score: 0
has comment: http://stackoverflow.com/comment/34625784
answer count: 2
has comment: http://stackoverflow.com/comment/34626854
has answer: http://stackoverflow.com/a/22721316
possible better answer: http://stackoverflow.com/a/22721316

http://stackoverflow.com/a/62943598
has body: Content-type/body content is supported in apache camel through producer template with query param "deleteWithBody" by default it will be false. String endpoint = https://testuri.com/resource; endpoint = https://testuri.com/resource?deleteWithBody=true; Exchange exchange; exchange.getIn.setBody("test"); exchange.getIn.setHeader("Content-Type","application/json"); ProducerTemplate template = exchange.set(endpoint, exchange);
answers question: http://stackoverflow.com/q/22715289
type: Answer
score: 0

http://stackoverflow.com/q/22738023
has comment: http://stackoverflow.com/comment/34656010
tagged with: cheminformatics
has comment: http://stackoverflow.com/comment/34655960
has body: My goal is to use the periodic table of elements (or a list) to get information about a specific element in Java. I want to search it by atomic number and symbol (but that conversion should be simple). I found that information in this JQuery plugin. But it is stored as a JSON file. It seems like it would be most efficient to hardcode the information (since it doesn't change too often and due to performance reasons), but how do I convert JSON to a hardcoded enum?
favorite count: 0
has comment: http://stackoverflow.com/comment/34655961
has comment: http://stackoverflow.com/comment/34656007
has comment: http://stackoverflow.com/comment/34656015
has answer: http://stackoverflow.com/a/22738610
possible better answer: http://stackoverflow.com/a/22738415
has comment: http://stackoverflow.com/comment/34656077
score: 2
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/22738415
upvote count: 3
has comment: http://stackoverflow.com/comment/34656228
has title: Data Structure of the Periodic Table of Elements
downvote count: 1
type: Question
has comment: http://stackoverflow.com/comment/34656246
has comment: http://stackoverflow.com/comment/95037824
tagged with: enums
tagged with: java
accepted answer: http://stackoverflow.com/a/22738610
has comment: http://stackoverflow.com/comment/34656049
answer count: 2
has comment: http://stackoverflow.com/comment/34656019

http://stackoverflow.com/comment/34667996
comment on: http://stackoverflow.com/a/22744070
score: 0
type: AnswerComment
type: Comment
has text: i am not getting properly how to do this

http://stackoverflow.com/a/22686206
has body: Keep a TextWatcher and track the length of entered text. Do MAX_LENGTH - yourTextwatcherString.length; Keep updating the view on the RHS top based on a timer/ or on even key press, your wish (there are several ways to do that). Check, whether old length and new length are not the same before updating the view.
answers question: http://stackoverflow.com/q/22686153
score: 0
has comment: http://stackoverflow.com/comment/34561801
type: Answer

http://stackoverflow.com/comment/34655736
score: 2
comment on: http://stackoverflow.com/q/22737903
has text: The clean way to deal with dependencies is to use dependency injection. That's what you're doing, manually. But a DI framework could do it for you.
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/34643977
comment on: http://stackoverflow.com/a/22722455
has text: Drew thanks for the code and help. It appears from your explanation though that this is a multithreaded app that basically acts like a single threaded app because of the wait and notify. Is that correct? If so, it appears it would be best to simply use a single thread?
type: AnswerComment
score: 0
type: Comment

http://stackoverflow.com/comment/34655281
type: Comment
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/22737661
has text: oh wow this works. Can you explain why my code does not work? I thought I extended the Thread class when I declared myProcess

http://stackoverflow.com/a/22672905
accepted answer of: http://stackoverflow.com/q/22671215
has comment: http://stackoverflow.com/comment/34538866
answers question: http://stackoverflow.com/q/22671215
score: 2
type: AcceptedAnswer
downvote count: 0
has body: It is a near certainty that you have declared the return type of getList to be the raw type List instead of List&lt; String &gt;. Even if the body of getList works with explicitly-typed generic lists, the return type declaration determines the way the compiler types an expression which involves a call to that method.
type: Answer
upvote count: 2

http://stackoverflow.com/comment/34742631
has text: I just got MIMEEntity of body using getMIMEEntity java method. How can I copy this entity to another document? I tried Document.copyItem method but it seem to copy just one MIME part. For now it would be fine even without seperation of attachments, cause I'm out of ideas.
type: AnswerComment
score: 0
type: Comment
comment on: http://stackoverflow.com/a/22766060

mapreduce
tags question: http://stackoverflow.com/q/22731868
type: Tag
tags question: http://stackoverflow.com/q/22706566
tags question: http://stackoverflow.com/q/22779874
tags question: http://stackoverflow.com/q/22729865
tags question: http://stackoverflow.com/q/22731176
tag name: mapreduce
tags question: http://stackoverflow.com/q/22740007
tags question: http://stackoverflow.com/q/22720125
tags question: http://stackoverflow.com/q/22739507
tags question: http://stackoverflow.com/q/22786511
tags question: http://stackoverflow.com/q/22782304
tags question: http://stackoverflow.com/q/22661978
tags question: http://stackoverflow.com/q/22672075

http://stackoverflow.com/comment/34688083
comment on: http://stackoverflow.com/a/22755769
type: Comment
has text: Arrays aren't data structures? I think you meant `Collection`.
score: 0
type: AnswerComment

http://stackoverflow.com/q/22760001
type: AnsweredQuestion
downvote count: 0
score: 1
accepted answer: http://stackoverflow.com/a/23864952
has comment: http://stackoverflow.com/comment/36731745
favorite count: 0
type: Question
has title: Getting field values of a javascript object
upvote count: 1
tagged with: scriptengine
answer count: 1
has answer: http://stackoverflow.com/a/23864952
tagged with: rhino
has body: I've been using rhino to allow the customization of some applications. Here is an example of JavaScript function that is called from Java: function() { var phone = this.telephoneNumber; phone = phone.replace(/[^+0-9]/g,""); if (phone.indexOf("+") == 0) { phone = "00" + phone.substring(1); } if (phone.indexOf("0041") == 0) { phone = "0" + phone.substring(4); } if (phone.indexOf("0") == 0) { phone = "0" + phone; } return { Name: this.sn + " " + this.givenName, firstName: this.givenName || "", lastName: this.sn || "", phone: phone, service: "", info: "" }; } The java application can then get the values of the returned object for whatever it needs to do. Now that rhino is part of the JVM, I would like to use the scripting API instead of the Rhino API, but I haven't found how to get the field values of a JavaScript object from Java code.
tagged with: java
has comment: http://stackoverflow.com/comment/36731053

http://stackoverflow.com/comment/34732337
type: Comment
has text: please can you tell me how to post my code because when i post my code it ask for space i cant understand how to post please tell me.
type: AnswerComment
comment on: http://stackoverflow.com/a/22780188
score: 0

http://stackoverflow.com/q/22805854
has comment: http://stackoverflow.com/comment/34781880
has comment: http://stackoverflow.com/comment/34778717
upvote count: 1
favorite count: 0
accepted answer: http://stackoverflow.com/a/23804425
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/23804425
downvote count: 0
score: 1
tagged with: java
type: Question
tagged with: apache
has comment: http://stackoverflow.com/comment/34778349
has title: The import org.apache.commons.lang3 cannot be resolved
answer count: 1
has body: I'm trying to import this library in order to use the RandomStringUtils class, but always I'm getting the error in the title of the question. This is an ANT project, so I downloaded the library from Apache (http://commons.apache.org/proper/commons-lang/download_lang.cgi) and put it in the lib folder of the project. However, it's not working. I got another library in this folder (org.apache.commons.cli) and it's working fine. edit: ok, this is solved... It's a bug in Eclipse saying the import cannot be resolved.
has comment: http://stackoverflow.com/comment/34784430

http://stackoverflow.com/comment/34589975
comment on: http://stackoverflow.com/q/22700845
score: 0
has text: Where are you executing the JVM on some IDE or on command line
type: Comment
type: QuestionComment

http://stackoverflow.com/a/34688851
answers question: http://stackoverflow.com/q/22712961
has body: Its worth noting that as of version 0.6, junit-quickcheck now supports shrinking: http://pholser.github.io/junit-quickcheck/site/0.6-alpha-3-SNAPSHOT/usage/shrinking.html quickcheck doesn't look to have had any new releases since 2011: https://bitbucket.org/blob79/quickcheck
upvote count: 5
type: Answer
downvote count: 0
score: 5

http://stackoverflow.com/q/22736539
has answer: http://stackoverflow.com/a/22736729
has comment: http://stackoverflow.com/comment/34653767
has comment: http://stackoverflow.com/comment/34653559
has comment: http://stackoverflow.com/comment/34653771
has comment: http://stackoverflow.com/comment/34653617
has comment: http://stackoverflow.com/comment/34653566
tagged with: arraylist
score: 0
has body: I am conducting some testing on a list item for object Student however i prefer to create a hard coded list in the java class object and just pull the data from there rather than connect to the database and select records in a result set. However it's been very long time since i did this and i think i am not writing up the class accurately. I would like every time i call this class or instantiate it that i get back the hard coded list. Under is the class. I need some assistance in setting up the hard coded list. Student Class public class Student { private int studentId; private String studentLastname; private String studentFirstName; private int studentAge; public Student() { } public Student(int studentId, String studentLastname, String studentFirstName, int studentAge) { this.studentId = studentId; this.studentLastname = studentLastname; this.studentFirstName = studentFirstName; this.studentAge = studentAge; } public int getStudentId() { return studentId; } public void setStudentId(int studentId) { this.studentId = studentId; } public String getStudentLastname() { return studentLastname; } public void setStudentLastname(String studentLastname) { this.studentLastname = studentLastname; } public String getStudentFirstName() { return studentFirstName; } public void setStudentFirstName(String studentFirstName) { this.studentFirstName = studentFirstName; } public int getStudentAge() { return studentAge; } public void setStudentAge(int studentAge) { this.studentAge = studentAge; } } Data I would like to insert the following data Student.add(1, "john","william", 20); Student.add(2, "bob","elis", 25); Student.add(3, "harry","potter", 19); Student.add(4, "micheal","louis", 20); Student.add(5, "smith","sobers", 30);
accepted answer: http://stackoverflow.com/a/22736729
has comment: http://stackoverflow.com/comment/34653483
has comment: http://stackoverflow.com/comment/34653511
has title: Harded Coded Java List in Java Class
has answer: http://stackoverflow.com/a/22736811
answer count: 4
type: AnsweredQuestion
tagged with: list
tagged with: java
possible better answer: http://stackoverflow.com/a/22736816
has answer: http://stackoverflow.com/a/22736820
type: Question
has answer: http://stackoverflow.com/a/22736816
has comment: http://stackoverflow.com/comment/34653570

quartz-scheduler
tags question: http://stackoverflow.com/q/22697465
tags question: http://stackoverflow.com/q/22754318
type: Tag
tags question: http://stackoverflow.com/q/22668270
tags question: http://stackoverflow.com/q/22806840
tag name: quartz-scheduler
tags question: http://stackoverflow.com/q/22787237
tags question: http://stackoverflow.com/q/22779568
tags question: http://stackoverflow.com/q/22757396
tags question: http://stackoverflow.com/q/22703415

http://stackoverflow.com/q/22650444
score: -2
possible better answer: http://stackoverflow.com/a/22650480
has comment: http://stackoverflow.com/comment/34499197
has answer: http://stackoverflow.com/a/22650480
favorite count: 0
has body: package edu.tests.model; /** * TestResult represents the grade on a test for one student. * * @author * @version */ public class TestResult { private String id; private int grade; /** * Creates a new instance of TestResult with the specified * ID of the student who took the test and the grade the * student earned. * * @requires id != null &amp;&amp; id.length() &gt; 0 &amp;&amp; grade &gt;= 0 * @ensures getId().equals(id) &amp;&amp; getGrade() == grade * * @param id the student's ID * @param grade the student's grade on the test */ public TestResult(String id, int grade) { this.id = id; this.grade = grade; } /** * Returns the ID of the student. * * @requires nothing * * @return the student's ID */ public String getId() { return this.id; } /** * Returns the grade earned by the student. * * @requires nothing * * @return the student's test grade */ public int getGrade() { return this.grade; } /** * Returns true if the specified object is a TestResult instance * with the same student ID, and false otherwise. * * @requires nothing * * @return true iff someObject is a TestResult with the same student ID */ @Override public boolean equals(Object someObject) { if (this == someObject) { return true; } if (someObject == null) { return false; } if (this.getClass() != someObject.getClass()) { return false; } TestResult aTestResult = (TestResult) someObject; return this.getId().equals(aTestResult.getId()); } } package edu.westga.tests.model; import java.util.ArrayList; /** * Gradebook represents the test results for all students who took a test. * * @author * @version */ public class Gradebook { // TODO #1: declare an instance variable called results, which is an // ArrayList of TestResult objects ArrayList&lt;TestResult&gt; results; /** * Creates a new Gradebook object with no test results. * * @requires nothing * @ensures size() = 0 */ // TODO#2: implement a constructor with 0 parameters that // initializes the instance variable as an empty ArrayList public Gradebook() { this.…
downvote count: 2
upvote count: 0
has answer: http://stackoverflow.com/a/22650499
accepted answer: http://stackoverflow.com/a/22650499
tagged with: each
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/34499186
tagged with: java
has title: For each loop in java
has comment: http://stackoverflow.com/comment/34499190
has comment: http://stackoverflow.com/comment/34499254
type: Question
answer count: 2
tagged with: for-loop
linked to: http://stackoverflow.com/q/85190

http://stackoverflow.com/a/22721346
downvote count: 0
has comment: http://stackoverflow.com/comment/34626645
answers question: http://stackoverflow.com/q/22721249
has body: Maybe something like this? ^&lt;[^&gt;]*&gt;\s*|&amp;nbsp; Java escaped: ^&lt;[^&gt;]*&gt;\\s*|&amp;nbsp; regex101 demo ^&lt;[^&gt;]*&gt;\\s* will match the first img tag and any following spaces. Then replace the &amp;nbsp;. The replacement string is "". You might want to use a proper HTML parser though, since it'll be less likely to break.
type: AcceptedAnswer
upvote count: 2
type: Answer
score: 2
has comment: http://stackoverflow.com/comment/34626625
accepted answer of: http://stackoverflow.com/q/22721249

http://stackoverflow.com/comment/34671426
comment on: http://stackoverflow.com/q/22746491
score: 0
type: Comment
type: QuestionComment
has text: @Ninja - please see my code above and advice on how to go about!

http://stackoverflow.com/comment/34695425
has text: If your program parsed options the way you expect it to, it would severely violate convention. Ask yourself if you really want your program to interpret quotes differently than every other program. That is not to mention that globbing will give confusing results to your users.
type: QuestionComment
type: Comment
score: 1
comment on: http://stackoverflow.com/q/22759408

http://stackoverflow.com/comment/81074822
type: AnswerComment
type: Comment
has text: I like this answer because then any external caller you don't write will automatically also be serializable. If you want objects submitted to be serializable, your interface should be serializable, which is kind of the point of an interface. However, the question did say "without creating a `SerializableRunnable` 'dummy' interface"
score: 4
comment on: http://stackoverflow.com/a/45699173

http://stackoverflow.com/comment/34585165
comment on: http://stackoverflow.com/a/22698282
score: 0
type: Comment
type: AnswerComment
has text: Please provide the CharSearch() implementation. I suspect that that method is not returning an array with any non-zero values. Also, there is no reason for you to preallocate the result arrays, like so: "int[] CountA = new int[200];", since the array value will be overwritten by whatever CharSearch() returns. There are many other improvement that can be made. By the way, please up-vote this answer if you feel it has helped you.

http://stackoverflow.com/a/22790335
answers question: http://stackoverflow.com/q/22790269
downvote count: 0
has comment: http://stackoverflow.com/comment/34750254
has body: fc1 is initialized, but fc is not.
has comment: http://stackoverflow.com/comment/34750323
has comment: http://stackoverflow.com/comment/34750136
has comment: http://stackoverflow.com/comment/34750082
has comment: http://stackoverflow.com/comment/34750224
type: Answer
has comment: http://stackoverflow.com/comment/34750336
has comment: http://stackoverflow.com/comment/34749946
upvote count: 1
score: 1
has comment: http://stackoverflow.com/comment/34750042
has comment: http://stackoverflow.com/comment/34750215
has comment: http://stackoverflow.com/comment/34750162
has comment: http://stackoverflow.com/comment/34750386

http://stackoverflow.com/a/22722007
type: Answer
has body: They are Unix timestamps, they are in seconds, so in order to get Java miliseconds you can do the following : int unixTime = 1259935150; Date time = new Date(unixTime*1000L);
accepted answer of: http://stackoverflow.com/q/22721966
score: 0
answers question: http://stackoverflow.com/q/22721966
type: AcceptedAnswer

http://stackoverflow.com/q/22790940
tagged with: attributes
favorite count: 0
has body: I am trying to create and update a RTC workitem by using plain Java API. I am able to set most of the attributes I need except "Found In". I tried something like: IAttribute FoundInAttribute = workItemClient.findAttribute(projectArea, "Found In" , null); wc.getWorkItem().setValue(FoundInAttribute, "The value I want to set"); And I got an exception saying setValue() is expecting an IDeliverableHandle object rather than String. How can I get the IDeliverableHandle I need? Thanks, Kane
upvote count: 1
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/22792499
score: 1
tagged with: java
tagged with: workitem
type: Question
tagged with: api
has title: How can I set value for "Found In" Attribute for a RTC workitem?
answer count: 1
downvote count: 0
accepted answer: http://stackoverflow.com/a/22792499
tagged with: rtc

http://stackoverflow.com/q/22692813
score: 0
has answer: http://stackoverflow.com/a/33696679
answer count: 1
has comment: http://stackoverflow.com/comment/34575576
has body: when using the ab.jar in eclipse I get the following error when trying to run the bot. “Could not find class ‘org.alicebot.ab.Bot’, referenced from method…”. The chat class is being imported but the bot class cannot be imported. Here is my code: import org.alicebot.ab.Bot; import org.alicebot.ab.Chat; import android.annotation.SuppressLint; import android.app.ActionBar.LayoutParams; import android.app.Activity; import android.os.Bundle; import android.view.View; import android.view.ViewTreeObserver; import android.widget.Button; import android.widget.EditText; import android.widget.LinearLayout; import android.widget.ScrollView; import android.widget.TextView; public class MainActivity extends Activity { String usertext; String response; String botname="MAVIS"; Bot mavis=new Bot(botname); Chat chat= new Chat(mavis); @Override protected void onCreate(Bundle savedInstanceState) { // TODO Auto-generated method stub super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); final LinearLayout ll1 = (LinearLayout) findViewById(R.id.ll1); final LinearLayout ll2 = (LinearLayout) findViewById(R.id.ll2); final ScrollView scv = (ScrollView) findViewById(R.id.sv); final Button btn = (Button) findViewById(R.id.button1); final EditText medit = (EditText) findViewById(R.id.editText1); btn.setOnClickListener(new View.OnClickListener() { @SuppressLint("NewApi") @Override public void onClick(View v) { TextView tvu=new TextView(v.getContext()); TextView tvb=new TextView(v.getContext()); TextView tvut=new TextView(v.getContext()); TextView tvbt=new TextView(v.getContext()); TextView tvdivider1=new TextView(v.getContext()); TextView tvdivider2=new TextView(v.getContext()); final LayoutParams lparams = new LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT); tvu.setLayoutParams(lparams); tvb.setLayoutParams(lparams); tvut.setLayoutParams(lparams); tvbt.setLayoutParams(lparams); tvdivider1.setLayoutParams(lparams); tvdivider2.setLayoutParams(lparams); user…
has comment: http://stackoverflow.com/comment/34574641
type: UnansweredQuestion
tagged with: java
type: Question
has title: Issue with program ab

file-io
tags question: http://stackoverflow.com/q/22705024
tags question: http://stackoverflow.com/q/22733614
tags question: http://stackoverflow.com/q/22705060
tags question: http://stackoverflow.com/q/22682061
tags question: http://stackoverflow.com/q/22732869
type: Tag
tags question: http://stackoverflow.com/q/22719711
tags question: http://stackoverflow.com/q/22769304
tags question: http://stackoverflow.com/q/22792449
tags question: http://stackoverflow.com/q/22690538
tags question: http://stackoverflow.com/q/22650669
tags question: http://stackoverflow.com/q/22654041
tags question: http://stackoverflow.com/q/22756853
tags question: http://stackoverflow.com/q/22678016
tags question: http://stackoverflow.com/q/22760722
tags question: http://stackoverflow.com/q/22704650
tags question: http://stackoverflow.com/q/22800029
tags question: http://stackoverflow.com/q/22730398
tags question: http://stackoverflow.com/q/22706406
tags question: http://stackoverflow.com/q/22675135
tags question: http://stackoverflow.com/q/22682384
tag name: file-io
tags question: http://stackoverflow.com/q/22707631
tags question: http://stackoverflow.com/q/22779928
tags question: http://stackoverflow.com/q/22695119

http://stackoverflow.com/comment/34645269
type: AnswerComment
score: 0
type: Comment
has text: IT'S WORKING! What I did: 1) Opened command prompt using "Run as administrator" 2) Went to the "bin" directory of Tomcat folder. 'cd C:\Program Files\apache-tomcat-8.0.3\bin' 3) Entered 'startup' to run 'startup.bat' and the server started 4) Opened a favourite web browser entered `http://localhost:8080/` and it worked like charm :) This way it also generated Tomcat log files too. The only different thing I performed is "Run as administrator". But I checked with Tomcat7 it did not require me to "Run as administrator" but it worked. WHY?
comment on: http://stackoverflow.com/a/22731066

http://stackoverflow.com/comment/34508038
comment on: http://stackoverflow.com/q/22655553
type: QuestionComment
type: Comment
has text: I don't get it. You're mocking the request, POSTing and then want to assert on attributes in the mocked request? What is your test case here?
score: 0

http://stackoverflow.com/comment/34531042
type: Comment
comment on: http://stackoverflow.com/a/22666568
type: AnswerComment
score: 0
has text: Thanks, this solved the problem. I couldn't get the Project JLabels to work (there was a typo in the code, btw, they weren't supposed to be the same). I ended up taking them out because they were mostly there to try to do what the invisible labels did. I also ended up taking off their insets, and I changed the weight of column 3 to 0.45 because the Search JButton was imbalancing things. So to summarize, the invisible row of columns fixed the columns and all other weightx constraints weren't needed. I didn't understand why the Project labels were made to fill the cell, but they're gone. Thanks!

http://stackoverflow.com/comment/34605882
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/22709889
has text: *"i just want"* So there is never going to be more data in that label? I had assumed it was tabular data. As an side, The behavior of a table **is to put everything at the top** (with no space).
score: 0

http://stackoverflow.com/comment/34805914
score: 0
has text: @eligdt I've updated the code, please check if it works for you
comment on: http://stackoverflow.com/a/22763803
type: Comment
type: AnswerComment

http://stackoverflow.com/comment/34729521
comment on: http://stackoverflow.com/a/22778059
score: 0
type: AnswerComment
type: Comment
has text: switch choice: case 1:

http://stackoverflow.com/comment/99660918
type: Comment
type: QuestionComment
has text: FYI: Here's a mapping table for JRockit JVM and HotSpot JVM options: https://docs.oracle.com/javacomponents/jrockit-hotspot/migration-guide/cloptions.htm -- Some of the dump options unfortunately only appear in the JRockit JVM column.
comment on: http://stackoverflow.com/q/22769799
score: 0

http://stackoverflow.com/q/22762372
has answer: http://stackoverflow.com/a/22777087
has title: Exception in Java Exception in thread "AWT-EventQueue-0" java.lang.NullPointerException
tagged with: nullpointerexception
tagged with: exception
type: UnansweredQuestion
tagged with: netbeans
has comment: http://stackoverflow.com/comment/34700086
type: Question
tagged with: java
has body: I made a program in Netbeans using the GUI builder and there it was running fine but when I copied the source code from Netbeans and pasted in Eclipse I am getting the following error. Exception in thread "AWT-EventQueue-0" java.lang.NullPointerException at javax.swing.ImageIcon.&lt;init&gt;(ImageIcon.java:205) at frame2.initComponents(frame2.java:100) at frame2.&lt;init&gt;(frame2.java:17) at frame2$5.run(frame2.java:671) at java.awt.event.InvocationEvent.dispatch(InvocationEvent.java:251) at java.awt.EventQueue.dispatchEventImpl(EventQueue.java:733) at java.awt.EventQueue.access$200(EventQueue.java:103) at java.awt.EventQueue$3.run(EventQueue.java:694) at java.awt.EventQueue$3.run(EventQueue.java:692) at java.security.AccessController.doPrivileged(Native Method) at java.security.ProtectionDomain$1.doIntersectionPrivilege(ProtectionDomain.java:76) at java.awt.EventQueue.dispatchEvent(EventQueue.java:703) at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:242) at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:161) at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:150) at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:146) at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:138) at java.awt.EventDispatchThread.run(EventDispatchThread.java:91) I searched it on net and found that I might had not initialized something which caused this exception. So here are the questions :- 1) If there is any exception why the program is running fine in Netbeans? 2) and how could I make this code run on Eclipse? here is the link of my code: http://pastebin.com/tVXjKZ9A And I had putted the image on the right place.
tagged with: eclipse
score: 0
answer count: 2
has answer: http://stackoverflow.com/a/22762607

http://stackoverflow.com/a/22861609
upvote count: 3
type: Answer
downvote count: 0
has comment: http://stackoverflow.com/comment/117326256
has body: Found the answer. I used instanceof keyword. if(Requestmessage instanceof TextMessage ) { // } if(Requestmessage instanceof BytesMessage) { // } if(Requestmessage instanceof ObjectMessage) { // } if(Requestmessage instanceof StreamMessage) { // }
score: 3
accepted answer of: http://stackoverflow.com/q/22661163
type: AcceptedAnswer
answers question: http://stackoverflow.com/q/22661163

http://stackoverflow.com/comment/34618527
type: AnswerComment
type: Comment
has text: the getSales() is a double. I'm reading the double in the while loop
comment on: http://stackoverflow.com/a/22716840
score: 0

http://stackoverflow.com/q/22780837
upvote count: 2
tagged with: java
type: UnansweredQuestion
score: 2
answer count: 0
downvote count: 0
tagged with: sts-springsourcetoolsuite
favorite count: 0
type: Question
has body: I am importing a project into the Spring Tool Suite (STS). My web.xml file is giving error: &lt;?xml version="1.0" encoding="UTF-8"?&gt; &lt;web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://java.sun.com/xml/ns/javaee" xmlns:web="http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd" version="2.5"&gt; &lt;context-param&gt; error : on line `***&lt;?xml version="1.0" encoding="UTF-8"?&gt;***` The errors below were detected when validating the file javaee_5.xsd via the file web.xml. In most cases these errors can be detected by validating javaee_5.xsd directly. However it is possible that errors will only occur when javaee_5.xsd is validated in the context of web.xml.
has title: Importing project in sts

http://stackoverflow.com/q/22798802
tagged with: drawing
favorite count: 0
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/27341040
tagged with: java
has body: How can I draw a curve using java graphics2D?
type: Question
has answer: http://stackoverflow.com/a/22798879
answer count: 2
tagged with: curve
has title: Drawing a curve in java Graphics2D
score: 0
upvote count: 1
tagged with: graphics2d
downvote count: 1

http://stackoverflow.com/a/22783792
downvote count: 0
score: 7
has comment: http://stackoverflow.com/comment/34738181
answers question: http://stackoverflow.com/q/22783010
has comment: http://stackoverflow.com/comment/34748208
accepted answer of: http://stackoverflow.com/q/22783010
upvote count: 7
type: AcceptedAnswer
has body: The conversions follow the usual rules for Standard SI Units: long nanoSeconds = ... double microSeconds = nanoSeconds / 1e3; double milliSeconds = microSeconds / 1e3; double seconds = milliSeconds / 1e3; // Shortcuts: double milliSeconds = nanoSeconds / 1e6; double sconds = nanoSeconds / 1e9; For some conversions, you can also have a look at the TimeUnit class: It allows conversions between values in different time units, for example long microSeconds = NANOSECONDS.toMicros(nanoSeconds); However, it unfortunately does not allow time spans given in double precision, but only as long values. An aside, also mentioned in the comments: Measuring time spans in the order of 10-15ms usually makes no sense due to the limited resolution of the internal timer.
type: Answer
has comment: http://stackoverflow.com/comment/34738057

http://stackoverflow.com/a/22771083
downvote count: 0
score: 1
has comment: http://stackoverflow.com/comment/34716511
answers question: http://stackoverflow.com/q/22771005
upvote count: 1
type: Answer
has body: You're ending your program after the sleep returns. Thread.sleep(5000); System.exit(0); Maybe you're looking for a loop of some kind. You haven't shown us what comes after the switch, but maybe that System.exit(0), which stops the java process, shouldn't be there.

http://stackoverflow.com/comment/34621305
has text: With `allocateDirect`, the buffer does *not* have an underlying array. But even if it has an array, you can not get a portion of an array in Java in general. So there is no way of doing this without copies. If you have the possibility to change the receiving method, you could give it a `bytebuffer.slice()`, which is a view on a portion of the byte buffer (namely, the portion between its current `position` and `limit` - which you can set accordingly before calling `slice`), or alternatively, let it receive the full `byte[]`, an `int position` and an `int length` (which is done often)
score: 1
type: QuestionComment
comment on: http://stackoverflow.com/q/22714917
type: Comment

http://stackoverflow.com/a/22796438
answers question: http://stackoverflow.com/q/22789442
has comment: http://stackoverflow.com/comment/34774572
has body: If you are seeing an error or warning in the source editor, but it does not show up in problems view, you have likely disabled automatic build. The markers in the problem view will only show up once the build runs. The markers in the source editor will be available shortly after you are done typing, regardless of the build. So.. Refresh the project Trigger clean build from the project menu The marker should show up at this point in the problems view Either turn automatic build on or remember to trigger the build manually when you want to look at the problems view
score: 0
type: Answer

http://stackoverflow.com/a/22685315
type: Answer
has comment: http://stackoverflow.com/comment/34561062
score: 0
answers question: http://stackoverflow.com/q/22685177
has comment: http://stackoverflow.com/comment/34561188
has body: String data = "AU_201403251160_4_7_B-4-7-001.jpg"; System.out.println(data.substring(data.indexOf("-") - 1, data.length())); output: B-4-7-001.jpg

http://stackoverflow.com/q/22711822
has body: I am writing 3 methods which can print an input string vertically (one line). But I am unaware of the best method since benchmarking with System.nanoTime() considerably changes with large variations, I mean if I calculate the time difference between start and end of the process. Please suggest which is best or better, opine what you think according to your knowledge. Code snippet #1 /** * Prints all the characters in the argument string vertically using loop * @param str */ public static void toVertStringLoop(String str){ if(str != null &amp;&amp; !"".equals(str)){ int strLen = str.length(); for (int i=0; i&lt;strLen; i++){ System.out.println(str.charAt(i)); } } } Code snippet #2 /** * Prints all the characters in the argument string vertically using recursion * @param str */ public static void toVertStringRecur(String str){ if (str != null &amp;&amp; !"".equals(str)){ System.out.println(str.charAt(0)); //print the first character toVertStringRecur(str.substring(1, str.length())); //recursively call removing the first character } } Code snippet #3 /** * Prints all the characters in the argument string vertically using for-each loop * @param str */ public static void toVerticalStringIterator(String str){ //for-each loop needs array or Iterator instance for(char ch : str.toCharArray()){ System.out.println(ch); } }
type: Question
has answer: http://stackoverflow.com/a/22712417
accepted answer: http://stackoverflow.com/a/22712417
has title: Printing a string vertically! Which is best approach in time and complexity?
has comment: http://stackoverflow.com/comment/34609124
has comment: http://stackoverflow.com/comment/34608959
has comment: http://stackoverflow.com/comment/34609003
has comment: http://stackoverflow.com/comment/34609056
has comment: http://stackoverflow.com/comment/34608894
score: 0
linked to: http://stackoverflow.com/q/256859
answer count: 1
has comment: http://stackoverflow.com/comment/34609095
tagged with: string
has comment: http://stackoverflow.com/comment/34608899
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/34608962
has comment: http://stackoverflow.com/comment/34609199
tagged with: java

jgrapht
tags question: http://stackoverflow.com/q/22772228
tags question: http://stackoverflow.com/q/22703918
tags question: http://stackoverflow.com/q/22669614
tags question: http://stackoverflow.com/q/22792787
tags question: http://stackoverflow.com/q/22702994
tag name: jgrapht
tags question: http://stackoverflow.com/q/22673792
type: Tag

http://stackoverflow.com/comment/34712113
score: 0
type: Comment
type: QuestionComment
has text: @SQLiteNoob If I remove the fragment and remove the extra code that belongs to actionbar in Mainactivity.java I get R cannot be resolved to a variable etc .. This problem drove me mad since I have been looking for a solution for days
comment on: http://stackoverflow.com/q/22769016

keyboard
tags question: http://stackoverflow.com/q/22786282
tag name: keyboard
tags question: http://stackoverflow.com/q/22670649
tags question: http://stackoverflow.com/q/22729920
tags question: http://stackoverflow.com/q/22796767
tags question: http://stackoverflow.com/q/22657100
tags question: http://stackoverflow.com/q/22676865
tags question: http://stackoverflow.com/q/22677699
tags question: http://stackoverflow.com/q/22807892
tags question: http://stackoverflow.com/q/22788639
type: Tag
tags question: http://stackoverflow.com/q/22719228
tags question: http://stackoverflow.com/q/22654937

http://stackoverflow.com/comment/34735972
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/22782493
has text: Issue is only teacher object mapped to lecture set. can you post your table structure please.

http://stackoverflow.com/comment/34571748
type: QuestionComment
comment on: http://stackoverflow.com/q/22691435
type: Comment
has text: Try increasing the number of items to a million at least. It might be that the this amount of items is not enough for HotSpot to kick in...
score: 1

http://stackoverflow.com/comment/34765165
has text: @Sempus yes, you can. But as you noted in your question content, it is kinda ridiculous.
type: AnswerComment
type: Comment
score: 2
comment on: http://stackoverflow.com/a/22798540

http://stackoverflow.com/comment/34774830
type: QuestionComment
has text: It is not a duplicate question, what we do when we have nxn dimensional array ??
score: 0
comment on: http://stackoverflow.com/q/22804048
type: Comment

http://stackoverflow.com/q/22742282
has answer: http://stackoverflow.com/a/22742393
upvote count: 3
answer count: 2
favorite count: 0
has answer: http://stackoverflow.com/a/22742312
type: UnansweredQuestion
score: 3
downvote count: 0
tagged with: java
has body: How do I implement lru_cache annotation in java 7 using 'concurrent hashmap' / 'guava caching' internally? Example usage : @lru_cache(maxsize=10000) public String someIOHeavyMethod(String x){ String toBeReturned; /* * IO heavy operations to compute toBeReturned string */ return toBeReturned; }
type: Question
has title: java 7 equivalent of @lru_cache annotation from of python 3.2

http://stackoverflow.com/a/29141241
has body: This worked for me: 1) remove spaces from the path to android.jar (all the fixes I tried to allow it to work with spaces didn't work for me) 2) Choose Project/Generate Javadoc... 3) Enter correct path to the javadoc executable, which, in my case looked like this: 4) Click next and enter a document title 5) Click next and add bootclasspath to the VM options. I did a search on my mac to find the android.jar. Make sure you use the correct location and version. Mine looked like this: 6) Click finish and it should work. Hope that helps :-)
answers question: http://stackoverflow.com/q/22785896
score: 0
type: Answer

http://stackoverflow.com/comment/138599725
type: Comment
score: 0
has text: This will modify the collection, which is probably undesired.
type: AnswerComment
comment on: http://stackoverflow.com/a/57368831

http://stackoverflow.com/q/22724576
has comment: http://stackoverflow.com/comment/34634271
score: 0
tagged with: android
has title: App Development - Logcat errors and "Unfortunately <app> has stopped"
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/22724789
has body: I'm working on an independent app and am following some basic tutorials. From what I can tell, the code is virtually the same as the guides I'm following, but when I try to run the application on the emulator, I'm getting the "unfortunately has stopped working" message. I'm having some difficulty interpreting the errors in the logcat because a lot of the directed lines of code are the default code created when I started the new files. Any help would be appreciiated, thanks 03-28 18:45:27.390: D/FragmentManager(1033): mCreated=truemResumed=false mStopped=false mReallyStopped=false 03-28 18:45:27.390: D/FragmentManager(1033): mLoadersStarted=false 03-28 18:45:27.400: D/FragmentManager(1033): Active Fragments in b3d357b8: 03-28 18:45:27.400: D/FragmentManager(1033): #0: PlaceholderFragment{b3d35b68 #0 id=0x7f06003c} 03-28 18:45:27.400: D/FragmentManager(1033): mFragmentId=#7f06003c mContainerId=#7f06003c mTag=null 03-28 18:45:27.400: D/FragmentManager(1033): mState=0 mIndex=0 mWho=android:fragment:0 mBackStackNesting=0 03-28 18:45:27.400: D/FragmentManager(1033): mAdded=true mRemoving=false mResumed=false mFromLayout=false mInLayout=false 03-28 18:45:27.400: D/FragmentManager(1033): mHidden=false mDetached=false mMenuVisible=true mHasMenu=false 03-28 18:45:27.400: D/FragmentManager(1033): mRetainInstance=false mRetaining=false mUserVisibleHint=true 03-28 18:45:27.400: D/FragmentManager(1033): mFragmentManager=FragmentManager{b3d357b8 in MainActivity{b3d34660}} 03-28 18:45:27.400: D/FragmentManager(1033): mActivity=com.example.cooldog.MainActivity@b3d34660 03-28 18:45:27.400: D/FragmentManager(1033): Added Fragments: 03-28 18:45:27.400: D/FragmentManager(1033): #0: PlaceholderFragment{b3d35b68 #0 id=0x7f06003c} 03-28 18:45:27.410: D/FragmentManager(1033): FragmentManager misc state: 03-28 18:45:27.410: D/FragmentManager(1033): mActivity=com.example.cooldog.MainActivity@b3d34660 03-28 18:45:27.170: D/dalvikvm(1033): GC_FOR_ALLOC freed 83K, 6% free 2860K/3012K, paused 52m…
tagged with: java
tagged with: eclipse
has comment: http://stackoverflow.com/comment/34632710
type: Question
answer count: 2
linked to: http://stackoverflow.com/q/7508044
has answer: http://stackoverflow.com/a/22737734

http://stackoverflow.com/q/22746822
has answer: http://stackoverflow.com/a/22746844
type: UnansweredQuestion
tagged with: android
has body: my name is Dan and I am trying to invoke a click on a HTML element through code in my Android application. If I try to click it through pure Javascript the result won't be the same as it is when the user clicks it. So, how to press elements from a Webview component through Java code? Thanks in advance.
tagged with: java
type: Question
tagged with: javascript
has title: Invoke click through code in Webview
score: 0
answer count: 1

http://stackoverflow.com/comment/34520356
type: Comment
type: QuestionComment
has text: Thanks, that looks useful. Can the same thing be implemented using JPA on top of hibernate? (I'm looking into it now, just asking in parallel).
comment on: http://stackoverflow.com/q/22662453
score: 0

button
tags question: http://stackoverflow.com/q/22767495
tags question: http://stackoverflow.com/q/22734962
tags question: http://stackoverflow.com/q/22732602
tags question: http://stackoverflow.com/q/22788693
tags question: http://stackoverflow.com/q/22786203
tags question: http://stackoverflow.com/q/22793305
tags question: http://stackoverflow.com/q/22677169
type: Tag
tags question: http://stackoverflow.com/q/22710841
tags question: http://stackoverflow.com/q/22747069
tags question: http://stackoverflow.com/q/22735326
tags question: http://stackoverflow.com/q/22663012
tag name: button

http://stackoverflow.com/q/22760230
has comment: http://stackoverflow.com/comment/34695965
has answer: http://stackoverflow.com/a/22760332
tagged with: java
has body: So I know normally to create a generic array you could do: E[] e = (E[]) new Object[10]; However I have a class Entrant&lt;K, V&gt; which has two generic parameters. I can't seem to be able to cast an Object array to it. Here is the full code and error at runtime Exception in thread "main" java.lang.ClassCastException: [Ljava.lang.Object; cannot be cast to [LHashTable.Entrant; at HashTable.HashTable.&lt;init&gt;(HashTable.java:10) at Mainy.map(Mainy.java:32) line 32 in Mainy : HashTable h = new HashTable(); Hashtable code: public class HashTable&lt;K, V&gt; { Entrant&lt;K, V&gt;[] _entrants; private static final int N = 16; public HashTable() { _entrants = (Entrant&lt;K, V&gt;[]) new Object[N]; //line 10 } }
has title: Java - Creating array of an object with generic parameters
tagged with: arrays
downvote count: 0
has answer: http://stackoverflow.com/a/22760314
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/34696015
linked to: http://stackoverflow.com/q/1817524
score: 1
tagged with: generics
favorite count: 0
linked to: http://stackoverflow.com/q/529085
linked to: http://stackoverflow.com/q/18581002
type: Question
answer count: 2
upvote count: 1

http://stackoverflow.com/q/22723999
has title: Force Audio into mic
has comment: http://stackoverflow.com/comment/34648199
has comment: http://stackoverflow.com/comment/34631668
score: 0
has body: I am looking for a way to take audio data and either send it into the default recording device like a stereo mix or create another virtual audio device.I am using Java(eclipse). I have looked into JMF, but i don't understand how i would send audio to a device. Please let me know if there is a library more suited for this project, and how to implement it. **I Would like to create an audio source, so that a program that uses a microphone like skype may use it. Example:I press a button on a sound board and it plays to the other callers.
tagged with: device
answer count: 1
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/34631636
tagged with: audio
has comment: http://stackoverflow.com/comment/69704614
tagged with: java
has answer: http://stackoverflow.com/a/41244463
type: Question

http://stackoverflow.com/comment/35113208
type: Comment
comment on: http://stackoverflow.com/a/22989792
score: 0
type: AnswerComment
has text: Thanks for the reply. But as i have said in my update,I downloaded a fresh copy of Eclipse(Kepler) and installed the scala plugins,then compiled my application,there was no error message of any sort displayed. So i think based on this,the error cannot be in my memory allocation or with my JVM.

http://stackoverflow.com/comment/49272293
has text: Very interesting. I'm assuming you had to add the annotation to the `MongoTestCfg extends AbstractMongoConfiguration` class? (Oh, and don't forget to mark this as the accepted answer.)
type: AnswerComment
comment on: http://stackoverflow.com/a/22770376
score: 0
type: Comment

http://stackoverflow.com/comment/34702353
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/22696741
score: 0
has text: I'd like you to post a small example we can reproduce of a how your are generating the object your method returns.

notnull
type: Tag
tags question: http://stackoverflow.com/q/22708924
tag name: notnull

http://stackoverflow.com/a/22672824
answers question: http://stackoverflow.com/q/22672075
score: 9
accepted answer of: http://stackoverflow.com/q/22672075
type: AcceptedAnswer
upvote count: 9
has body: In short - yes, it burdens the RegionServer if you set blockcaching to true in mapreduce jobs . When you are using mapreduce jobs mostly on input scans , its high probability that the recently scanned input is going to be discarded in next map phase. Blockcache is LRU.. It puts data into Blockcache during first request , then finds that its of no usage in second request and swaps it and the process continues. So the RegionServer is continuosly swapping data in and out of BlockCache for no gain. Its just a lot of unnecessary IO usage. But in case of normal reading , it's advisable to keep it true to gain from data locality.
type: Answer
downvote count: 0

http://stackoverflow.com/q/22668417
has body: I am trying to figure out how to determine the complexity(array accesses) of certain simple methods. I'd like some confirmation if I'm doing this right. For example this method. int i = 0; while(i &lt; N){ clone[i][j] = clone[++i][j]; clone[i][j] = 0; } Do the array accesses sum up to three here? One forclone[i][j] another for clone[++i][j] and lastly another one for clone[i][j]. Meaning this has ± 3N array accesses? How about something like this: if(clone[i][j] == value1 || clone[i][j] == value2) Can I consider this to be one array access, or two? Thanks in advance!
tagged with: complexity-theory
accepted answer: http://stackoverflow.com/a/22669458
has comment: http://stackoverflow.com/comment/34531211
type: AnsweredQuestion
tagged with: java
has title: Counting array accesses
type: Question
tagged with: arrays
has answer: http://stackoverflow.com/a/22669458
score: 0
has comment: http://stackoverflow.com/comment/34531493
answer count: 1

http://stackoverflow.com/q/22668528
upvote count: 25
tagged with: java
answer count: 3
has body: Consuming google play in-app products can easily be done from the client application (http://developer.android.com/google/play/billing/api.html#consume). However I can't find any information about doing this consume request from a backend server. The Purchase Status API (http://developer.android.com/google/play/billing/gp-purchase-status-api.html) is designed to be used from backend servers, however it doesn't provide any methods to consumes in-app products. Is there a way to consume google play in-app products from backend server?
has comment: http://stackoverflow.com/comment/81675175
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/40853333
has answer: http://stackoverflow.com/a/75741866
score: 25
has title: Is there a way to consume google play in-app products from backend server?
has answer: http://stackoverflow.com/a/26403130
has comment: http://stackoverflow.com/comment/40803695
downvote count: 0
favorite count: 0
type: Question
tagged with: google-play
tagged with: android
tagged with: in-app-purchase
has answer: http://stackoverflow.com/a/61498428

http://stackoverflow.com/comment/34597544
type: QuestionComment
comment on: http://stackoverflow.com/q/22705273
score: 0
type: Comment
has text: What have you tried so far? Although I can't quite fully extract the meaning, you have a fully realized algorithm as text, you should first take a stab at solving this yourself. Or, post how far you've been able to get, and folks here can help you with your current progress. As stated, however, your question is not clear.

http://stackoverflow.com/comment/53535870
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/22793119
has text: @BrettRyan: I do not agree. `AtomicInteger` expresses the wrong intent, it is less efficient, and the _sequential execution_ is guaranteed in this case.
score: 1

http://stackoverflow.com/q/22720300
has title: Accessing an object's method from a List.
type: UnansweredQuestion
tagged with: list
tagged with: java
type: Question
has body: Below is my code for my DList that takes in objects. It prints out everything fine except for the last print statement. "System.out.println((int)(list.head.next.next.next.item.getItem()));" Why is that? And how to fix it? /* DList1.java */ /** * A DList1 is a mutable doubly-linked list. (No sentinel, not * circularly linked.) */ public class DList1 { /** * head references the first node. * tail references the last node. * * DO NOT CHANGE THE FOLLOWING FIELD DECLARATIONS. */ protected DListNode1 head; protected DListNode1 tail; protected long size; public DList1() { head = null; tail = null; size = 0; } public DList1(Object a) { head = new DListNode1(); tail = head; head.item = a; size = 1; } public DList1(Object a, Object b) { head = new DListNode1(); head.item = a; tail = new DListNode1(); tail.item = b; head.next = tail; tail.prev = head; size = 2; } public void insertFront(Object i) { DListNode1 temp = new DListNode1(i); if (size == 0) { head = temp; tail = temp; } else { temp.next = head; head.prev = temp; head = temp; } size++; } public void insertEnd(Object i) { DListNode1 temp = new DListNode1(i); if (size == 0) { head = temp; tail = temp; } else { tail.next = temp; temp.prev = tail; tail = temp; } size++; } public void removeFront() { if (size == 0) { return; } else if (size == 1) { head = null; tail = null; size--; } else { head = head.next; head.prev = null; size--; } } public String toString() { String result = "[ "; DListNode1 current = head; while (current != null) { result = result + current.item + " "; current = current.next; } return result + "]"; } public static void main(String[] args) { int[] array = new int[2]; array[0] = 3; array[1] = 4; int m = 1; String g = "hi"; String s = "boo"; String z = "foo"; DList1 list = new DList1(m); tobject jim = new tobject(); //list.insertFront(g); list.insertEnd(s); list.insertEnd(g); list.insertEnd(jim); System.out.println((list.head.item)); System.out.println((list.head.next.item)); System.out.println((list.hea…
has answer: http://stackoverflow.com/a/22720522
has answer: http://stackoverflow.com/a/22720532
score: 0
answer count: 2
has comment: http://stackoverflow.com/comment/34624952
has comment: http://stackoverflow.com/comment/34624797

http://stackoverflow.com/comment/34652545
score: 1
has text: Don't confuse _declaration_ and _initialization_. Also careful that you don't _shadow_ the variable. (Those are all keywords.)
comment on: http://stackoverflow.com/q/22736092
type: QuestionComment
type: Comment

http://stackoverflow.com/comment/36751908
type: Comment
comment on: http://stackoverflow.com/a/22775822
has text: I appreciate it, and I will certainly add that detail to my question
score: 0
type: AnswerComment

http://stackoverflow.com/q/22804076
has comment: http://stackoverflow.com/comment/34774726
favorite count: 0
has body: I have an XML file which contains some attributes and their types and also id.Now i have used apache commons configuration to read them from that XML and i am showing the output in the console from where i have to use the attributes for a database.So the problem is that i am getting all the values from that XML but the values are not coming in order..i.e &lt;records name=""&gt; &lt;tag id = "1" name= "studentId" type="String"/&gt; &lt;tag id = "2" name= "StudentName" type= "String"/&gt; &lt;tag id = "3" name= "StudentType" type= "String"/&gt; &lt;tag id = "4" name= "recordType" type= "String"/&gt; ..... This is the structure of the xml but when i am running my program i am not getting values sequentially i.e values are not coming in order.But i need the values in order.My code is here public class uu { public static void main(String[] args) { FmtConfig config = null; try { config = FmtConfig.instance(); } catch (ConfigurationException e) { e.printStackTrace(); } Records record = config.getRecord(); System.out.println(record.getName()); for(String tagName : record.getAllTags().keySet()){ com.etl.core.model.fmtg.Tag t = record.getAllTags().get(tagName); System.out.println("id : "+t.getId()+" name : "+t.getName()+" type : "+t.getType()); } How i can get values in order someone please help....
tagged with: http://stackoverflow.com/tag/xml
has comment: http://stackoverflow.com/comment/34774954
answer count: 0
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/34774907
downvote count: 0
has comment: http://stackoverflow.com/comment/34774688
score: 1
tagged with: java
has title: How to get element sequentially from a xml file to java
has comment: http://stackoverflow.com/comment/34775283
type: Question
upvote count: 1

http://stackoverflow.com/a/22779007
downvote count: 0
has comment: http://stackoverflow.com/comment/34730405
type: Answer
has body: I assume you are trying to use MTOM+XOP? The first error is clear: you have no boundary. A multipart is more than simply a content-type, it requires you to mark the different parts with a boundary that has to be declared in the headers and requires linefeeds etc to be in the correct place. Secondly, you can't just send a file to a SOAP endpoint if that is what you are trying to do, you need to have a soap body in the first part that references the file in the second part.
score: 1
has comment: http://stackoverflow.com/comment/34730630
upvote count: 1
answers question: http://stackoverflow.com/q/22776981
has comment: http://stackoverflow.com/comment/34730904

http://stackoverflow.com/comment/34659651
type: Comment
has text: You can for loop to achieve that.
comment on: http://stackoverflow.com/a/22650691
score: 0
type: AnswerComment

email
tags question: http://stackoverflow.com/q/22762763
tags question: http://stackoverflow.com/q/22777571
tags question: http://stackoverflow.com/q/22705188
tags question: http://stackoverflow.com/q/22765364
tags question: http://stackoverflow.com/q/22693471
tags question: http://stackoverflow.com/q/22756486
tags question: http://stackoverflow.com/q/22801570
tags question: http://stackoverflow.com/q/22778480
tags question: http://stackoverflow.com/q/22650682
tags question: http://stackoverflow.com/q/22772876
tags question: http://stackoverflow.com/q/22766116
tags question: http://stackoverflow.com/q/22743770
tags question: http://stackoverflow.com/q/22783744
tags question: http://stackoverflow.com/q/22707514
tags question: http://stackoverflow.com/q/22665776
type: Tag
tag name: email

http://stackoverflow.com/a/22743508
has comment: http://stackoverflow.com/comment/83371654
score: 72
has comment: http://stackoverflow.com/comment/83365840
type: Answer
has body: Just flatMap it: public static void main(final String[] args) throws Exception { final Stream&lt;String&gt; stream1 = /*some stream*/ final Stream&lt;String&gt; stream2 = /*some stream*/ final Stream&lt;String&gt; stream3 = /*some stream*/ final Stream&lt;String&gt; stream4 = /*some stream*/ final Stream&lt;String&gt; stream5 = /*some stream*/ final Stream&lt;String&gt; stream = Stream.of(stream1, stream2, stream3, stream4, stream5).flatMap(Function.identity()); } In your example: Stream&lt;Integer&gt; resultStream = Stream.of(stream1, stream2, Stream.of(element)) .flatMap(identity()) .filter(x -&gt; x != 0) .filter(x -&gt; x != 1) .filter(x -&gt; x != 2);
has comment: http://stackoverflow.com/comment/83365891
answers question: http://stackoverflow.com/q/22743425
upvote count: 73
downvote count: 1

http://stackoverflow.com/comment/34700278
type: Comment
has text: If yoy are catching in servlet, then managing in jsp doesn't seem valid
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/22751991

http://stackoverflow.com/q/22683492
type: Question
has title: Confusions regarding apache server log?
has answer: http://stackoverflow.com/a/22684419
tagged with: apache
answer count: 1
tagged with: tomcat
tagged with: java-io
score: 0
accepted answer: http://stackoverflow.com/a/22684419
tagged with: netbeans
has body: I am writing a program to print the contents of the 'apache server log' on the console.But I find nothing on the \Apache Software Foundation\Apache Tomcat 7.0.34\logs. I am using apache with netbeans and there is also nothing in apache tomcat 7.0.34 log window on netbeans. How to configure that? P.S- apache is successfully running and I can connect to the port where it is running with other computers and I am using win 7
type: AnsweredQuestion
tagged with: java

http://stackoverflow.com/comment/34655958
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/22737993
score: 1
has text: @tanishalfelven: please see my edit, the one that begins, "oh chit".

http://stackoverflow.com/a/22687265
accepted answer of: http://stackoverflow.com/q/22684740
has comment: http://stackoverflow.com/comment/34566677
type: AcceptedAnswer
downvote count: 0
type: Answer
score: 6
answers question: http://stackoverflow.com/q/22684740
upvote count: 6
has body: The short answer is yes, you can hold, instantiate, and pass Java objects in a native layer via JNI. In the jni documentation, you will find functions that will do this for you. http://docs.oracle.com/javase/7/docs/technotes/guides/jni/spec/functions.html You will also Use javap -s and javah to assist in finding your java method signatures for use in jni and to make your jni headers. See http://docs.oracle.com/javase/7/docs/technotes/tools/windows/javap.html &amp; http://docs.oracle.com/javase/7/docs/technotes/tools/windows/javah.html Here is a sample of what you will be doing. I haven't tested it, so just use it as a reference for writing your own. Note: be aware of package notations(I've assumed no package) &amp; Exceptions. Exceptions can happen on any JNI call(env-&gt;...), so check the documentation on how to deal with exceptions(ExceptionCheck, ExceptionDescribe, ExceptionClear). JavaVM * savedVM = NULL; JNIEXPORT void JNICALL Java_NativeClass_addListener(JNIEnv *env, jobject obj_instance, jobject listener_instance) { env-&gt;GetJavaVM( &amp;savedVM ); //save listener_instance for use later saved_listener_instance = listener_instance; } void doSomething() { //Get current thread JNIEnv JNIEnv * ENV; int stat = savedVM-&gt;GetEnv((void **)&amp;ENV, JNI_VERSION_1_6); if (stat == JNI_EDETACHED) //We are on a different thread, attach savedVM-&gt;AttachCurrentThread((void **) &amp;ENV, NULL); if( ENV == NULL ) return; //Cant attach to java, bail //Get the Listener class reference jclass listenerClassRef = ENV-&gt;GetObjectClass( saved_listener_instance ); //Use Listener class reference to load the eventOccurred method jmethodID listenerEventOccured = ENV-&gt;GetMethodID( listenerClassRef, "eventOccurred", "(LInfo;)V" ); //Get Info class reference jclass infoClsRef = ENV-&gt;FindClass( "Info" ); //Create Info class jobject info_instance = ENV-&gt;NewObject( infoClsRef, ..... );//For you to fill in with your arguments //invoke listener eventOccurred ENV-&gt;CallVoidMe…

http://stackoverflow.com/q/22761945
score: 0
has body: I am trying to run mapReduce using Spring Data Mongo as per the documentation http://docs.spring.io/spring-data/data-mongodb/docs/1.0.0.M5/reference/html/ I have run into trouble loading the javascript files. When I include my map.js and reduce.js files the newlines are there for example \n\r\t etc. I used this online tool http://jscompress.com/ to compress the file into one line. The Files are then loaded but I get an error: org.springframework.dao.InvalidDataAccessApiUsageException: Command execution failed: Error [ns doesn't exist], Caused by: com.mongodb.CommandFailureException: { "serverUsed" : "/127.0.0.1:27017" , "ok" : 0.0 , "errmsg" : "ns doesn't exist"} at com.mongodb.CommandResult.getException(CommandResult.java:71) at com.mongodb.CommandResult.throwOnError(CommandResult.java:110) at org.springframework.data.mongodb.core.MongoTemplate.handleCommandError(MongoTemplate.java:1814) ... 32 more I have tried loading the files as strings and escaping the javascript. The same javascript works well using the mongo driver ie. MongoClient mongoClient = new MongoClient("localhost", 27017); DB db = mongoClient.getDB("product_data"); DBCollection catalogData = db.getCollection("catalogData"); MapReduceCommand cmd = new MapReduceCommand(catalogData, stringMap, stringReduce, "map_reduce_java_test", MapReduceCommand.OutputType.REPLACE, null); catalogData.mapReduce(cmd); and this does not work: mongoOperations.mapReduce("catalogData", stringMap, stringReduce, new MapReduceOptions().outputCollection("map_reduce_java_test") .finalizeFunction(stringFinalize).outputTypeReplace(), CatalogItem.class); any help or ideas are appreciated.
answer count: 1
tagged with: spring-data-mongodb
tagged with: spring
has title: Spring Data Mongo MapReduce javascript not being escaped
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/22913581
type: Question
tagged with: java
has answer: http://stackoverflow.com/a/22913581

http://stackoverflow.com/comment/39468160
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/22767138
has text: This is perfectly valid. http://docs.oracle.com/javase/7/docs/api/java/sql/ResultSet.html#getString(int)
score: 0

http://stackoverflow.com/comment/34745883
type: AnswerComment
comment on: http://stackoverflow.com/a/22788138
type: Comment
has text: Yup, just realized that :D. Just downloaded it, and it works... Thanks anyway!
score: 0

http://stackoverflow.com/comment/34673485
has text: I did that but I cannot parse from String to Int, I get an error while trying to convert with an enhanced for loop
comment on: http://stackoverflow.com/a/22744119
type: AnswerComment
score: 0
type: Comment

http://stackoverflow.com/a/22741672
has comment: http://stackoverflow.com/comment/34662354
has body: in activity_action.xml &lt;menu xmlns:android="http://schemas.android.com/apk/res/android" xmlns:(YOUR_PROJECT_NAME)="http://schemas.android.com/apk/res-auto" &gt; &lt;!-- Search, should appear as action button --&gt; &lt;item android:id="@+id/action_search" android:orderInCategory="100" android:icon="@drawable/ic_action_search" android:title="@string/action_search" YOUR_PROJECT_NAME:showAsAction="always" /&gt;
type: AcceptedAnswer
downvote count: 0
answers question: http://stackoverflow.com/q/22741606
type: Answer
score: 2
upvote count: 2
has comment: http://stackoverflow.com/comment/34662520
has comment: http://stackoverflow.com/comment/34662341
accepted answer of: http://stackoverflow.com/q/22741606

http://stackoverflow.com/comment/34633388
has text: I've been advised to pass the string instead of retrieving it again in the SingleListActivity since it is faster. Also, for some reason when I only pass the email the App just stops.
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/22724871

http://stackoverflow.com/comment/34722852
type: AnswerComment
type: Comment
has text: @cistearns ah, fixed thanks, actually had no idea, well, learned something. based on what I know from other languages with switch-fallthrough though, it still is bad practice because it is much more difficult to read the behavior of a switch statement with unclear breaks.
comment on: http://stackoverflow.com/a/22774894
score: 0

http://stackoverflow.com/q/22808261
has comment: http://stackoverflow.com/comment/34804714
has comment: http://stackoverflow.com/comment/34817237
score: -1
upvote count: 2
downvote count: 3
answer count: 1
has title: Implementing a context aware dialogue system
favorite count: 0
tagged with: artificial-intelligence
tagged with: nlp
has comment: http://stackoverflow.com/comment/34845438
type: UnansweredQuestion
has body: Any help on designing an open domain context aware conversational system is appreciated. Any architecture, papers or available open source api's would suffice. Basic idea is to maintain a stack of domains based on which the communication proceeds. Like If I am using the same as a QA system, if my area of question is Movie, the responses could be more tailor made to the movie domain. Thanks in advance.
tagged with: java
has answer: http://stackoverflow.com/a/22828866
type: Question

http://stackoverflow.com/comment/34800636
type: Comment
comment on: http://stackoverflow.com/q/22731864
has text: @Vadzim: yes. was thinkign about debugging JSP
score: 0
type: QuestionComment

http://stackoverflow.com/comment/34656381
comment on: http://stackoverflow.com/a/22738264
score: 0
type: AnswerComment
type: Comment
has text: I don't get it. You mean using a network connection in a code ? I don't follow.. Maybe I was not clear ? What I mean is what can I use in my java code to read the .txt file if he's not in my project root but on a VM this time ? Because I guess this time I won't be able to use what's in my code right ?

http://stackoverflow.com/comment/34577260
score: 0
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/22694137
has text: And what if the user has an access to network, but disabled location access through wifi and network in system preferences?..

http://stackoverflow.com/a/22787611
downvote count: 0
type: Answer
answers question: http://stackoverflow.com/q/22787203
score: 2
has comment: http://stackoverflow.com/comment/34744911
upvote count: 2
has body: How about assigning a random number to each element of the array, arrange the random numbers in order and in that order read the element of the array assigned to that random number 0.64342 0 0.95229 1 0.23047 2 0.82793 3 0.19014 4 0.18528 5 0.15684 6 0.99546 7 0.54524 8 0.90612 9 Order 0.15684 6 0.18528 5 0.19014 4 0.23047 2 0.54524 8 0.64342 0 0.82793 3 0.90612 9 0.95229 1 0.99546 7 numbers 0 to 9 now in random order

http://stackoverflow.com/a/22676981
has comment: http://stackoverflow.com/comment/34546342
accepted answer of: http://stackoverflow.com/q/22676950
answers question: http://stackoverflow.com/q/22676950
has comment: http://stackoverflow.com/comment/34546227
has body: Put it in pageContext &lt;% pageContext.setAttribute("gn", gn); %&gt; and then access it like ${gn} or change &lt;% String gn = generateKey(SelectedIndex, key, itt); %&gt; to &lt;!% String gn = generateKey(SelectedIndex, key, itt); %&gt; Also See why business logic should be moved out of JSP?
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/34546238
score: 0
type: Answer

http://stackoverflow.com/a/22722737
answers question: http://stackoverflow.com/q/22722682
score: 2
downvote count: 0
has comment: http://stackoverflow.com/comment/34629631
type: Answer
has body: You may want to use a HashSet Deletion, insertion are in general in constant time, as stated by the official API : This class offers constant time performance for the basic operations (add, remove, contains and size), assuming the hash function disperses the elements properly among the buckets If you decide to use a HashSet, don't forget to override both equals AND hashcode methods in your object.
upvote count: 2
has comment: http://stackoverflow.com/comment/34629385

http://stackoverflow.com/a/22762617
type: AcceptedAnswer
has body: The purpose of having a Model-View-Controller architecture is to be able to separate the model (how you represent the data) from the view (how you display it) and the controller (how you act on it). This means that a well-designed program can often use the same model for multiple interfaces, especially when the model is designed as its own library. That said, these days it's probably easier to maintain a single HTML UI and use a browser interface even if the program is locally installed. Correct; the user of a Web application is interacting with it over HTTP, and the interface is in HTML, JavaScript, and CSS. The way that you run your application on your own server (with Spring MVC or anything else) doesn't matter to the client, which just needs a Web browser.
type: Answer
accepted answer of: http://stackoverflow.com/q/22762408
answers question: http://stackoverflow.com/q/22762408
score: 0

http://stackoverflow.com/q/22792097
upvote count: 1
type: Question
has answer: http://stackoverflow.com/a/22792788
tagged with: arrays
downvote count: 0
has comment: http://stackoverflow.com/comment/34754047
tagged with: data-structures
has body: Please suggest some alternatives for resolving problems in which brute force solution is using Arrays with very large index and storing very large values(Very large means beyond the range of INT). I am using Java to solve this problem. Sample problem: Putting large no of pebbles in a very large group of buckets, and then calculating average pebbles in each bucket. One way is to declare a big array and keep placing pebbles according to the indexes specified by user and then calculating average. But this way we'll be using a large space for such array.
answer count: 1
accepted answer: http://stackoverflow.com/a/22792788
favorite count: 0
tagged with: bigdata
type: AnsweredQuestion
has title: Alternatives for problems involving very large array indexing storing very large values
score: 1
tagged with: java

http://stackoverflow.com/a/22800449
type: Answer
has body: Try this:while(command.equals("no"))
answers question: http://stackoverflow.com/q/22800422
score: 0

http://stackoverflow.com/a/22779021
score: 0
answers question: http://stackoverflow.com/q/22778848
type: Answer
has body: java.util.Calender is very helpful for you. An example here: SimpleDateFormat sdfDate = new SimpleDateFormat("yyyy-MM-dd"); Calendar now = Calendar.getInstance(); String strDate2 = "2014-01-15"; Calendar date2 = Calendar.getInstance(); date2.setTimeInMillis(sdfDate.parse(strDate2).getTime()); System.out.println(now.get(Calendar.DATE)); System.out.println(date2.get(Calendar.DATE));

dalvik
tags question: http://stackoverflow.com/q/22801211
type: Tag
tag name: dalvik

http://stackoverflow.com/a/22701835
type: Answer
has body: Oh I remember this lovely error from the good old days. The problem is that your ArrayList isn't completely populated by the time the array element is to be accessed. Think of it, you create the object and then immediately start looping it. The object hence, has to populate itself with the values as the loop is going to be running. The simple way to solve this is to pre-populate your ArrayList. public class MarklengthTestDrive { public static void main(String[] args){ ArrayList &lt;String&gt; words = new ArrayList&lt;String&gt;() {{ words.add("Kane"); words.add("Cane"); words.add("Fame"); words.add("Dame"); words.add("Lame"); words.add("Same"); }}; } } Do tell me if that fixes it. You can also use a static initializer.
answers question: http://stackoverflow.com/q/22701694
score: 0
has comment: http://stackoverflow.com/comment/34591467

http://stackoverflow.com/comment/34588193
type: AnswerComment
score: 0
type: Comment
comment on: http://stackoverflow.com/a/22699967
has text: By the way, perhaps there's a way to call a "destructor" when the main program exits?

http://stackoverflow.com/comment/34535750
type: QuestionComment
has text: This should help http://stackoverflow.com/questions/22285661/gson-json-and-the-subtleties-of-linkedtreemap/22285780
comment on: http://stackoverflow.com/q/22671060
score: 0
type: Comment

http://stackoverflow.com/comment/34681522
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/22752206
has text: If you download the [JDK](http://www.oracle.com/technetwork/java/javase/downloads/index.html) you can find the source code at $JDK_HOME/src.zip. If you don't have the JDK, you can use websites like http://grepcode.com/.

http://stackoverflow.com/a/22712813
answers question: http://stackoverflow.com/q/22712290
upvote count: 1
has body: The jar file name is controlled by finalName. If you take a look inside the Manifest file in this jar, it will show the correct qualified version. If you create a p2 repository with your plugins, they will contain the correct filenames. From a maven point of view, the coordinates must match the POM and therefore the version is still -SNAPSHOT.
score: 1
type: AcceptedAnswer
downvote count: 0
accepted answer of: http://stackoverflow.com/q/22712290
type: Answer

http://stackoverflow.com/a/22695128
accepted answer of: http://stackoverflow.com/q/22695104
type: Answer
score: 3
downvote count: 0
has body: You will need to split by whitespace, not just a single space, so that multiple spaces is considered one single delimiter. String split[] = str.split("\\s+");
upvote count: 3
type: AcceptedAnswer
answers question: http://stackoverflow.com/q/22695104

http://stackoverflow.com/comment/34817615
has text: @MadProgrammer Works good and easy to deploy. If you post your answer I'll mark it correct. Thanks
comment on: http://stackoverflow.com/q/22807407
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/34609384
type: Comment
has text: +1 We just have the very same problem and it would be nice to have decent solution.
score: 0
comment on: http://stackoverflow.com/q/22673386
type: QuestionComment

http://stackoverflow.com/comment/34658072
type: AnswerComment
comment on: http://stackoverflow.com/a/22739202
score: 0
type: Comment
has text: @NiklasB Can you elaborate?

http://stackoverflow.com/a/22791437
score: 0
answers question: http://stackoverflow.com/q/22791365
has body: public &lt;T extends Comparable&lt;T&gt;&gt; int isSorted(){ return thing1.compareTo(thing2); } You can't have a method that imposes new constraints on the generic type parameter defined by the class. You would have to declare public class GenericPair&lt;T extends Comparable&lt;T&gt;&gt; { public int isSorted() { return thing1.compareTo(thing2); } }
type: Answer
has comment: http://stackoverflow.com/comment/34752058
has comment: http://stackoverflow.com/comment/34752006

http://stackoverflow.com/q/22806723
has answer: http://stackoverflow.com/a/22806796
has body: I have an interface defined in this way: public interface GenericBo&lt;T, PK extends Serializable&gt; { and another interface public interface ServiceActivityBo&lt;ServiceActivity, String&gt; extends GenericBo&lt;T, PK extends Serializable&gt; but I have an compilation error in the ServiceActivityBo when defined PK: Syntax error on token "extends", , expected How should be defined the ServiceActivityBo ?
score: 0
has title: Interface and generics with Java
answer count: 1
tagged with: generics
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/22806796
tagged with: java
type: Question

http://stackoverflow.com/comment/34753610
comment on: http://stackoverflow.com/q/22792255
has text: `classpath:com/acc/resources/applicationContext.xml`
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/a/22650733
has body: Bear in mind that this is purely an academical exercise. I don't see any practical reason why a resource should need a selective synchronized access. Either you need it, or you don't. If you have to do this, you are setting yourself up for long hours of troubleshooting few months down the line. If I could, I would rethink the design. So, You say - 'some require synchronized and others do not' I take that means you know exactly each and every part of your code that needs Synchronized access, and can differentiate it from those that need to save this overhead. If so: You have two options: Get rid of the synchronized modifier of the method all together and get all the callers that need synchronization to synchronize before the call is made. Thus: synchronized (classAInstance){ classAInstance.doSomething(); // the doSomething() is non-synchronised } Those parts in code that call this method and do not need synchronized access can call the method directly. Make two methods, one that is synchronized and other that is not synchronized. Change the callers to call based on the way you want the access to be controlled.
type: Answer
score: 2
answers question: http://stackoverflow.com/q/22650465
downvote count: 0
upvote count: 2

http://stackoverflow.com/comment/34767823
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/22799678
has text: Ok scratch that, your program isn't doing what I want it to do still. Is it a scope issue? Because I'm not simply trying to copy the field over, I'm converting it from one number to another.
score: 0

http://stackoverflow.com/comment/34515093
has text: I created a proper answer below. Please vote it if it was helpful for you. Regards
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/22654644

http://stackoverflow.com/q/22675526
has comment: http://stackoverflow.com/comment/34543966
answer count: 2
has comment: http://stackoverflow.com/comment/34543899
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/22675772
has comment: http://stackoverflow.com/comment/34543705
has body: I have a JTextField called TEXTIN, when the return key is pressed, it should call my rollText method from the ActionListener which is in my constructor. I am out of ideas and have been trying to fix it for quite a while. This is the code from the constructor: TEXTIN.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e){ rollText(); } The rollText method should take the text from TEXTIN and print it, letter by letter accross a row of 10 JLabels. I wont post the entire method because I know it works when given a predefined input but the beginning of it is: public void rollText(ActionEvent e) throws InterruptedException{ TEXTIN.setEditable(false); String inputText = TEXTIN.getText(); ... Hopefully someone can help me out. Thank you.
has answer: http://stackoverflow.com/a/22675755
has comment: http://stackoverflow.com/comment/34543961
type: Question
has title: Calling method from ActionListener
has comment: http://stackoverflow.com/comment/34543948
tagged with: java
has comment: http://stackoverflow.com/comment/34544085
score: 0

http://stackoverflow.com/q/22705045
upvote count: 0
favorite count: 0
accepted answer: http://stackoverflow.com/a/22705301
tagged with: selenium-webdriver
type: AnsweredQuestion
possible better answer: http://stackoverflow.com/a/22705342
has answer: http://stackoverflow.com/a/22705342
tagged with: java
downvote count: 2
has body: I have a requirement where I want to navigate to website , login to it ,click few links and download some excel files from the one link. I need to do this in java.I researched on google and seeing few options like selenium, http client ,java.net APIs. Could you please suggest which one would work better in this case.Thanks in advance.
type: Question
has answer: http://stackoverflow.com/a/22705301
score: -2
tagged with: httpclient
has title: Selenium, HttpClient or java.net package
answer count: 2

http://stackoverflow.com/comment/34504626
comment on: http://stackoverflow.com/q/22653592
has text: @peeskillet..how can i use this can u explain little bit
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/q/22664565
tagged with: android
tagged with: junit
has title: Run JUnit Test from command line: non-android test in an android project
has answer: http://stackoverflow.com/a/22716138
has body: I wrote an API java class for our website, and the file API.java lives inside an Android Library Project so that we can utilize it in our Android apps. The file itself contains no Android-specific code however and is meant to be a general Java API for the site. I want to add automated testing of this class using JUnit, the test should be executed through a shell script. Here is my script as it stands: #!/bin/sh echo Starting test... java -cp ./Android/iSENSE\ Imports/lib/junit-4.10.jar \ org.junit.runner.JUnitCore ./Android/iSENSE\ Imports/src/edu/uml/cs/isense/test/APITest.java echo Test complete! I've tried many variations on the path/name for the file to be tested. My output from execution: Starting test... JUnit version 4.10 Could not find class: ./Android/iSENSE\ Imports/src/edu/uml/cs/isense/test/APITest.java Time: 0.001 OK (0 tests) Test complete! I'm not sure on how to make JUnit find my APITest file to run it. Any thoughts?
tagged with: unit-testing
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/22716138
tagged with: java
tagged with: classpath
type: Question
answer count: 1
score: 0

http://stackoverflow.com/comment/34576464
comment on: http://stackoverflow.com/q/22677957
has text: Based on what I have seen in the comments, I would guess that the problem is not to do with a previous installation. You might want to take a look at your manifest and make sure there aren't any obvious errors there
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/34818925
type: AnswerComment
has text: (2) In source code of POI4XPages you can see that all original apache poi methods are framed by `AccessController.doPrivileged(new PrivilegedAction<T>() {... poi methods ...}` to get the necessary rights at this moment (e.g. in biz.webgate.dominoext.poi.beans.PoiBean). You can use this technique in an own Java class to get the xwpfdocument.write() to work.
type: Comment
comment on: http://stackoverflow.com/a/22796629
score: 1

http://stackoverflow.com/comment/34701547
type: Comment
comment on: http://stackoverflow.com/a/22758717
score: 0
type: AnswerComment
has text: I hadn't seen auto closures used before. +1 for teaching me something new!

http://stackoverflow.com/a/23309714
score: 3
has body: Yes, this is very much possible but not in the regular way of extending Builder. You will need to use it as a JobProperty. Lets take an example to explain how this is done. You will have 3 classes/packages at minimum. MyPluginClass - Has fields for all your global configuration. MyBuildStepAClass - Has the implementation of build step A. MyBuildStepBClass - Has the implementation of build step B. The code for your build step classes MyBuildStepAClass and MyBuildStepBClass will be same as you would normally write it for a plugin with a single build step. Below is a sample for MyBuildStepAClass.. public class MyBuildStepAClass { private String name; ..... @DataBoundConstructor public MyBuildStepAClass(String name, ....) { this.name = name; .... } public String getName() { return name; } public boolean perform(AbstractBuild build, Launcher launcher, BuildListener listener) { //logic for perform. ............ return true; } @Extension public static class Descriptor extends BuildStepDescriptor&lt;Builder&gt; { public Descriptor() { load(); } @Override public boolean configure(StaplerRequest req, JSONObject formData) throws FormException { req.bindJSON(this, formData); save(); return super.configure(req,formData); } @Override public String getDisplayName() { return "My Build Step A"; } } } To share the configuration between both the plugin classes, You will extend your MyPluginClass from JobProperty&lt;Job&lt;?,?&gt;&gt; (instead of Builder) and override the getDescriptor() method to return the descriptor using Jenkins.getInstance().getDescriptor(getclass()); public class MyPluginClass extends JobProperty&lt;Job&lt;?, ?&gt;&gt; { @Override public MyPluginClassDescriptor getDescriptor() { return (MyPluginClassDescriptor)Jenkins.getInstance().getDescriptor(getClass()); } public static MyPluginClassDescriptor getMyPluginClassDescriptor() { return (MyPluginClassDescriptor)Jenkins.getInstance().getDescriptor(MyPluginClass.class); } @Extension public static final class MyPlugin…
has comment: http://stackoverflow.com/comment/35952414
downvote count: 0
answers question: http://stackoverflow.com/q/22754610
type: Answer
upvote count: 3

http://stackoverflow.com/q/22712937
has comment: http://stackoverflow.com/comment/34618924
tagged with: protocol-buffers
has comment: http://stackoverflow.com/comment/34620047
has answer: http://stackoverflow.com/a/22718165
has comment: http://stackoverflow.com/comment/34619081
tagged with: android
has body: I am trying to generate java files from below proto file using protobuf nano. I got some basic instruction on how to proceed in this SO thread. I have this proto file, personal.proto: package tutorial; option java_package = "com.example.tutorial"; option java_outer_classname = "AddressBookProtos"; message Person { required string name = 1; required int32 id = 2; optional string email = 3; enum PhoneType { MOBILE = 0; HOME = 1; WORK = 2; } message PhoneNumber { required string number = 1; optional PhoneType type = 2 [default = HOME]; } repeated PhoneNumber phone = 4; } message AddressBook { repeated Person person = 1; } I tried to follow the instruction from here, more specifically NANO version: Downloaded protobuf-2.5.0.zip and compiler protoc-2.5.0-win32.zip from here. Unzipped protobuf-2.5.0.zip to a folder and in there in src subfolder I unzipped protoc.exe. Changed to java folder and in there issued: mvn clean package -P nano. That command ran fine and in target folder I have protobuf-java-2.5.0.jar From here I am not sure how to proceed since in the initial documentation I have this statement: - Link with the generated jar file &lt;protobuf-root&gt;java/target/protobuf-java-2.3.0-nano.jar. I am not sure what that means, how to link? Is there some parameter for protoc.exe that specifies the jar file to use? I tried to issue this command: protoc --javanano_out=enum_style=java --java_out=generated personal.proto but I get this error: --javanano_out: protoc-gen-javanano: The system cannot find the file specified. The question would be: what am I missing/doing wrong above? I am trying to generate java files from above proto file.
favorite count: 0
has comment: http://stackoverflow.com/comment/34618864
score: 6
tagged with: maven
upvote count: 6
has comment: http://stackoverflow.com/comment/34619732
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/34618742
accepted answer: http://stackoverflow.com/a/22718165
tagged with: java
type: Question
has comment: http://stackoverflow.com/comment/34619202
has comment: http://stackoverflow.com/comment/34619490
linked to: http://stackoverflow.com/q/22247951
has title: Android protobuf nano usage
answer count: 1
downvote count: 0

http://stackoverflow.com/comment/77678128
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/22756153
has text: I had a similar issue, which was based on the way I opened the project. Needed to import as maven project instead... details can be found here: https://stackoverflow.com/questions/45357109/maven-project-in-eclipse-org-springframework-cannot-be-resolved-to-a-type-from
score: 0

http://stackoverflow.com/q/22690761
has body: Having to ask this question because I am a fool and overwrote old work. Right now what I need to do is loop through a multidimensional array in one class, then loop through an arraylist(thats currently empty) and use an if statement to check whether or not there are duplicates inside that arraylist, if there aren't, then it will add the record to the arraylist, if it is, it will simply make isFound = false This is the method that will add the records to the arraylist. Right now it only works up to the second loop. this is the main class, called EAC public void PopulateRecords() { ArrayList&lt;String&gt; categories = new ArrayList&lt;String&gt;(); for (int i = 0; i &lt; Data.stats.length; i++) { //System.out.println(Data.stats[i][1]); for (String category : categories) { boolean isFound = false; if (Data.stats[i][1].equals(category)) { isFound = true; } if (!isFound) { categories.add(Data.stats[i][0]); System.out.println(categories); } } } } This is the Category class, and the GetCategory here was used within the populaterecords() method somehow, but that's the one stage of this i'm not fully understanding, because there's a bit or two missing from here that's presumably preventing the method from working public class Category { public String categoryname; public Category categories; public static void main(String[] args) { new Category(); } public Category() { } public String GetCategory() { return categoryname; } public void SetCategory() { } } This is as specific as I can go, I'm by every definition a pure newbie at java, so any help here is much appreciated
tagged with: arraylist
has comment: http://stackoverflow.com/comment/34570644
answer count: 1
has comment: http://stackoverflow.com/comment/34570348
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/34572095
has answer: http://stackoverflow.com/a/22690797
tagged with: java
score: 0
has comment: http://stackoverflow.com/comment/34570513
has title: how can i remove duplicates from a MD array in one java class, using a method from another class
type: Question
tagged with: arrays
tagged with: duplicates

http://stackoverflow.com/a/22760914
upvote count: 1
type: AcceptedAnswer
downvote count: 0
accepted answer of: http://stackoverflow.com/q/22760512
type: Answer
answers question: http://stackoverflow.com/q/22760512
score: 1
has body: Ok, finally I managed to solve problem configuring Eclipse project facets. I followed this tutorial: http://www.mkyong.com/jsf2/how-to-make-eclipse-ide-supports-jsf-2-0/

http://stackoverflow.com/comment/34533044
has text: That returns an empty response, but it is in fact a response. It might even be a 200 OK if i'm not mistaken. What I am looking for is a way to ignore the request. I have to process the request first before I decide to ignore it, so I can't catch it further upstream by a separate process.
score: 0
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/22668825

http://stackoverflow.com/comment/34572237
type: QuestionComment
has text: I don't really think it's that dirty. Better than going the other way and trying to add all the submenu functionality to a JCheckBoxMenuItem!
comment on: http://stackoverflow.com/q/22691422
score: 0
type: Comment

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

http://stackoverflow.com/comment/34597692
type: Comment
type: QuestionComment
has text: @MirroredFate Because with `AudioInputStream` it didn't work, it said "can't open file with this format". And I can't use javafx
comment on: http://stackoverflow.com/q/22698658
score: 0

http://stackoverflow.com/a/22673644
has body: I finally figured it out for anyone else who happens to run into this problem, this is how I got the jar file to be created and run successfully... I had to change my pom.xml file to the following: TestAutomation TestAutomation jar 1.0-SNAPSHOT http://maven.apache.org org.apache.maven.plugins maven-compiler-plugin org.apache.maven.plugins maven-jar-plugin true com.test.automation.Executable org.apache.maven.plugins maven-surefire-plugin org.seleniumhq.selenium selenium-java 2.40.0 junit junit 4.11 test org.testng testng 6.1.1 test Then, I had to adjust my main method to not use any TestNG-related calls. For example, I could not use something like this for my main method: TestListenerAdapter tla = new TestListenerAdapter(); TestNG testng = new TestNG(); testng.setTestClasses(new Class[] {WordProfFonts2Set0.class}); testng.addListener(tla); testng.run(); Finally, here are the steps to get the appropriate jar file created: Select File > Project Structure... from the top menu Select "Artifact" on the left menu and click the '+' Select Jar > From modules with dependencies... Select your main class using the browse button Click the radio button next to, "extract to the target jar" and click "OK" Click the '+' then select "Module Test Output" In the Available Elements pane to the right, expand the project name and select all the Maven files, then move them to the jar directory being created in the left pane Click "OK" Select Build > Build Artifacts... from the top menu Hover over the jar created and click "Build" under Actions Notes: Be sure to add the IE or Chrome driver to your projects resources folder, and call it via the code folder, rather than the computer's hard drive. For example, do this: File file = new File("src\test\resources\binaries\IEDriverServer.exe"); Not this: File file = new File ("C:\\Users\\<Username>\\<Proj Name>\\src\\test\\java\\src\\ test\\resources\\binaries\\IEDriverServer.exe"); Then create the same directory with the driver in it in the same f…
type: Answer
answers question: http://stackoverflow.com/q/22648384
has comment: http://stackoverflow.com/comment/48076734
upvote count: 10
has comment: http://stackoverflow.com/comment/34630538
score: 10
has comment: http://stackoverflow.com/comment/63318887
accepted answer of: http://stackoverflow.com/q/22648384
type: AcceptedAnswer
downvote count: 0

http://stackoverflow.com/comment/34634324
type: Comment
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/22702535
has text: Hmmm. Try putting glLoadIdentity() after glMatrixMode(GL_PROJECTION), I edited my answer to show what I mean. I believe it only affects the current matrix.

http://stackoverflow.com/q/22755915
favorite count: 0
tagged with: pattern-matching
has body: I want to count the number of occurrences of particular word in a source string. Let's say src="thisisamangoterrthisismangorightthis?" word="this" So what I am doing is, first search for index of word in src. It's at index 0. Now I am extracting the part from this index location to end of src. i.e., now src="isamangoterrthisismangorightthis?" and search for word again. But I am getting array out of bound exception. public static int countOccur(String s1, String s2) { int ans=0; int len1=s1.length(); int len2=s2.length(); System.out.println("Lengths:"+len1+" " +len2); while(s1.contains(s2)) { ans++; int tmpInd=s1.indexOf(s2); System.out.println("Now Index is:"+tmpInd); if((tmpInd+len2)&lt;len1){ s1=s1.substring(tmpInd+len2, len1); System.out.println("Now s1 is:"+s1); } else break; } return ans; }
has answer: http://stackoverflow.com/a/22756133
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/22756133
score: 1
tagged with: java
has answer: http://stackoverflow.com/a/22756016
has answer: http://stackoverflow.com/a/22756115
upvote count: 1
type: Question
has answer: http://stackoverflow.com/a/22755955
answer count: 6
possible better answer: http://stackoverflow.com/a/22755955
has title: Counting number of occurrences of word in java
has answer: http://stackoverflow.com/a/22755984
has comment: http://stackoverflow.com/comment/34689429
has answer: http://stackoverflow.com/a/22755977
downvote count: 0
tagged with: string

http://stackoverflow.com/q/22724376
has comment: http://stackoverflow.com/comment/34632380
type: AnsweredQuestion
has body: Say I have a String s = "50";, and I want to append "\u00" onto the front of the string. Is this possible without throwing an Illegal unicode escape? Thanks.
score: 1
tagged with: java
has comment: http://stackoverflow.com/comment/34632358
type: Question
has comment: http://stackoverflow.com/comment/34632232
has answer: http://stackoverflow.com/a/22724383
accepted answer: http://stackoverflow.com/a/22724383
answer count: 1
has title: Adding escape to String, possible?
tagged with: unicode
upvote count: 1
favorite count: 0
downvote count: 0

http://stackoverflow.com/comment/34538937
score: 0
type: Comment
has text: But still curious to learn what you were saying in the answer .. if you don't mind elaborating a bit on it
comment on: http://stackoverflow.com/a/22672738
type: AnswerComment

http://stackoverflow.com/q/22768216
score: 0
answer count: 0
type: UnansweredQuestion
has body: I currently have a MOSS 2010 installation with the following web applications and sites Web applications: Sharepoint:80 Sharepoint Central Administration Sharepoint_Web_Application:12345 - Another web application that runs on port 12345. Sites: http://server.mydomain.com http://server.mydomain.com/sites/site1 http://server.mydomain.com:65532/ -- This is the default administration site http://server.mydomain.com:12345/sites/site2. Authentication modes enabled: NTLM Basic Kerberos I am now trying to access this sharepoint installation using a web services that is deployed globally as a sharepoint solution via a Java client and using the NTLM authentication scheme. I am able to sucessfully consume the web service when I access it using this URL: http://server.domain.com/_vti_bin/Service.asmx http://server.domain.com:65432/_vti_bin/Service.asmx However, I get an Axis SOAP fault when I try to access the web service over this URL: http://server.domain.com:12345/_vti_bin/Service.asmx This is really confusing, since I have deployed this web service as a global solution on Sharepoint. Is there any specific setting I need to do within the Sharepoint web application running on 12345 to ensure that the web services are accessible?
tagged with: java
has comment: http://stackoverflow.com/comment/34733341
has comment: http://stackoverflow.com/comment/34766213
type: Question
has title: Error while accessing Sharepoint web service from a Java application
has comment: http://stackoverflow.com/comment/34732034
tagged with: sharepoint-2010
tagged with: sharepoint

http://stackoverflow.com/q/22777054
has body: Can someone explain/show me how to use requestShortcut method in this document, I want to make my jar a desktop shortcut while program was running. Below is my Java code private static Component frame; public static void main(String[] args){ JOptionPane.showMessageDialog( null, "Hello World", "Hello World", JOptionPane.INFORMATION_MESSAGE); //I want to create shortcut code here requestShortcut(true, false, ""); // return cannot find symbol // this method should create desktop // shortcut if i understand it right. } How do we actually implement this requestShortcut() method? P/s : The purpose I want to create shortcut because I will move the shortcut to path all program/startup.
answer count: 1
downvote count: 0
tagged with: jar
score: 1
favorite count: 0
accepted answer: http://stackoverflow.com/a/22806866
type: AnsweredQuestion
tagged with: java
has title: How to Create Desktop Shortcut with requestShortcut()?
upvote count: 1
has comment: http://stackoverflow.com/comment/34727082
type: Question
has answer: http://stackoverflow.com/a/22806866

http://stackoverflow.com/q/22753068
has answer: http://stackoverflow.com/a/22753174
type: AnsweredQuestion
possible better answer: http://stackoverflow.com/a/22753132
score: 0
tagged with: java
has title: Random number in Java where one number has higher odds
accepted answer: http://stackoverflow.com/a/22753172
type: Question
has answer: http://stackoverflow.com/a/22753210
has body: I understand that in Java I can generate a random number with the following code: Random rand=new Random() int x=rand.nextInt(1); I am interested generating either the number zero or one. But I want that number one has 90% higher probability of of being generated than zero. How can I achieve that? thanks EDIT: Thanks everyone. It's working.
has answer: http://stackoverflow.com/a/22753172
answer count: 5
has answer: http://stackoverflow.com/a/22753656
has answer: http://stackoverflow.com/a/22753132

http://stackoverflow.com/comment/34532713
score: 0
has text: Find solution here about [Colspan and Rowspan in CellTable](http://stackoverflow.com/questions/14879353/colspan-and-rowspan-in-celltable).
type: Comment
comment on: http://stackoverflow.com/q/22650176
type: QuestionComment

http://stackoverflow.com/comment/34521508
type: QuestionComment
comment on: http://stackoverflow.com/q/22663141
score: 0
has text: R=2 and also I've updated the pseudo code.
type: Comment

http://stackoverflow.com/comment/34611121
type: AnswerComment
has text: Hi, thanks for the response. I just tried what you said now, I went Windows>Preferences>Installed JRE's and edited the location to be the place where I installed the new JDK. When I try run the Build code again I get a slightly different error now, which reads "Class not found: javac1.8". Any idea what I should do about that? Thanks again!
type: Comment
comment on: http://stackoverflow.com/a/22712984
score: 0

http://stackoverflow.com/q/22735605
tagged with: validation
answer count: 1
has answer: http://stackoverflow.com/a/22735624
linked to: http://stackoverflow.com/q/2710300
has body: Hi this is my code that I have used for my application. Every thing works fine however in some instances when inputting data that would use case 2 the if-else statement and the nested if-else statement displays one long answer of the different System.out.print. What would I have to do to display one answer? I want the program to display if the date entered to show if its a valid date, if the date entered is a leap year as well as display an error if the day or month is entered wrong package javaapplication18; import java.util.Scanner; /** * * @author Thurston Pietersen */ public class JavaApplication18 { public static void main(String[] args) { int sI,fI ,sL, month, day, year; String mm, dd, yyyy, date; Scanner keyboard = new Scanner(System.in); // TODO code application logic here System.out.print("Input date using the following format mm/dd/yyyy: "); date = keyboard.next(); sL = date.length(); fI = date.indexOf("/"); sI = date.lastIndexOf("/"); mm = date.substring(0,fI); month = Integer.parseInt(mm); dd = date.substring((fI+1),sI); day = Integer.parseInt(dd); yyyy = date.substring((sI+1),sL); year = Integer.parseInt(yyyy); switch (month) { case 1: case 3: case 5: case 7: case 8: case 10: case 12: if (day &gt; 31) System.out.print(date + " is an invalid date."); else System.out.print(date + " is a valid date."); case 4: case 6: case 9: case 11: if (day &gt; 30) System.out.print(date + " is an invalid date."); else System.out.print(date + " is a valid date."); case 2: if (year % 4 == 0) if (day &gt; 29) System.out.print(date + " is an invalid day."); else System.out.print(date + " is a valid date and leap year."); else if (day &gt; 28) System.out.print(date + " is an invalid day."); else System.out.print(date + " is a valid date."); default: System.out.println("The date: " + date + " has an invalid month"); } } }
score: 0
has title: How to output a date using a switch statement with nested if-else statements
accepted answer: http://stackoverflow.com/a/22735624
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/87339290
tagged with: java
tagged with: date
has comment: http://stackoverflow.com/comment/34651771
type: Question

http://stackoverflow.com/comment/34767608
score: 0
type: Comment
type: AnswerComment
comment on: http://stackoverflow.com/a/22773275
has text: getContents() gets you whatever object is tied to the part in question. So for the Main Document Part, its a org.docx4j.wml.Document object; for a header or footer it is something else. You then manipulate the Document object using its methods.

http://stackoverflow.com/comment/38086469
type: Comment
has text: Related: http://stackoverflow.com/questions/1662185/do-linux-jvms-actually-implement-thread-priorities
score: 0
comment on: http://stackoverflow.com/q/22675206
type: QuestionComment

http://stackoverflow.com/a/22747508
has comment: http://stackoverflow.com/comment/34673046
has comment: http://stackoverflow.com/comment/58792600
score: 0
answers question: http://stackoverflow.com/q/22747459
type: Answer
has body: Install Java on your machine if that is not Installed and start eclipse again. http://www.wikihow.com/Install-Oracle-Java-on-Ubuntu-Linux

http://stackoverflow.com/q/22765965
favorite count: 0
has body: Is there any way to update a node using a map and don't remove existing properties? Eg: my node props are: { id : 123, name : "foo" } Now I need send a map for the same id, but with different properties: { id : 123, age : 30 } If I do this, the name property will be erased from the node. I can't set properties manually because they are dynamic and can be different for each request. UPDATE: I'm doing this by sending Cypher query with params to REST API.
type: UnansweredQuestion
tagged with: java
upvote count: 1
type: Question
has comment: http://stackoverflow.com/comment/34706763
has title: update node properties using map without remove existing properties
answer count: 1
downvote count: 0
tagged with: neo4j
score: 1
has answer: http://stackoverflow.com/a/22766853

http://stackoverflow.com/a/37572996
score: 0
type: Answer
has body: Return false if matches error: #[?payload['name'].matches('^[a-zA-Z]{3,15}$') or false]
answers question: http://stackoverflow.com/q/22672755

http://stackoverflow.com/comment/34506611
type: AnswerComment
score: 0
type: Comment
has text: i have problem how to response write max size?
comment on: http://stackoverflow.com/a/22654742

http://stackoverflow.com/q/22690762
type: Question
score: 0
answer count: 1
accepted answer: http://stackoverflow.com/a/22706848
has title: Built java project in Netbeans doesn’t include external TEXT files
tagged with: netbeans
has body: Sorry if the question is basic. I’m trying to build a java project that include text files : File file = new File("data/include/foo.txt"); Problem is that with Netbeans, Built and Clean actions are done without taking into account external text files. Can you please help me solving this problem.
has comment: http://stackoverflow.com/comment/34586493
has comment: http://stackoverflow.com/comment/34594716
has answer: http://stackoverflow.com/a/22706848
type: AnsweredQuestion
tagged with: java

http://stackoverflow.com/a/22681742
answers question: http://stackoverflow.com/q/22681629
downvote count: 0
type: Answer
score: 2
upvote count: 2
has body: You are getting confused by the scientific notation (also known as standard form). 9.914204103773398E-4 means 9.91... x 10^(-4), i.e. 0.0009914.... So this value is indeed smaller than 0.0023...

http://stackoverflow.com/comment/34755684
has text: @dharshan This doesn't seem to be a json question on second glance. Your intent was to separate the point into latitude and longitude values?
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/22793206

http://stackoverflow.com/comment/34648601
score: 0
has text: @FarhanGDon please could you provide some pseudocode or a bit more explanation ?
type: Comment
comment on: http://stackoverflow.com/q/22733620
type: QuestionComment

http://stackoverflow.com/comment/34526817
has text: @mike for more information, and general idea behind your question: http://stackoverflow.com/questions/2206378/how-to-split-a-string-but-also-keep-the-delimiters
type: AnswerComment
comment on: http://stackoverflow.com/a/22666071
score: 0
type: Comment

sockets
tags question: http://stackoverflow.com/q/22693136
tags question: http://stackoverflow.com/q/22780955
tags question: http://stackoverflow.com/q/22801211
tags question: http://stackoverflow.com/q/22672701
tags question: http://stackoverflow.com/q/22720746
tags question: http://stackoverflow.com/q/22794383
tags question: http://stackoverflow.com/q/22751680
tags question: http://stackoverflow.com/q/22794326
tags question: http://stackoverflow.com/q/22695425
tags question: http://stackoverflow.com/q/22710608
tags question: http://stackoverflow.com/q/22720691
tags question: http://stackoverflow.com/q/22712080
tags question: http://stackoverflow.com/q/22762598
tags question: http://stackoverflow.com/q/22719106
tags question: http://stackoverflow.com/q/22766084
tags question: http://stackoverflow.com/q/22747728
tags question: http://stackoverflow.com/q/22764050
tags question: http://stackoverflow.com/q/22766135
tags question: http://stackoverflow.com/q/22738138
tags question: http://stackoverflow.com/q/22684128
tags question: http://stackoverflow.com/q/22799815
tags question: http://stackoverflow.com/q/22745747
tags question: http://stackoverflow.com/q/22737970
tags question: http://stackoverflow.com/q/22758749
tags question: http://stackoverflow.com/q/22786841
tags question: http://stackoverflow.com/q/22695956
tags question: http://stackoverflow.com/q/22693256
type: Tag
tags question: http://stackoverflow.com/q/22767989
tags question: http://stackoverflow.com/q/22764336
tags question: http://stackoverflow.com/q/22690907
tags question: http://stackoverflow.com/q/22759822
tags question: http://stackoverflow.com/q/22746196
tags question: http://stackoverflow.com/q/22704556
tags question: http://stackoverflow.com/q/22728231
tags question: http://stackoverflow.com/q/22794743
tags question: http://stackoverflow.com/q/22678077
tags question: http://stackoverflow.com/q/22715180
tags question: http://stackoverflow.com/q/22714613
tags question: http://stackoverflow.com/q/22695924
tag name: sockets
tags question: http://stackoverflow.com/q/22807756
tags question: http://stackoverflow.com/q/22709676
tags question: http://stackoverflow.com/q/22770864
tags question: http://stackoverflow.com/q/22698555
tags question: http://stackoverflow.com/q/22718812
tags question: http://stackoverflow.com/q/22691665
tags question: http://stackoverflow.com/q/22712564
tags question: http://stackoverflow.com/q/22709634
tags question: http://stackoverflow.com/q/22800995
tags question: http://stackoverflow.com/q/22683811
tags question: http://stackoverflow.com/q/22779514
tags question: http://stackoverflow.com/q/22729692

http://stackoverflow.com/comment/34813056
comment on: http://stackoverflow.com/q/22737535
score: 1
has text: I had this exact problem with all Swing applications, and I solved it by forcing the discrete graphics card to be used for Java instead of the integrated one. This is described in a deleted answer, I've already flagged it for undeletion.
type: Comment
type: QuestionComment

http://stackoverflow.com/q/22751696
upvote count: 1
type: AnsweredQuestion
score: 1
tagged with: java
type: Question
tagged with: jakarta-ee
has answer: http://stackoverflow.com/a/22751732
tagged with: jsp
has body: I have a model that I have an arraylist in. I also have a servlet that needs to pull from the model. Last the JSP needs to get the info retrieved from the servlet(controller) and generate options for the select list. I cant figure out why this wont work at all. I am just getting into jsp's so any help would be appreciated. I have the 3 pages below and the stacktrace. Any Changes that would be helpful to make for future development that are suggested would be helpful as well. I am very open and want to do this the right way. Model(has the arraylist) package edu.witc.Assignment03.model; import java.util.ArrayList; import java.util.List; public class States { private List<String> states = new ArrayList<>();{ states.add("Alabama"); states.add("Alaska"); states.add("Arizona"); states.add("Arkansas"); states.add("California"); states.add("Colorado"); states.add("Connecticut"); states.add("Delaware"); states.add("Florida"); states.add("Georgia"); states.add("Hawaii"); states.add("Idaho"); states.add("Illinois"); states.add("Indiana"); states.add("Iowa"); states.add("Kansas"); states.add("Kentucky"); states.add("Louisiana"); states.add("Maine"); states.add("Maryland"); states.add("Massachusetts"); states.add("Michigan"); states.add("Minnesota"); states.add("Mississippi"); states.add("Missouri"); states.add("Montana"); states.add("Nebraska"); states.add("Nevada"); states.add("New Hampshire"); states.add("New Jersey"); states.add("New Mexico"); states.add("New York"); states.add("North Carolina"); states.add("North Dakota"); states.add("Ohio"); states.add("Oklahoma"); states.add("Oregon"); states.add("Pennsylvania"); states.add("Rhode Island"); states.add("South Carolina"); states.add("South Dakota"); states.add("Tennessee"); states.add("Texas"); states.add("Utah"); states.add("Vermont"); states.add("Virginia"); states.add("Washington"); states.add("West Virginia"); states.add("Wisconsin"); states.add("Wyoming"); } public List<String> getStates(){ return this.states; } } Cont…
tagged with: servlets
tagged with: arraylist
has title: Getting Information from Model To Servlet To JSP Option List
answer count: 1
downvote count: 0
accepted answer: http://stackoverflow.com/a/22751732
favorite count: 0

jsoup
tags question: http://stackoverflow.com/q/22808101
tags question: http://stackoverflow.com/q/22693874
tags question: http://stackoverflow.com/q/22742092
tags question: http://stackoverflow.com/q/22763190
tags question: http://stackoverflow.com/q/22803854
tags question: http://stackoverflow.com/q/22675650
tags question: http://stackoverflow.com/q/22787707
tags question: http://stackoverflow.com/q/22750141
type: Tag
tag name: jsoup
tags question: http://stackoverflow.com/q/22708911
tags question: http://stackoverflow.com/q/22803142
tags question: http://stackoverflow.com/q/22692622
tags question: http://stackoverflow.com/q/22669771
tags question: http://stackoverflow.com/q/22752633
tags question: http://stackoverflow.com/q/22671131
tags question: http://stackoverflow.com/q/22777504
tags question: http://stackoverflow.com/q/22782380

http://stackoverflow.com/comment/34540295
type: QuestionComment
type: Comment
score: 4
comment on: http://stackoverflow.com/q/22673604
has text: `java.lang.IndexOutOfBoundsException: Index: 1, Size: 1`: The exception is pretty clear. You are trying to access position `1` of an `ArrayList` which has size `1`, so the only available index is `0`.

http://stackoverflow.com/comment/34511340
comment on: http://stackoverflow.com/a/22657408
type: AnswerComment
type: Comment
score: 2
has text: 1) `KeyListener` is typically the wrong level of functionality for Swing. 2) `if (e.getKeyCode() == 10) {` Don't use magic numbers. 3) A password field supports an [`ActionListener`](http://docs.oracle.com/javase/8/docs/api/javax/swing/JTextField.html#addActionListener-java.awt.event.ActionListener-)..

http://stackoverflow.com/comment/34786312
has text: bat file works :) In bat file I've copied with `cp` uninstaller.jar to %TEMP% directory and launched `java -jar %TEMP%\uninstaller.jar`. But one I think big problem - when bat file was launched - console window opened. Is there some option to execute it without console window?
score: 0
type: Comment
comment on: http://stackoverflow.com/a/22796473
type: AnswerComment

http://stackoverflow.com/comment/34730064
comment on: http://stackoverflow.com/a/22777719
type: AnswerComment
score: 0
type: Comment
has text: My layout file is given below... Please help.

http://stackoverflow.com/comment/34514754
comment on: http://stackoverflow.com/a/22658550
type: Comment
has text: @Murali Why are you using such an old driver? It might be a bug that has already been fixed in a more recent SQL Server driver.
type: AnswerComment
score: 0

concurrency
tag name: concurrency
tags question: http://stackoverflow.com/q/22662957
tags question: http://stackoverflow.com/q/22756940
tags question: http://stackoverflow.com/q/22659193
tags question: http://stackoverflow.com/q/22741382
tags question: http://stackoverflow.com/q/22699930
tags question: http://stackoverflow.com/q/22706739
tags question: http://stackoverflow.com/q/22655266
tags question: http://stackoverflow.com/q/22745390
tags question: http://stackoverflow.com/q/22665198
tags question: http://stackoverflow.com/q/22770475
tags question: http://stackoverflow.com/q/22766988
tags question: http://stackoverflow.com/q/22733620
tags question: http://stackoverflow.com/q/22696309
type: Tag
tags question: http://stackoverflow.com/q/22710228
tags question: http://stackoverflow.com/q/22746100

http://stackoverflow.com/a/22742563
has comment: http://stackoverflow.com/comment/34664477
has comment: http://stackoverflow.com/comment/34664349
has comment: http://stackoverflow.com/comment/34664218
has comment: http://stackoverflow.com/comment/34664647
has comment: http://stackoverflow.com/comment/34663958
has comment: http://stackoverflow.com/comment/34664259
score: 0
answers question: http://stackoverflow.com/q/22733570
has comment: http://stackoverflow.com/comment/34663835
has body: I don't know it that is all of the code but I guess that you should add a onCreateView. And use a layout with at listview
has comment: http://stackoverflow.com/comment/34666474
has comment: http://stackoverflow.com/comment/34665363
type: Answer
has comment: http://stackoverflow.com/comment/34664605
has comment: http://stackoverflow.com/comment/34664322
has comment: http://stackoverflow.com/comment/34664087

http://stackoverflow.com/q/22753225
has comment: http://stackoverflow.com/comment/34683460
tagged with: android
answer count: 0
score: 0
type: UnansweredQuestion
has title: onDateSet interface getting a stack overflow error
type: Question
tagged with: java
tagged with: android-datepicker
has comment: http://stackoverflow.com/comment/34683428
tagged with: android-dialogfragment
has comment: http://stackoverflow.com/comment/34683473
has comment: http://stackoverflow.com/comment/34685156
has body: I have a separate java file: public class DatePickerDialogFragment extends DialogFragment implements DatePickerDialog.OnDateSetListener { @Override public Dialog onCreateDialog(Bundle savedInstanceState) { // Use the current date as the default date in the picker final Calendar c = Calendar.getInstance(); int year = c.get(Calendar.YEAR); int month = c.get(Calendar.MONTH); int day = c.get(Calendar.DAY_OF_MONTH); // Create a new instance of DatePickerDialog and return it return new DatePickerDialog(getActivity(), this, year, month, day); } public void onDateSet(DatePicker view, int years, int month, int day) { // Do something with the date chosen by the user onDateSet(view, years, month, day); } } In my MainActivity I have: public class MainActivity extends FragmentActivity implements OnDateSetListener{ ... @Override public void onDateSet(DatePicker view, int year, int monthOfYear, int dayOfMonth) { this.year = year; this.month = monthOfYear; this.day = dayOfMonth; } } I get stackOverflow on onDateSet(view, years, month, day); in my DialogFragment when I press the "Done" button on the fragment. Logcat: 03-30 23:42:30.231: E/AndroidRuntime(4226): java.lang.StackOverflowError 03-30 23:42:30.231: E/AndroidRuntime(4226): at com.myapp.example.gui.dialogfragments.DatePickerDialogFragment.onDateSet(DatePickerDialogFragment.java:27) 03-30 23:42:30.231: E/AndroidRuntime(4226): at com.myapp.example.gui.dialogfragments.DatePickerDialogFragment.onDateSet(DatePickerDialogFragment.java:27)

http://stackoverflow.com/a/22675396
has comment: http://stackoverflow.com/comment/34544112
score: 0
type: Answer
has comment: http://stackoverflow.com/comment/34543895
answers question: http://stackoverflow.com/q/22672982
has comment: http://stackoverflow.com/comment/34547501
has body: Scale by Gdx.graphics.getDensity()

bitwise-operators
tags question: http://stackoverflow.com/q/22673629
tag name: bitwise-operators
type: Tag

http://stackoverflow.com/a/22720785
answers question: http://stackoverflow.com/q/22720477
accepted answer of: http://stackoverflow.com/q/22720477
has body: This will solve you problem files[arg0].toString() for case 0 @Override public Object getValueAt(int arg0, int arg1) { switch (arg1) { case 0: return files[arg0].toString(); case 1: return files[arg0].length(); case 2: return new Date(files[arg0].lastModified()); } return arg1; }
type: AcceptedAnswer
score: 0
type: Answer

http://stackoverflow.com/comment/56871381
type: QuestionComment
comment on: http://stackoverflow.com/q/22718744
score: 0
has text: guess what you will get when using `"".split ("")`, tada, **"an empty leading substring is included at the beginning of the resulting array."**
type: Comment

http://stackoverflow.com/comment/34762940
type: Comment
type: QuestionComment
has text: Alternatively, instead of TitledBorders, use a JLabel followed by a horizontal JSeparator for each group title. This will give a similar "group separation" effect while allowing you to work with only one panel.
comment on: http://stackoverflow.com/q/22790716
score: 0

http://stackoverflow.com/a/22659926
has body: Found the answer here: JUnit gives no information regarding "errors" So I added a formatter to my junit task and all is well: <formatter type="plain" usefile="false"/>
accepted answer of: http://stackoverflow.com/q/22659641
score: 0
type: AcceptedAnswer
type: Answer
answers question: http://stackoverflow.com/q/22659641

http://stackoverflow.com/q/22686732
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/34565537
tagged with: java
has body: I have developed an application to search a node in a JTree. Whenever "Get Original Tree" button is clicked the clonedRoot should be populated with the original data. All the processing is performed on the clonedRoot. Everything is working fine (deducing the console output) except that the updated clonedRoot is not rendered on the panel. clonedRoot populated with the original data if(ae.getSource()==getOriginalTree) { System.out.println("Get original tree"); System.out.println("Nodes present under cloned Root before deep copying"); DisplayNodes(clonedRoot); getDeepCopy(); System.out.println("Nodes present under cloned Root after deep copying"); DisplayNodes(clonedRoot); DefaultTreeModel newModel = new DefaultTreeModel(clonedRoot); clonedTree.setModel(newModel); for (int i = 0; i &lt; clonedTree.getRowCount(); i++) { clonedTree.expandRow(i); } System.out.println("Updated tree"); } clonedRoot after performing a search operation Console Output on clicking "Get Original Tree"- Get original tree Nodes present under cloned Root before deep copying A A1 Cloning done Nodes present under cloned Root after deep copying A A1 A2 A3 B B1 B2 B3 C C1 C2 C3 D D1 D2 D3 E E1 E2 E3 Updated tree Initialization Code in ctor { root = new DefaultMutableTreeNode("Root"); tree = new JTree(root); setLAF(); populateTree(); copyBuilder = new DeepCopyJTreeAlt(tree); getDeepCopy(); System.out.println("Original Tree"); displayTree(tree); System.out.println("Cloned Tree"); displayTree(clonedTree); label = new JLabel("Serach Node"); field = new JTextField(); for (int i = 0; i &lt; clonedTree.getRowCount(); i++) { clonedTree.expandRow(i); } tree.getSelectionModel().setSelectionMode(TreeSelectionModel.SINGLE_TREE_SELECTION); pane = new JScrollPane(clonedTree); centralPanel = new JPanel(); centralPanel.setLayout(new BorderLayout()); submit = new JButton("Search"); submit.addActionListener(new SearchActionListener()); getOriginalTree = new JButton("Get Original Tree"); getOriginalTree.addActionListener…
accepted answer: http://stackoverflow.com/a/22686885
has title: Jtree not updated
type: Question
tagged with: jtree
has comment: http://stackoverflow.com/comment/34572162
score: 0
has comment: http://stackoverflow.com/comment/34566760
answer count: 1
has comment: http://stackoverflow.com/comment/34571463
has comment: http://stackoverflow.com/comment/34566562
has answer: http://stackoverflow.com/a/22686885

http://stackoverflow.com/q/22720124
has answer: http://stackoverflow.com/a/22720430
has body: in my java project i have look n feel jar files. try { UIManager.setLookAndFeel("de.javasoft.plaf.synthetica.SyntheticaBlackEyeLookAndFeel"); } catch (Exception ex) { } so when i create jar file for my project it produces jar and a lib folder containing those look n feel jars. when i copy both folders into new place it worked well but when i copy only jar it opened in default look n feel way is there any way to solve it
tagged with: java
type: Question
answer count: 1
tagged with: executable-jar
has title: creating jar with look n feel library jars
score: 0
has comment: http://stackoverflow.com/comment/34624647
type: UnansweredQuestion

http://stackoverflow.com/comment/34712406
score: 0
type: AnswerComment
type: Comment
has text: This looks great, one point for you, that `int i` in the `for` loop needs to be made global, the local `i` can't be accessed from the inner `run()` function. Other than that this works for me. Now I need to read it through a few times to make sure I understand ***why*** it works. :)
comment on: http://stackoverflow.com/a/22769058

http://stackoverflow.com/q/22689150
answer count: 1
has comment: http://stackoverflow.com/comment/34568693
has answer: http://stackoverflow.com/a/22689896
type: Question
has body: I am new to Java and servlets and this is just a practice exercise I'm stuck on. I have a simple HTML form with two text fields for a first and last name, and two radio buttons for gender, plus a submit button. When the user fills out the form correctly the servlet returns a page that says "Welcome to my store Mr or Ms (depending on the gender button) and their first and last name. I have that all working correctly. What I can't get to work is a try-catch block that will alert the user if they've missed one of the name fields or didn't check a gender radio button. Is try-catch the way to go in this case or should I be using an if loop? I've inserted the try-catch in different spots but it doesn't seem to do anything. So my bottom line question is what is the best way of having the form validation work? The HTML form: &lt;!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"&gt; &lt;html&gt; &lt;head&gt; &lt;meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"&gt; &lt;title&gt;Project 7&lt;/title&gt; &lt;/head&gt; &lt;body bgcolor="#FFFFD1"&gt; &lt;p align="left"&gt; &lt;h1&gt;Please Enter Your Name&lt;/h1&gt; &lt;form action="http://localhost:8080/Project/Main"&gt; First Name:&amp;nbsp;&lt;input type="text" name="firstName" &gt;&lt;br&gt; Last Name:&amp;nbsp;&lt;input type="text" name="lastName" &gt;&lt;br&gt;&lt;br&gt;&lt;br&gt; Gender &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Male&lt;input type="radio" name="rd" value = "0"&gt;&amp;nbsp;&amp;nbsp; Female&lt;input type="radio" name="rd" value = "1"&gt;&lt;br&gt;&lt;br&gt;&lt;br&gt; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;input type="submit" value="Submit Query"&gt; &lt;/form&gt; &lt;/body&gt; &lt;/html&gt; The Servlet code: import java.io.IOException; import java.io.PrintWriter; import javax.servlet.ServletException; import javax.servlet.annotation.WebServlet; import javax.servle…
tagged with: http://stackoverflow.com/tag/html
has comment: http://stackoverflow.com/comment/34567625
has title: Java Servlet that Validates an HTML Form
has comment: http://stackoverflow.com/comment/34567950
score: 0
accepted answer: http://stackoverflow.com/a/22689896
tagged with: java
tagged with: forms
has comment: http://stackoverflow.com/comment/34567413
tagged with: servlets
type: AnsweredQuestion

http://stackoverflow.com/a/22715815
has body: You need thread safety on your count so use an AtomicInteger for it: AtomicInteger numClients = new AtomicInteger(0); For your main problem you seem to be confusing variable declaration, variable assignment and object construction as your code is very scrambled. Try: Thread thread = new Thread("C "+numClients.getAndIncrement()); Do some reading up on the three things I listed above and it should help your understanding.
has comment: http://stackoverflow.com/comment/34616068
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/34616385
has comment: http://stackoverflow.com/comment/34616287
answers question: http://stackoverflow.com/q/22715710
type: Answer
accepted answer of: http://stackoverflow.com/q/22715710
upvote count: 2
score: 2

http://stackoverflow.com/q/22807565
upvote count: 2
has title: Servlet file upload ismultipartcontent returns false
score: 2
type: AnsweredQuestion
has body: I am trying to upload a selected file from the local file system to a folder within the application. Here technology used is jsp, servlet. On clicking the Press button of Example.jsp, the control passes to the Request servlet. But the checking that if the request is multi part returns false. so "Sorry this Servlet only handles file upload request" is printed in the console. Example.jsp Start date: End date: Input File: to upload the file! Regular Manual Final Request - doPost method jsp_request = request.getParameter("type"); if (jsp_request.equalsIgnoreCase("upload")) { String file_location = request.getParameter("datafile"); ServletFileUpload uploader = null; //Checking if the request is multipart if(ServletFileUpload.isMultipartContent(request)){ try { String upload_location_holder = request.getServletContext().getRealPath(""); upload_location_holder = upload_location_holder.substring(0,upload_location_holder.indexOf(".")) + upload_location_holder.substring(upload_location_holder.lastIndexOf("/")+1); //excel file goes into the input files folder String excel_name = upload_location_holder + "/WebContent/input_files/" + file_location; File file = new File(excel_name); DiskFileItemFactory fileFactory=new DiskFileItemFactory(); fileFactory.setRepository(file); uploader = new ServletFileUpload(fileFactory); List<FileItem> fileItemsList = uploader.parseRequest(request); Iterator<FileItem> fileItemsIterator = fileItemsList.iterator(); while (fileItemsIterator.hasNext()) { FileItem item = (FileItem) fileItemsIterator.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()); item.write(uploadedFile); } } //File uploaded successfully request.setAttribute("message", "File Uploaded Successfully"); } catch (Exceptio…
tagged with: java
accepted answer: http://stackoverflow.com/a/22807762
type: Question
tagged with: jsp
tagged with: servlets
downvote count: 0
answer count: 1
favorite count: 0
has answer: http://stackoverflow.com/a/22807762

android-ndk
tags question: http://stackoverflow.com/q/22794397
type: Tag
tag name: android-ndk
tags question: http://stackoverflow.com/q/22769023
tags question: http://stackoverflow.com/q/22752555
tags question: http://stackoverflow.com/q/22800593
tags question: http://stackoverflow.com/q/22782786
tags question: http://stackoverflow.com/q/22794743
tags question: http://stackoverflow.com/q/22709205
tags question: http://stackoverflow.com/q/22751819
tags question: http://stackoverflow.com/q/22718954
tags question: http://stackoverflow.com/q/22779016
tags question: http://stackoverflow.com/q/22648682

http://stackoverflow.com/comment/34535868
has text: It doesn't solve the initial jump, I added those too to see if the problem comes from calculating the scrollbars' size into the position (which it shouldn't) but it's not that. One thing which is curious already is that your image does not have a constant size. Set the frame to full screen size, zoom in maximally, resize the frame to a very smal size, then zoom out - you get a tiny image. Is this intentional?
score: 0
comment on: http://stackoverflow.com/q/22649636
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/34531468
has text: quick answer, if assertEquals fails, No.
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/22666833
score: 0

http://stackoverflow.com/comment/34662011
score: 0
comment on: http://stackoverflow.com/q/22734849
type: Comment
type: QuestionComment
has text: @Eugene Thanks, for your response. As far as I understood, Apache-Spark should deal with such amounts of data and cache part of the data on disk or re-read it again in case of memory problems. I didn't put the code, as I don't suppose a bug in my code, which 1) is very simple; 2) works OK if I don't cache/persist. I may paste it if you find it useful?

http://stackoverflow.com/q/22694884
has comment: http://stackoverflow.com/comment/34578750
has answer: http://stackoverflow.com/a/39385411
has answer: http://stackoverflow.com/a/60900641
has title: Filter Java Stream to 1 and only 1 element
has comment: http://stackoverflow.com/comment/34578703
tagged with: java
upvote count: 344
has answer: http://stackoverflow.com/a/71075614
has answer: http://stackoverflow.com/a/34663949
has answer: http://stackoverflow.com/a/22695141
has comment: http://stackoverflow.com/comment/131356333
has answer: http://stackoverflow.com/a/70506578
has answer: http://stackoverflow.com/a/79127088
has answer: http://stackoverflow.com/a/43994779
possible better answer: http://stackoverflow.com/a/34663949
has comment: http://stackoverflow.com/comment/34578636
has answer: http://stackoverflow.com/a/40556381
has answer: http://stackoverflow.com/a/34715168
has answer: http://stackoverflow.com/a/22695031
favorite count: 0
has answer: http://stackoverflow.com/a/63864341
has answer: http://stackoverflow.com/a/22717262
has answer: http://stackoverflow.com/a/52006240
has answer: http://stackoverflow.com/a/70580994
has answer: http://stackoverflow.com/a/79417540
has body: I am trying to use Java 8 Streams to find elements in a LinkedList. I want to guarantee, however, that there is one and only one match to the filter criteria. Take this code: public static void main(String[] args) { LinkedList&lt;User&gt; users = new LinkedList&lt;&gt;(); users.add(new User(1, "User1")); users.add(new User(2, "User2")); users.add(new User(3, "User3")); User match = users.stream().filter((user) -&gt; user.getId() == 1).findAny().get(); System.out.println(match.toString()); } static class User { @Override public String toString() { return id + " - " + username; } int id; String username; public User() { } public User(int id, String username) { this.id = id; this.username = username; } public void setUsername(String username) { this.username = username; } public void setId(int id) { this.id = id; } public String getUsername() { return username; } public int getId() { return id; } } This code finds a User based on their ID. But there are no guarantees how many Users matched the filter. Changing the filter line to: User match = users.stream().filter((user) -&gt; user.getId() &lt; 0).findAny().get(); Will throw a NoSuchElementException (good!) I would like it to throw an error if there are multiple matches, though. Is there a way to do this?
has comment: http://stackoverflow.com/comment/34578930
has answer: http://stackoverflow.com/a/23848844
answer count: 26
has answer: http://stackoverflow.com/a/50514439
has answer: http://stackoverflow.com/a/34665668
type: AnsweredQuestion
tagged with: java-stream
has answer: http://stackoverflow.com/a/30204384
score: 342
has comment: http://stackoverflow.com/comment/82029401
has answer: http://stackoverflow.com/a/64353738
has answer: http://stackoverflow.com/a/22706286
downvote count: 2
accepted answer: http://stackoverflow.com/a/22695031
has answer: http://stackoverflow.com/a/41838193
has answer: http://stackoverflow.com/a/68709279
tagged with: lambda
tagged with: java-8
has answer: http://stackoverflow.com/a/57904796
type: Question
has comment: http://stackoverflow.com/comment/119876822
has answer: http://stackoverflow.com/a/22695424

http://stackoverflow.com/q/22778981
tagged with: get
has comment: http://stackoverflow.com/comment/34729899
accepted answer: http://stackoverflow.com/a/22779379
tagged with: lru
has body: The error looks like this Exception in thread "Thread-1" java.lang.NullPointerException at java.util.LinkedHashMap$Entry.remove(LinkedHashMap.java:332) at java.util.LinkedHashMap$Entry.recordAccess(LinkedHashMap.java:356) at java.util.LinkedHashMap.get(LinkedHashMap.java:304) at Server.getLastFinishedCommands(Server.java:9086) at Server.processPacket(Server.java:484) at PacketWorker.run(PacketWorker.java:34) at java.lang.Thread.run(Thread.java:744) Inside getLastFinishedCommands I use public List&lt;CCommand&gt; getLastFinishedCommands(UserProfile player) { List&lt;CCommand&gt; returnList = new ArrayList&lt;CCommand&gt;(); if(!finishedCommands.containsKey(player.myWebsitecmd-1)) { getSavedState(player); return null; } try { //&lt;-- added this try/catch so it doesn't happen again. //Get commands. CCommand cmd; long i; long startIndex = player.myWebsitecmd; long endIndex = startIndex+LIMIT_COMMANDS; for(i = startIndex; i &lt;= endIndex; i++) { cmd = finishedCommands.get(i); //&lt;-- this is line 9086 if(cmd == null) { return returnList; } returnList.add(cmd); } } catch(Exception e) {} //&lt;-- added this try/catch so it doesn't happen again. return returnList; } I wanted to make a Map that auto removes old entries so I used this snippet public static &lt;K, V&gt; Map&lt;K, V&gt; createLRUMap(final int maxEntries) { return new LinkedHashMap&lt;K, V&gt;(maxEntries*3/2, 0.7f, true) { @Override protected boolean removeEldestEntry(Map.Entry&lt;K, V&gt; eldest) { return size() &gt; maxEntries; } }; } Used it like this public static int final MAX_COMMANDS_QUEUE = 5000; public Map&lt;Long, CCommand&gt; finishedCommands = createLRUMap(MAX_COMMANDS_QUEUE); Obviously it's some kind of CocurrentModifcationException which happens when using with multiple threads.. but why does it crash internally, anyone know how I can use this with like a CocurrentHashMap? I'm trying to fix this without resorting to just putting a try/catch around the whole getLastFinishedCommands function. I wa…
favorite count: 0
has comment: http://stackoverflow.com/comment/34729983
tagged with: dictionary
tagged with: linkedhashmap
type: AnsweredQuestion
score: 3
has title: Java LinkedHashMap with removeEldestEntry causes java.lang.NullPointerException
upvote count: 3
has comment: http://stackoverflow.com/comment/34729867
tagged with: java
has answer: http://stackoverflow.com/a/22779379
type: Question
answer count: 2
possible better answer: http://stackoverflow.com/a/22779197
has comment: http://stackoverflow.com/comment/34729976
has answer: http://stackoverflow.com/a/22779197
downvote count: 0

http://stackoverflow.com/comment/34572222
type: Comment
score: 1
has text: The question is not about what changed in Java implementation but in mine.
type: AnswerComment
comment on: http://stackoverflow.com/a/22691683

http://stackoverflow.com/q/22779253
downvote count: 0
score: 4
answer count: 3
has answer: http://stackoverflow.com/a/22779393
favorite count: 0
possible better answer: http://stackoverflow.com/a/22779361
has answer: http://stackoverflow.com/a/22779361
has answer: http://stackoverflow.com/a/22779371
type: AnsweredQuestion
tagged with: return-value
has title: LIBGDX: What is the meaning of the return value of an InputAdapter's keyDown, keyUp...etc
tagged with: java
accepted answer: http://stackoverflow.com/a/22779393
has body: I am having problems handling inputs from more than one separate InputAdapters that use keyDown/keyUp. Gdx.input.setInputProcessor( new InputMultiplexer( keyboardController1, keyboardController2, keyboardController3)); Only the first one in line works, while the others don't; in this case keyboardController1. I am guessing it has something to do with the return true; at the end of the keyDown() methods'. I tried reading the documentation, tutorials, post...etc But, I still can't get a good grasp on what the return value means and does, nor to which boolean value I should set it to. My question: What is the meaning of the boolean return value of the keyDown/keyUp(and so forth)? http://libgdx.badlogicgames.com/nightlies/docs/api/com/badlogic/gdx/InputProcessor.html#keyDown%28int%29
type: Question
upvote count: 4
tagged with: libgdx

http://stackoverflow.com/comment/34586769
has text: Okay thank you very much! Everything was very helpful, I understand the idea, now I have to figure out how to use this within an Array, and populate other parallel arrays to work multiple names and number values.
type: Comment
comment on: http://stackoverflow.com/a/22699267
type: AnswerComment
score: 0

http://stackoverflow.com/a/22904805
downvote count: 0
type: Answer
score: 2
has body: I tried working with List view. Its working fine.For selecting a particular value on the list view and getting its index, I used the following code snippet. public ListView&lt;String&gt; jlstDefects ; public TextField fldDefectName; private void jltDefectsListItemSelected() { int ndx = jlstDefects.getSelectionModel().getSelectedIndex(); if (ndxJlstDefectSelector == ndx) return; ndxJlstDefectSelector = ndx; String strSelectedDefectName = lstDefectList.getDefect(ndx); fldDefectName.setText(strLocalDefectName); } I have assigned the item which I got from the list view to a text field in my application. Thanks for the suggestions provided.
upvote count: 2
type: AcceptedAnswer
answers question: http://stackoverflow.com/q/22807601
accepted answer of: http://stackoverflow.com/q/22807601

http://stackoverflow.com/a/22727128
type: Answer
upvote count: 1
accepted answer of: http://stackoverflow.com/q/22727013
has comment: http://stackoverflow.com/comment/34637728
has body: Yes. You can call Collections.sort(listOfHorses) before the for loop on listOfHorses, and do the same with listOfCows. Let me point out that -- homework aside -- it's a poor design idea for a toString() method to do a lot of computation, and an even worse design idea for it to have side effects (in this case, modifying the arraylists). toString() ought to be free of side effects. When called by the debugger or a logging statement, those side effects will change what the program does and cause confusion. Also, a loop that does output += string will be slower than building up the string in a StringBuffer. If the number of iterations is large, it will be much slower since the work it does will be O(N^2), that is, proportional to the number of strings squared rather than proportional to the number of strings.
score: 1
answers question: http://stackoverflow.com/q/22727013
has comment: http://stackoverflow.com/comment/34636940
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/34637056
has comment: http://stackoverflow.com/comment/34636971
has comment: http://stackoverflow.com/comment/34637117

http://stackoverflow.com/q/22664284
tagged with: java
type: Question
accepted answer: http://stackoverflow.com/a/22664353
answer count: 1
downvote count: 0
favorite count: 0
score: 1
tagged with: mysql
upvote count: 1
tagged with: prepared-statement
has title: Prepared statement error when trying to receive password from DB
has body: I get an error in this method: public String databaseServer(String email)throws IllegalArgumentException { Connection dbCon = null; Statement stmt = null; String password = null; System.out.print(email); String query = "SELECT password FROM user WHERE email = ?"; try { dbCon = initializeDBConnection(); PreparedStatement preparedStatement = dbCon.prepareStatement(query); preparedStatement.setString(1, email); ResultSet rs = preparedStatement.executeQuery(query); while (rs.next()) { password = rs.getString("password"); } } catch (SQLException ex) { Logger.getLogger(Collection.class.getName()) .log(Level.SEVERE, null, ex); } //close connection ,stmt and resultset here return password; } The error is: com.mysql.jdbc.exceptions.jdbc4.MySQLSyntaxErrorException: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '?' at line 1 I've checked the connection and the incoming string and they both work fine. Anybody knows what I'm doing wrong?
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/22664353

http://stackoverflow.com/q/22687930
tagged with: java
has answer: http://stackoverflow.com/a/22688155
score: 0
answer count: 2
has answer: http://stackoverflow.com/a/22688212
has title: How to load int and char use BufferedReader in java?
tagged with: bufferedreader
has body: I have a question about how to load int and char using BufferedReader in java. I need to load in a given String str ="2 3 XX...XXXX..."... something like that. It contains 2 integers and a String. Now I need to load the 2 numbers first and then I need to load the string and I then need to read the string char by char, like read the XX...XXXX... part as X and X and . and so on. Here is part of my code: BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); String str=br.readLine(); number1 = Integer.parseInt(a); number2 = Integer.parseInt(a); But this seems to be wrong and I don't know how to continue. So can anyone tell me how to deal with that?
type: UnansweredQuestion
type: Question

query-builder
tags question: http://stackoverflow.com/q/22802323
type: Tag
tag name: query-builder

http://stackoverflow.com/a/22762177
accepted answer of: http://stackoverflow.com/q/22749024
answers question: http://stackoverflow.com/q/22749024
type: AcceptedAnswer
downvote count: 0
type: Answer
score: 1
upvote count: 1
has body: I solved without the use of the cookies: I created a java web service to create/return the jsessionid string from Dart I call the previous web service and store the jsessionid in a local variable all the following Dart HttpRequest have the jsessionid in the url like "http://server/app/wsxyz;jsessionid=14F5FA9836512AF"

http://stackoverflow.com/q/22692622
type: AnsweredQuestion
tagged with: java
type: Question
tagged with: forum
tagged with: jsoup
score: 0
answer count: 1
has title: Making an android app for a website
has answer: http://stackoverflow.com/a/22692772
accepted answer: http://stackoverflow.com/a/22692772
tagged with: android
has body: I'm trying to make an app for website that I DO NOT OWN OR HAVE ACCESS TO ITS DB. The website is a forum community website and I wish make an app that can list the menu and the posts in a UI suited for mobile. Also I am trying to see if I add real time notice function that will let the thread poster know when there is a new comment/post to his or her thread. (Website does not support this function) Do you guys think I can achieve this through Jsoup or would I need other utilities too? Also I am quite a beginner in java so the app cannot be too complicated. Thanks.

http://stackoverflow.com/a/22794888
upvote count: 1
type: AcceptedAnswer
downvote count: 0
type: Answer
score: 1
accepted answer of: http://stackoverflow.com/q/22794839
has body: In Eclipse, right-click on your project and select Export. Under Java select Runnable JAR file and go from there.
has comment: http://stackoverflow.com/comment/34758941
answers question: http://stackoverflow.com/q/22794839

http://stackoverflow.com/q/22696741
favorite count: 0
tagged with: iso-8859-1
upvote count: 1
has comment: http://stackoverflow.com/comment/34702353
tagged with: spring
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/22791658
score: 1
tagged with: java
tagged with: character-encoding
has comment: http://stackoverflow.com/comment/34582377
type: Question
has title: Encoding Issues - I think UTF-8 is being treated as ISO-8859-1
has comment: http://stackoverflow.com/comment/34582301
has comment: http://stackoverflow.com/comment/34752367
has comment: http://stackoverflow.com/comment/34732277
downvote count: 0
has comment: http://stackoverflow.com/comment/34750792
has body: I've got a Web Service that is defined using the javax ws annotations to deifne the service endpoint as follows: @GET @Path("eventBir") @Produces(MediaType.APPLICATION_XML) public String getEventsBir( @QueryParam("applicationId") String applicationId); The response can contain foreign characters which are getting encoded somehow to be incorrect. An example of part of the response when it leaves the above service: &lt;Market name="Apuestas con hándicap en vivo"&gt; But by the time it reaches the external application, it is being encoded somehow to give: &lt;Market name="Apuestas con hÃ¡ndicap en vivo"&gt; I found this website that seems to have my exact issue defined. So it looks like I'm getting a UTF-8 encoded string and passing it through some code that encodes it as ISO-8859-1. However, I'm struggling with how to go about fixing it. After my Service has returned the String, the string is passed through what I believed to be Spring created code to wrap the web service. It could also be being mangled by the web server, I'm not sure. Is there some encoding I can do on the String before returning it? Or is there some Spring configuration I can set to set the response as UTF-8 encoded? EDIT: Found the offending Spring Class It looks like the offending class within the Spring wrapper for the web service is StringHttpMessageConverter Here's the class in Grep Code There is a default character set defined within this class of "ISO-8859-1" and this is what is parsing the response (which is in UTF-8) so I'm ending up with the issue described above. So now I'm looking for a nice way to fix this.
has answer: http://stackoverflow.com/a/22906491
answer count: 2
has answer: http://stackoverflow.com/a/22791658
tagged with: utf-8
has comment: http://stackoverflow.com/comment/34752494
possible better answer: http://stackoverflow.com/a/22906491

http://stackoverflow.com/q/22689041
answer count: 1
downvote count: 0
favorite count: 0
has body: My aim is to work with general instance of Redis server from several app instances (read-write access). I need it to share web session id and session meta information between several web application servers. When only one instance of web app is up, everything is going fine, but when second instance initialized, db is flushed, so data inserted by first app is gone. I tried out 2 ways of connection establishment: with spring ApplicationContext context = new ClassPathXmlApplicationContext( config.getString(Constants.REDIS_CONFIG_FILE)); this.redisTemplate = (RedisTemplate) context.getBean("redisTemplate"); &lt;bean id="jedisConnectionFactory" class="org.springframework.data.redis.connection.jedis.JedisConnectionFactory" p:use-pool="true" p:host-name="${oiosaml-sp.sessionhandler.redis.url}" p:port="${oiosaml-sp.sessionhandler.redis.port}"/&gt; &lt;!-- redis template definition --&gt; &lt;bean id="redisTemplate" class="org.springframework.data.redis.core.RedisTemplate" p:connection-factory-ref="jedisConnectionFactory"/&gt; and with jedis String redisUrl = config.getString(Constants.REDIS_URL); String redisPort = config.getString(Constants.REDIS_PORT); if (redisUrl == null || redisPort == null) { throw new IllegalArgumentException( PROPERTY_IS_NOT_SET_ERROR_MESSAGE); } JedisPoolConfig poolConfig = new JedisPoolConfig(); poolConfig.setMaxTotal(MAX_CONNECTION_AMOUNT); this.pool = new JedisPool(poolConfig, redisUrl, Integer.parseInt(redisPort)); But in both variant i have the same issue that db is flushed when connection from second instance of app is established. And it looks like redis-server doesn't work properly in this situation. What am i doing wrong?
has answer: http://stackoverflow.com/a/22689803
tagged with: redis
has title: java work with redis from several app instances
type: AnsweredQuestion
score: 1
upvote count: 1
tagged with: spring
accepted answer: http://stackoverflow.com/a/22689803
type: Question
tagged with: java
tagged with: jedis

jgss
tags question: http://stackoverflow.com/q/22776533
type: Tag
tag name: jgss

http://stackoverflow.com/q/22707924
has title: Connecting to https with Socket
tagged with: java
tagged with: ssl
has answer: http://stackoverflow.com/a/22725496
possible better answer: http://stackoverflow.com/a/22708146
answer count: 2
has answer: http://stackoverflow.com/a/22708146
upvote count: 0
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/22725496
tagged with: android
score: -2
favorite count: 0
has body: My app is based on Sockets, but regular Sockets, not SSLSockets. Do I have to change all of them to SSL sockets to be able connect to https server?
type: Question
downvote count: 2

http://stackoverflow.com/a/22714536
has body: Thread can't update GUI You can use runOnUiThread() method or use Handler EDIT : example of Handler : How to use an Android Handler to update a TextView in the UI Thread?
type: Answer
has comment: http://stackoverflow.com/comment/34613856
score: 2
upvote count: 3
has comment: http://stackoverflow.com/comment/34613771
downvote count: 1
accepted answer of: http://stackoverflow.com/q/22714476
has comment: http://stackoverflow.com/comment/34613908
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/34614466
answers question: http://stackoverflow.com/q/22714476

http://stackoverflow.com/a/22663090
score: 1
upvote count: 1
has body: You could just create the second JFrame the same way you create the first one. But what you're looking for is probably a dialog: http://docs.oracle.com/javase/tutorial/uiswing/components/dialog.html If your question is about how to do something when a button is clicked, you're looking for an ActionListener: http://docs.oracle.com/javase/tutorial/uiswing/events/actionlistener.html
answers question: http://stackoverflow.com/q/22663046
downvote count: 0
has comment: http://stackoverflow.com/comment/34520977
type: Answer

http://stackoverflow.com/q/22676670
downvote count: 0
has body: Ok, so this is my assignment. I conceptually understand what needs to be done, but I am having trouble on how I should go about executing it. Write a program which accepts a filename (as a "command parameter") for a two dimensional grid of random letters and returns the name and the number of groups of A, groups of B, etc. (Attached is an example of a portion of a solution for 7.46 in the text, as written.) You may assume the grid is exactly 10 rows and 20 columns. There can be up to 3 unique characters (not that the upper bound matters to the algorithm). NOTE: You should not need to know how many unique characters actually exist before processing begins, but assuming an "upper bound" just gives your code the ability to "prepare" for a given amount. The grid does not "wrap" (ie. moving off the left side does not move you back onto the right, like Pac-Man) If you find it easier to make the grid wrap around a torus (top connect to bottom / left connected to right), feel free to do so. Just indicate that you have made this design decision in you submission. Wrapping the grid around a torus actually makes the recursive code a bit smaller, but it's just a bit more conceptually difficult. Groups are collections of matching letters connected either horizontally or vertically. Diagonal elements are not connected. Your program should display: The total number of unique groupings of each letter. The letter (and corresponding size) of the largest group. Examples: Input File : BBBBBABAAAAABAABBBAA AAAABBABBABBBABAABBA AAABABABAABBBBBABBAB BBAAAABAABBBBAABBBAB BAAABAABAAABBBAAAABA AABABBAAABBBABBBAABA BABBAAAABABBBBBAAABB BABABAABAAAABAABBBAA BABBAAAABBBABBAAAABB ABABBBBBABAAABABAAAA Largest group is A with 49 members starting at (0,7) Group Counts: A = 17 groups, B = 22 Groups BBBBBABXXXXXBAABBBAA XXXXBBABBXBBBABAABBA XXXBABABXXBBBBBABBAB BBXXXXBXXBBBBAABBBAB BXXXBXXBXXXBBBAAAABA XXBABBXXXBBBABBBAABA BXBBXXXXBABBBBBAAABB BXBABXXBAAAABAABBBAA BXBBXXXXBBBABBAAAABB ABABBBBBABAAABA…
tagged with: multidimensional-array
type: AnsweredQuestion
favorite count: 0
type: Question
has answer: http://stackoverflow.com/a/22679180
answer count: 1
has comment: http://stackoverflow.com/comment/34546305
tagged with: recursion
score: 4
accepted answer: http://stackoverflow.com/a/22679180
has title: 2D char array recursive search for largest group
tagged with: java
upvote count: 4
has comment: http://stackoverflow.com/comment/34548475
tagged with: algorithm

http://stackoverflow.com/comment/34691420
score: 0
type: Comment
has text: @fge :~ I think your both problem satisfy now.
comment on: http://stackoverflow.com/a/22757475
type: AnswerComment

http://stackoverflow.com/q/22720537
answer count: 1
favorite count: 0
has comment: http://stackoverflow.com/comment/34625213
has comment: http://stackoverflow.com/comment/34625171
has answer: http://stackoverflow.com/a/22721378
has body: I have 4 classes, one GUImain(observer), one subject, 2 classes implementing Runnable. The subject class starts 2 threads which are coded in the classes implementing Runnable. Thread 1 - should access each Order of an Arraylist, send the Order to the subject class and then notify the observer to be appended on to a TextArea. please tell how this can be accomplished.. Some more details about the implementation so far: GUIMain Class: JTextArea (to be filled with Orders from an ArrayList) Kitchen class: Thread run() implemented here: - Get each Order from the OrderList ( a list of 25 orders read from an input file) - send it to the subject class - so that the GUIMain(observer) can update itself. - the JTextArea should be appended by only a few orders at a time. public class Kitchen implements Runnable{ private Restaurant R; private OrderList Orders; public Kitchen() { Orders = new OrderList(); } private String getOrderReport() { String report=" "; report = Orders.OrderDetailsReport(); return report; } @Override public void run() { System.out.println("inside kitchen thread"); String report=" "; try { Thread.sleep(100); } catch (Exception e) { System.out.println("Kitchen thread exception" + e.getStackTrace()); } System.out.println(getOrderReport()); System.out.println("size of OL from kitchen thraed:"+Orders.getListSize()); System.out.println(R.getListOfOrders()); } } output: Exception in thread "Thread-3" java.lang.NullPointerException at REST.Kitchen.run(Kitchen.java:41) at java.lang.Thread.run(Thread.java:724)
type: AnsweredQuestion
tagged with: java
tagged with: multithreading
upvote count: 1
downvote count: 1
type: Question
accepted answer: http://stackoverflow.com/a/22721378
has comment: http://stackoverflow.com/comment/34624995
has title: hot to get Thread results to TextArea
score: 0

http://stackoverflow.com/a/22872120
has comment: http://stackoverflow.com/comment/34899164
has comment: http://stackoverflow.com/comment/34901424
has comment: http://stackoverflow.com/comment/34902776
has comment: http://stackoverflow.com/comment/34902972
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/34902989
has comment: http://stackoverflow.com/comment/34901112
has comment: http://stackoverflow.com/comment/34902708
has comment: http://stackoverflow.com/comment/34902371
has comment: http://stackoverflow.com/comment/34903162
downvote count: 0
has comment: http://stackoverflow.com/comment/34902692
has body: Based on this command line overlapping jars report (a tool I made), there are two hibernate versions in WEB-INF/lib of the WAR: &gt;&gt;&gt;&gt; Jar overlap report: hibernate-3.1.jar overlaps with hibernate-core-4.3.4.Final.jar - total overlapping classes: 494 jboss-transaction-api_1.2_spec-1.0.0.Final.jar overlaps with jta-1.0.1B.jar - total overlapping classes: 17 Total number of classes with more than one version: 511 Looking further in the POM with mvn dependency:tree we can see where the duplicates come from: [INFO] +- org.hibernate:hibernate-core:jar:4.3.4.Final:compile ... [INFO] +- org.hibernate:hibernate:jar:3.1:compile In this case there are two versions of hibernate added in the classpath, as hibernate is declared twice with different artifact names. The solution for this is to choose only one version of Hibernate, removing the other from the POM. The best would be to choose 4.3.4.Final because 3.1 is very ancient.
has comment: http://stackoverflow.com/comment/34901350
has comment: http://stackoverflow.com/comment/34903080
type: Answer
has comment: http://stackoverflow.com/comment/34901232
has comment: http://stackoverflow.com/comment/34903062
score: 3
accepted answer of: http://stackoverflow.com/q/22750449
has comment: http://stackoverflow.com/comment/34899224
upvote count: 3
answers question: http://stackoverflow.com/q/22750449

http://stackoverflow.com/q/22796304
tagged with: arrays
has answer: http://stackoverflow.com/a/22796377
has answer: http://stackoverflow.com/a/22796353
downvote count: 0
has title: How to add numbers to an array in form of strings?
tagged with: string
score: 1
has body: My Question is following: Given a number n as input, return a new string array of length n, containing the strings “0″, “1″, “2″ so on till n-1. If n=0, return an array of length 0.The expected output is- stringArray(4) = {"0","1","2","3"} and the actual output is stringArray(4) = {0,1,2,3}.How can I add numbers in the form of string. public class ArrayOfNumbers { static int testcase1=4; public static void main(String[] args){ ArrayOfNumbers testInstance=new ArrayOfNumbers(); String[] result=testInstance.arrayOfNumbers(testcase1); System.out.print("{"); for (int i=0;i&lt;result.length;i++){ if (i&gt;0) System.out.print(","); System.out.print(result[i]); } System.out.println("}"); } public String[] arrayOfNumbers(int num) { int n=0; String n1="n"; String[] arr=new String[num]; for(int i=0;i&lt;num;i++){ arr[i]=n1; n=n+1; } return arr; } }
has comment: http://stackoverflow.com/comment/34761167
favorite count: 0
has comment: http://stackoverflow.com/comment/61950636
type: Question
answer count: 3
upvote count: 1
has answer: http://stackoverflow.com/a/22796431
tagged with: java
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/34761037

javafx
tags question: http://stackoverflow.com/q/22745270
tags question: http://stackoverflow.com/q/22729010
type: Tag
tags question: http://stackoverflow.com/q/22683220
tags question: http://stackoverflow.com/q/22708098
tags question: http://stackoverflow.com/q/22730227
tags question: http://stackoverflow.com/q/22769723
tags question: http://stackoverflow.com/q/22732013
tags question: http://stackoverflow.com/q/22711557
tags question: http://stackoverflow.com/q/22787406
tags question: http://stackoverflow.com/q/22722524
tags question: http://stackoverflow.com/q/22667855
tags question: http://stackoverflow.com/q/22807887
tags question: http://stackoverflow.com/q/22681781
tags question: http://stackoverflow.com/q/22808223
tags question: http://stackoverflow.com/q/22772094
tags question: http://stackoverflow.com/q/22795986
tags question: http://stackoverflow.com/q/22774332
tags question: http://stackoverflow.com/q/22663269
tags question: http://stackoverflow.com/q/22749621
tag name: javafx
tags question: http://stackoverflow.com/q/22759134
tags question: http://stackoverflow.com/q/22796742
tags question: http://stackoverflow.com/q/22744283
tags question: http://stackoverflow.com/q/22701066
tags question: http://stackoverflow.com/q/22689813
tags question: http://stackoverflow.com/q/22793003
tags question: http://stackoverflow.com/q/22732766
tags question: http://stackoverflow.com/q/22717583
tags question: http://stackoverflow.com/q/22684465
tags question: http://stackoverflow.com/q/22680658
tags question: http://stackoverflow.com/q/22706486
tags question: http://stackoverflow.com/q/22729508
tags question: http://stackoverflow.com/q/22769807
tags question: http://stackoverflow.com/q/22778241
tags question: http://stackoverflow.com/q/22737934
tags question: http://stackoverflow.com/q/22784681
tags question: http://stackoverflow.com/q/22744334
tags question: http://stackoverflow.com/q/22801059
tags question: http://stackoverflow.com/q/22733996
tags question: http://stackoverflow.com/q/22703868
tags question: http://stackoverflow.com/q/22672279
tags question: http://stackoverflow.com/q/22768347
tags question: http://stackoverflow.com/q/22691243
tags question: http://stackoverflow.com/q/22708506
tags question: http://stackoverflow.com/q/22774374
tags question: http://stackoverflow.com/q/22660846
tags question: http://stackoverflow.com/q/22766969
tags question: http://stackoverflow.com/q/22740585
tags question: http://stackoverflow.com/q/22725582
tags question: http://stackoverflow.com/q/22802189
tags question: http://stackoverflow.com/q/22663681
tags question: http://stackoverflow.com/q/22682072
tags question: http://stackoverflow.com/q/22754143
tags question: http://stackoverflow.com/q/22671507
tags question: http://stackoverflow.com/q/22744085
tags question: http://stackoverflow.com/q/22698829

http://stackoverflow.com/comment/34589807
score: 0
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/22693945
has text: @user3469429 You probably need to scan from index+1 on the second one.

http://stackoverflow.com/q/22728864
has answer: http://stackoverflow.com/a/22728892
type: AnsweredQuestion
downvote count: 0
score: 1
favorite count: 0
has comment: http://stackoverflow.com/comment/34639810
type: Question
accepted answer: http://stackoverflow.com/a/22728892
has answer: http://stackoverflow.com/a/22728893
possible better answer: http://stackoverflow.com/a/22728893
tagged with: java
answer count: 2
upvote count: 1
has title: Exception in thread "main" java.lang.Error: Unresolved compilation problems:
has body: This is the error I'm getting Exception in thread "main" java.lang.Error: Unresolved compilation problems: Scanner cannot be resolved to a type Scanner cannot be resolved to a type at hello.main(hello.java:11) This is my code. public class hello { public static void main(String[] args) { // TODO Auto-generated method stub double area; double radius; Scanner input = new Scanner(System.in); System.out.print("반지름을 입력하시오: "); radius = input.nextDouble(); area = 3.14 * radius * radius; System.out.println(area); } }

http://stackoverflow.com/q/22702554
has title: How do I get the program to accumulate total amount of points the user inputs each time?
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/22702648
favorite count: 0
score: -1
has comment: http://stackoverflow.com/comment/34592833
type: Question
tagged with: java
answer count: 1
downvote count: 1
has answer: http://stackoverflow.com/a/22702648
has body: package testB; import java.util.Scanner; public class testB { public static void main(String[] args) { // TODO Auto-generated method stub Scanner input = new Scanner(System.in); //Declare Variables String studentname = ""; String coursename = ""; int assignmentsubmitted = 0; int submitted = 0; int points = 0; int pt = 0; //Total points worth double tpw = 0; double score = 0; //Total score double ts = 0; System.out.println("Welcome to My Grade Calculator!"); System.out.println(""); System.out.print("Enter candidate name: "); studentname = input.nextLine(); System.out.print("Enter course name: "); coursename = input.nextLine(); System.out.println("Enter how many assignments were submitted: "); assignmentsubmitted = input.nextInt(); if (assignmentsubmitted &lt;= 0) { System.out.print("Must be a number and greater than 0! Try again."); assignmentsubmitted = input.nextInt(); } do { int i = 1; do { System.out.println("How many points was assignment " + i + ":"); i++; points = input.nextInt(); } It increments based on how many assignments user inputs while (i &lt;= assignmentsubmitted);. I want it to calculate the points the user inputs so I can display it. points += pt;
upvote count: 0
tagged with: arrays

http://stackoverflow.com/q/22752896
tagged with: java
has body: I have a program where I want to input a fake stock symbol, number of shares, and price per share. I want the user to be able to search the arraylists of stocks, and if a certain stock is found, the LIFO average price of the last 250 stocks bought is displayed. The user should be able to input a stock more than once, for example AAPL 50 99.99 and AAPL 300 50.00 So if the user bought 50 shares at 99.99 and 300 shares at 50.00, it should average the last 250 bought stocks using the correct prices. Here is where I am so far, I'm having trouble with searching the hashmap and then displaying the average of that certain stock. package stocks; import java.util.*; public class Stocks { private String sym; private List&lt;Purchase&gt; purchases; public Stocks(final String symbol) { this.sym = symbol; purchases = new ArrayList&lt;Purchase&gt;(); } public void addPurchase(final int amt, final double cost){ purchases.add(new Purchase(amt,cost)); } public String getSym(){ return sym; } public void setSym(){ this.sym = sym; } public double getAvg250() { int i = 0; int total = 0; int shares = 0; while (i &lt; purchases.size()) { Purchase p = purchases.get(i); if (shares + p.getAmt() &gt;= 250) { total += (250 - shares) * p.getCost(); shares = 250; break; } shares += p.getAmt(); i++; } return total * 1.0 / shares; } class Purchase { private int amt; private int cost; public Purchase(int amt, double cost){ } public int getAmt() { return amt; } public void setAmt(int amt) { this.amt = amt; } public int getCost() { return cost; } public void setCost(int cost) { this.cost = cost; } } public static void main(String[] args) { int choice = 0; while (choice == 0){ System.out.println("Enter 1 to input a new stock, or 2 to query a stock's price, 3 to quit: "); Scanner sc1 = new Scanner (System.in); choice = sc1.nextInt(); if(choice==1){ ArrayList&lt;Stocks&gt; StocksList = new ArrayList&lt;Stocks&gt;(); Scanner sc2 = new Scanner (System.in); System.out.println("Please enter the stock symbol:…
type: Question
has title: Search hashmap for key and print certain values
answer count: 1
score: 0
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/22753279

http://stackoverflow.com/q/22791931
type: Question
has comment: http://stackoverflow.com/comment/34752867
linked to: http://stackoverflow.com/q/4793674
tagged with: components
linked to: http://stackoverflow.com/q/22275435
has title: Swing method to show or hide part of a panel on button click?
has answer: http://stackoverflow.com/a/22792109
downvote count: 0
answer count: 1
favorite count: 0
linked to: http://stackoverflow.com/q/11283554
has comment: http://stackoverflow.com/comment/34753010
has body: I'd like to be able to show and hide (and therefore grow and shrink the jpanel as appropriate) in my swing application. I've seen something similar on websites that I imagine uses JS and JQuery. What I'm after is the ability to click a button (that might say 'Advanced options') that then 'slowly' grows the panel and reveals (setVisible(true)) components. Is this possible using Swing? I've tried looking round the web, and SO but I only seem to get JQuery questions, or unhelpful Java posts. This is the closest I've found.
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/22792109
score: 1
tagged with: java
upvote count: 1
tagged with: swing

http://stackoverflow.com/q/22767753
favorite count: 0
type: AnsweredQuestion
score: 2
has answer: http://stackoverflow.com/a/22767796
upvote count: 2
type: Question
tagged with: java
has body: I'm having difficulty using Comparators in Constructors. When I try the following code: InsertionSorter is = new InsertionSorter(bookList.toArray(new Comparable[bookList.size()]), new GenreComparator(), SortType.ASC); I get this error: no suitable constructor found for InsertionSorter(java.lang.Comparable[],sort.GenreComparator,sort.SortType) constructor sort.InsertionSorter.InsertionSorter(java.lang.Comparable[],java.util.Comparator&lt;java.lang.Object&gt;,sort.SortType) is not applicable (actual argument sort.GenreComparator cannot be converted to java.util.Comparator&lt;java.lang.Object&gt; by method invocation conversion) constructor sort.InsertionSorter.InsertionSorter(java.lang.Comparable[],sort.SortType) is not applicable (actual and formal argument lists differ in length) Here are the useful code snippets: AbstractSorter.java: abstract class AbstractSorter { protected Comparable[] values; protected Comparator&lt;Object&gt; cmp; protected SortType st; protected abstract void doSort(); protected AbstractSorter(Comparable[] init, SortType type) { values = new Comparable[init.length]; System.arraycopy(init, 0, values, 0, init.length); cmp = null; st = type; } protected AbstractSorter(Comparable[] init, Comparator&lt;Object&gt; comp, SortType type) { values = new Comparable[init.length]; System.arraycopy(init, 0, values, 0, init.length); cmp = comp; st = type; } public Comparable[] getValues() { return values; } } class InsertionSorter extends AbstractSorter { public InsertionSorter(Comparable[] init, SortType type) { super(init, type); } public InsertionSorter(Comparable[] init, Comparator&lt;Object&gt; comp, SortType type) { super(init, comp, type); } @Override public void doSort() { // sorts values } } enum SortType {ASC, DSC}; Book.java: public class Book implements Cloneable, Comparable&lt;Book&gt; { private Person author; // implementation details of Person don't matter here private String title, isbn; private int year; private BookGenre genre; public Book(…
accepted answer: http://stackoverflow.com/a/22767796
tagged with: comparator
answer count: 1
downvote count: 0
tagged with: sorting
has title: Using a Custom-Defined Comparator in a Constructor

http://stackoverflow.com/q/22664360
score: 1
tagged with: java
upvote count: 1
type: Question
tagged with: jasper-reports
has title: Getting raw file stream when print the file (pdf)
has comment: http://stackoverflow.com/comment/34524759
has comment: http://stackoverflow.com/comment/34523798
has comment: http://stackoverflow.com/comment/91453219
downvote count: 0
favorite count: 0
has comment: http://stackoverflow.com/comment/34547242
type: UnansweredQuestion
has body: I am trying print the result of JasperExportManager.exportReportToPdfStream (jasperPrint, outputStream) and getting the raw stream on the paper (printing result). I don't know if someting wrong with my java source. How to print the pdf file (create a print job)? package testprint; import java.io.File; import java.io.FileInputStream; import java.io.FileNotFoundException; import java.io.FileOutputStream; import java.io.IOException; import java.io.InputStream; import java.io.OutputStream; import java.util.HashMap; import java.util.Locale; import java.util.Map; import javax.print.Doc; import javax.print.DocFlavor; import javax.print.DocPrintJob; import javax.print.PrintException; import javax.print.PrintService; import javax.print.PrintServiceLookup; import javax.print.SimpleDoc; import javax.print.attribute.HashPrintRequestAttributeSet; import javax.print.attribute.PrintRequestAttributeSet; import javax.print.attribute.standard.Copies; import javax.print.attribute.standard.JobName; import javax.print.attribute.standard.MediaPrintableArea; import javax.print.attribute.standard.MediaSize; import javax.print.attribute.standard.MediaSizeName; import net.sf.jasperreports.engine.JREmptyDataSource; import net.sf.jasperreports.engine.JRException; import net.sf.jasperreports.engine.JasperExportManager; import net.sf.jasperreports.engine.JasperFillManager; import net.sf.jasperreports.engine.JasperPrint; public class Printing { public static void main(String[] args) { Printing printing = new Printing(); Map&lt;String, Object&gt; params = new HashMap(); params.put("TEST_PARAM", "This is a test string"); printing.print(params, 1); } public void print(Map&lt;String, Object&gt; params, int copies) { try { InputStream jasper = getClass().getResourceAsStream("/jasper/TestReport.jasper"); JasperPrint jasperPrint = JasperFillManager.fillReport(jasper, params, new JREmptyDataSource()); File tempFile = File.createTempFile("TestReport", ".tmp"); OutputStream out = new FileOutputStream(tempF…
answer count: 0

http://stackoverflow.com/a/22736224
score: 1
has comment: http://stackoverflow.com/comment/34653381
accepted answer of: http://stackoverflow.com/q/22728129
answers question: http://stackoverflow.com/q/22728129
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/34683278
has comment: http://stackoverflow.com/comment/34675504
type: Answer
has comment: http://stackoverflow.com/comment/34653016
has body: If I have not missed anything I think the error "No suitable driver found" comes because of not having the below line in Java code. Let me know if I am missing anything. Class.forName("com.mysql.jdbc.Driver"); you can add this in "LoginServiceImplem" class. in a static block something like static { Class.forName("com.mysql.jdbc.Driver"); }
has comment: http://stackoverflow.com/comment/34662590
has comment: http://stackoverflow.com/comment/34654332
upvote count: 1
has comment: http://stackoverflow.com/comment/34673429

http://stackoverflow.com/a/22795699
has comment: http://stackoverflow.com/comment/34816316
has comment: http://stackoverflow.com/comment/34771095
type: Answer
has body: In your jetty maven plugin you can create multiple connectors that can run on different ports. That's a first start. I'm not sure offhand how or if those connector blocks can run different wars. They can refer to different jetty.xml (although I've had nothing but trouble with jetty.xml) http://www.eclipse.org/jetty/documentation/current/jetty-maven-plugin.html#configuring-jetty-container
answers question: http://stackoverflow.com/q/22771931
score: 0

http://stackoverflow.com/comment/34589562
has text: You can use `blaa()`. WIthout any prefix. I find it clearer with Foo.blaa(), but you're not forced to add the class name if it's the current class.
comment on: http://stackoverflow.com/q/22700944
type: Comment
type: QuestionComment
score: 2

http://stackoverflow.com/a/22733554
accepted answer of: http://stackoverflow.com/q/22733401
has comment: http://stackoverflow.com/comment/34648156
type: AcceptedAnswer
downvote count: 0
has body: Use Class#isInstance. class TypeChecker&lt;T&gt; { private Class&lt;T&gt; ofType; TypeChecker(Class&lt;T&gt; ofType) { this.ofType = ofType; } boolean isGood(Object obj) { return ofType.isInstance(obj); } } Or just use the Class instead of making a wrapper object around it if all you need is the isInstance check. There is not another way to perform run-time type checking dynamically. You must use a Class. isInstance has the same semantics as instanceof (except that the left and right hand sides are flipped) so "hello world" instanceof String String.class.isInstance("hello world") both are true. Also, your 'maybe works' snippet, no that does not work. Generics are erased so unchecked casts do not happen at run-time. That is why they are unchecked. The ClassCastException will never throw. Using exceptions to determine logical flow is not good to begin with.
type: Answer
answers question: http://stackoverflow.com/q/22733401
score: 10
upvote count: 10

http://stackoverflow.com/q/22751663
has comment: http://stackoverflow.com/comment/34680989
answer count: 1
has comment: http://stackoverflow.com/comment/34680735
has comment: http://stackoverflow.com/comment/34680924
tagged with: android
has comment: http://stackoverflow.com/comment/34680999
has answer: http://stackoverflow.com/a/22751757
has comment: http://stackoverflow.com/comment/34680705
has comment: http://stackoverflow.com/comment/34680801
score: 0
type: AnsweredQuestion
has title: Android activity goes black then crashes
tagged with: java
accepted answer: http://stackoverflow.com/a/22751757
has comment: http://stackoverflow.com/comment/34680956
type: Question
has body: I recently started developing apps, and I've gotten my first gig. It's a simple app with a logo and a button linking to a website. Everytime I run it, it crashes, and I'm stumped as to why, as it's such a simple program. I've spent a lot of time looking for similar problems on SO, but to no avail. I've also gone through eclipse and eliminated any compiler warnings. Does anyone have an idea as to what could have gone wrong? Error messages: I've kept cutting things out over and over to the app's most simple function. It still won't work. Here is my .java and main activity. (It's a one activity and one class app) //necessary imports are omitted. I get no errors for imports public class FullscreenActivity extends Activity { Button button = (Button) findViewById(R.id.button1); @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_fullscreen); button = (Button) findViewById(R.id.button1); button.setOnClickListener(new View.OnClickListener() { public void onClick(View v) { goToUrl("http://switchemup.com"); } }); } private void goToUrl(String url) { Uri uriUrl = Uri.parse(url); Intent launchBrowser = new Intent(Intent.ACTION_VIEW, uriUrl); startActivity(launchBrowser); } @Override public boolean onCreateOptionsMenu(Menu menu) { // Inflate the menu; this adds items to the action bar if it is present. getMenuInflater().inflate(R.menu.fullscreen, menu); return true; } } &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=".FullscreenActivity" &gt; &lt;ImageView android:id="@+id/imageView1" android:layout_width="wrap_content" …

http://stackoverflow.com/comment/34616994
type: QuestionComment
comment on: http://stackoverflow.com/q/22716119
has text: I think you're looking for `#{...}`.
score: 0
type: Comment

http://stackoverflow.com/comment/34498467
score: 1
type: QuestionComment
type: Comment
has text: What JDBC driver version are you using? It doesn't appear to implement `createArrayOf`.
comment on: http://stackoverflow.com/q/22649964

http://stackoverflow.com/comment/34515761
type: Comment
score: 0
comment on: http://stackoverflow.com/q/22660188
has text: Probably duplicate of http://stackoverflow.com/questions/509076/how-do-i-address-unchecked-cast-warnings?rq=1
type: QuestionComment

http://stackoverflow.com/q/22753131
accepted answer: http://stackoverflow.com/a/22753154
answer count: 1
has title: Print elements of a list in a 10x10 table
has body: I am trying to print the 100 elements of a LinkedList in a 10 x 10 table. I have the following code: for (int a = 0; a &lt; 10; a++) { System.out.print(lList.get(a) + " "); }//end for System.out.println(""); for (int a = 10; a &lt; 20; a++) { System.out.print(lList.get(a) + " "); }//end for System.out.println(""); for (int a = 20; a &lt; 30; a++) { System.out.print(lList.get(a) + " "); }//end for System.out.println(""); for (int a = 30; a &lt; 40; a++) { System.out.print(lList.get(a) + " "); }//end for System.out.println(""); for (int a = 40; a &lt; 50; a++) { System.out.print(lList.get(a) + " "); }// end for System.out.println(""); for (int a = 50; a &lt; 60; a++) { System.out.print(lList.get(a) + " "); }// end for System.out.println(""); for (int a = 60; a &lt; 70; a++) { System.out.print(lList.get(a) + " "); }// end for System.out.println(""); for (int a = 70; a &lt; 80; a++) { System.out.print(lList.get(a) + " "); }// end for System.out.println(""); for (int a = 80; a &lt; 90; a++) { System.out.print(lList.get(a) + " "); }// end for System.out.println(""); for (int a = 90; a &lt; 100; a++) { System.out.print(lList.get(a) + " "); }// end for But obviously its way too much, and not practical at all. I have been playing with this for hours trying to simplify this into a for loop or something that would change this into a few lines max, but haven't been able to figure it out. Any suggestions for a better way to go about this?
type: AnsweredQuestion
tagged with: linked-list
tagged with: java
type: Question
score: 0
has answer: http://stackoverflow.com/a/22753154

http://stackoverflow.com/q/22648715
type: UnansweredQuestion
tagged with: java
has answer: http://stackoverflow.com/a/22648760
type: Question
score: -2
answer count: 1
favorite count: 0
has comment: http://stackoverflow.com/comment/34496596
downvote count: 2
has title: Why is the output always 0.0?
has body: //creates SevenTally class public class SevenTally{ private int count; public SevenTally(int diceCount){ this.count = diceCount; } //creates experiment method public boolean experiment(){ int winCount = 0; //creates array of dice rolled according to input int[] diceRolls = new int[count]; //assigns random value from 1 to 6 to each array value for(int x = 0; x &lt; diceRolls.length; x++) { diceRolls[x] = (1 + (int)(6 * Math.random())); for(int n = 0; n &lt; diceRolls.length; n++) { for(int m = n + 1; m &lt; n; m++){ //checks for two dice in the total rolls that sum to 7 if (diceRolls[n] + diceRolls[m] == 7) winCount++; } } } if (winCount &gt; 0) return true; else return false; } } It seems like the problem is with the array for loop. I tested just that section of the code and it was properly inputting values into my array but when I put the whole thing together, I think the array is left empty or empties after exiting the loop. This is the class driver: import java.util.Scanner; public class SevenDriver{ public static void main(String[] args){ System.out.println("Enter number of dice to toss"); Scanner s = new Scanner(System.in); int diceCount = s.nextInt(); SevenTally t = new SevenTally(diceCount); int experiments = 1000000; int wins = 0; for(int j = 0; j &lt; experiments; j++) if(t.experiment()) wins++; System.out.println((double)wins/experiments); } }
upvote count: 0

http://stackoverflow.com/comment/34763946
type: Comment
comment on: http://stackoverflow.com/q/22795455
score: 0
type: QuestionComment
has text: `@aar` means "just the aar artifact, and no dependencies".

http://stackoverflow.com/q/22681969
has body: I tried this code: String str =",,,,,"; String str2=",,,,, "; System.out.println(str.split(",").length); System.out.println(str2.split(",").length); And the output is: 0 6 The only difference is str value is ,,,,, (without space) and str2 value is ,,,,, (with space) Anybody can explain this?
answer count: 2
downvote count: 0
has answer: http://stackoverflow.com/a/22682063
tagged with: string
has comment: http://stackoverflow.com/comment/34554909
favorite count: 0
has answer: http://stackoverflow.com/a/22681996
possible better answer: http://stackoverflow.com/a/22682063
has comment: http://stackoverflow.com/comment/34555262
type: AnsweredQuestion
score: 3
has title: String#split method confusion
upvote count: 3
tagged with: java
accepted answer: http://stackoverflow.com/a/22681996
type: Question
tagged with: split

http://stackoverflow.com/q/22649610
tagged with: object
accepted answer: http://stackoverflow.com/a/22649700
has answer: http://stackoverflow.com/a/22649748
tagged with: class
score: 9
answer count: 2
has title: Error message "java.lang.NoSuchMethodError: Customer.<init>(Ljava/lang/String;D)V "
has body: I keep getting the same error message when running this program. This is what i get: Exception in thread "main" java.lang.NoSuchMethodError: Customer.&lt;init&gt;(Ljava/lang/String;D)V at Customer5.input(Customer5.java:35)&lt;b&gt;---(See below (code) to refer to lines 35 &amp; 7) at Customer5.main(Customer5.java:7) Another thing is that the class "Customer" shows a message that says "The type Customer is already defined." import java.util.*; public class Customer5 { public static void main(String[] args) { Customer[] customers=input();//This is line 7 customers=sort(customers); output(customers); } public static Customer[] input(){ Scanner input =new Scanner(System.in); int n; String name; double debt; System.out.print("Enter number of customers :"); n=input.nextInt(); Customer[] customers=new Customer[n]; for(int i=0; i&lt;n; i++){ System.out.print("Enter name:"); name=input.next(); System.out.print("Enter debt:"); debt=input.nextDouble(); customers[i]=new Customer(name, debt);//This is line 35 } return customers; } public static Customer[] sort(Customer[] customers){ Customer temp; for(int i=0; i&lt;customers.length; i++){ for(int j=i+1; j&lt;customers.length; j++){ if(customers[j-1].debt&gt;customers[j].debt){ temp=customers[j-1]; customers[j-1]=customers[j]; customers[j]=temp; } } } return customers; } public static void output(Customer[] customers){ for(int i=0; i&lt;customers.length; i++){ System.out.println(customers[i].name+"\t" +customers[i].debt); } } } class Customer{ //this line shows a message that says:The type Customer is already defined public String name; public Double debt; public Customer(String name, double debt){ this.name=name; this.debt=debt; } } I don't know what to do in order to fix it. I am not very familiar with this type of error message. I'd really appreciate any feedback or comments on how to approach this problem. Thanks!
has answer: http://stackoverflow.com/a/22649700
has comment: http://stackoverflow.com/comment/34497711
favorite count: 0
upvote count: 9
has comment: http://stackoverflow.com/comment/34498006
possible better answer: http://stackoverflow.com/a/22649748
type: AnsweredQuestion
downvote count: 0
tagged with: java
type: Question

http://stackoverflow.com/comment/34582434
comment on: http://stackoverflow.com/a/22693678
score: 0
has text: @Ewald I don't see why the VM implementers "feelings" matter at all here. Regardless of the capabilities of the machine, nothing that I can prevents them from offering an System.ExpandHeap() and returning failure if there is not enough memory. The question is why this method does not exist? Right now the answer seems to be: "all existing implementers of Java VMs are too stupid to realize they can allow the heap to be expanded". Somehow I doubt this is the explanation. There must be some reason nobody here has determined yet.
type: AnswerComment
type: Comment

http://stackoverflow.com/comment/34611572
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/22712211
type: Comment
has text: Got it sir..One More thing if my service is in started Mode and after some time i rebooted my Linux System then My Service will automatically be Started.Am i Right?

http://stackoverflow.com/comment/34762699
comment on: http://stackoverflow.com/a/22786006
type: AnswerComment
has text: I am not sure if i should add more code in here but if you raise a new question I can add sample code for pausable Thread.You can check below link but if you can
score: 0
type: Comment

http://stackoverflow.com/q/22805183
has answer: http://stackoverflow.com/a/22805403
has answer: http://stackoverflow.com/a/22805344
linked to: http://stackoverflow.com/q/3804591
tagged with: uuid
tagged with: java
downvote count: 1
type: Question
has comment: http://stackoverflow.com/comment/34776780
upvote count: 0
score: -1
has comment: http://stackoverflow.com/comment/34777132
has comment: http://stackoverflow.com/comment/34776759
has body: Do UUID in Java for String objects will be the same if those strings are equal? If not, Is there a way/tool to generate string (with proper UUID format) that will stay the same if will be computed on equal string? I need some kind of hash for string, that keep UUID format. Is there something like this in Java? [Edit]: You will propably ask what exacly I am trying to do. I am making a part of application that will translate object from one servis to another. One of those servises indentity object by UUID. Second one do not store it. I do not want to cach whole data of those services, so I have to generate that UUID somehow.
answer count: 3
has title: Comparing UUIDs in Java
favorite count: 0
tagged with: hash
has comment: http://stackoverflow.com/comment/34776887
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/22805345

http://stackoverflow.com/a/22654956
upvote count: 7
answers question: http://stackoverflow.com/q/22654930
has body: The source code is included in the JDK. There is a src.zip somewhere. You can tell Eclipse to use that file, so you can jump to classes or method declarations even in the standard library. When you install any JDK, you get src.zip in java/jdk folder. while opening any inbuilt file it will ask you to attach resource. You just need to browse to that location and supply once src.zip. After that when ever you click on java inbuilt class name it will show you the code.
downvote count: 0
score: 7
type: Answer

http://stackoverflow.com/comment/34727188
comment on: http://stackoverflow.com/q/22777498
type: Comment
type: QuestionComment
score: 0
has text: If the output you've shown us is your *only* output then that suggests that you are not calling `handleCollisions()` on every frame, because you would expect to see more than one print out (plus the example you showed us doesn't actually intersect, but I'm assuming that's because it was just an arbitrary example).

http://stackoverflow.com/comment/34567286
has text: The method `Future.get()` (which you invoke in the last line - `service.take().get()`) throws a `java.util.concurrent.ExecutionException` if your callable threw an exception. You can call `getCause()` on it to get the original exception back.
comment on: http://stackoverflow.com/a/22688329
score: 0
type: AnswerComment
type: Comment

http://stackoverflow.com/a/22733476
type: AcceptedAnswer
has body: Yes, you passed two references to the same Point object to Circle and Triangle. To avoid this, there are basically two solutions: create a copy of the Point object (either before passing it to Triangle and Circle, or in the constructor of those two classes, to make sure they use a different instances) make the Point class immutable (all fields final, no setter), to make sure nobody can ever modify a Point. To translate a point, you would then be forced to create a new Point, with new coordinates. This is much safer, because you can't forget to make a copy. The immutability guarantees that the point can be shared between shapes without any way for them to modify each other by modifying their points.
downvote count: 0
answers question: http://stackoverflow.com/q/22733404
type: Answer
has comment: http://stackoverflow.com/comment/34648031
score: 1
upvote count: 1
accepted answer of: http://stackoverflow.com/q/22733404

http://stackoverflow.com/comment/34610742
score: 0
has text: @Zarin your first post before edit.. SO maintains [Edit history](http://stackoverflow.com/posts/22712745/revisions) :D
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/22712745

http://stackoverflow.com/q/22688419
tagged with: java
tagged with: localization
type: Question
has comment: http://stackoverflow.com/comment/34566177
score: -1
has answer: http://stackoverflow.com/a/22688463
answer count: 1
downvote count: 1
linked to: http://stackoverflow.com/q/12908289
favorite count: 0
has comment: http://stackoverflow.com/comment/34566928
type: UnansweredQuestion
tagged with: android
has comment: http://stackoverflow.com/comment/34565778
has title: How to change your phone language in Android with Java code?
upvote count: 0
has body: I need help to change my phone language to English United States, using only code in an application.

http://stackoverflow.com/a/22806659
score: 0
type: Answer
answers question: http://stackoverflow.com/q/22806362
has comment: http://stackoverflow.com/comment/34779520
has body: You may try it this way: public static void main(String[] args) { final ReentrantReadWriteLock ONE = new ReentrantReadWriteLock(); final ReentrantReadWriteLock TWO = new ReentrantReadWriteLock(); Runnable t1 = new Runnable() { @Override public void run() { A a = new A(); ONE.writeLock().lock(); try { a.A1(); } finally { ONE.writeLock().unlock(); } TWO.writeLock().lock(); try { a.A2(); } finally { TWO.writeLock().unlock(); } } }; Runnable t2 = new Runnable() { @Override public void run() { B b = new B(); ONE.writeLock().lock(); try { b.B1(); } finally { ONE.writeLock().unlock(); } TWO.writeLock().lock(); try { b.B2(); } finally { TWO.writeLock().unlock(); } } }; new Thread(t1).start(); new Thread(t2).start(); } class A { public void A1() { System.out.println("A1"); try { Thread.sleep(1000); } catch (InterruptedException e) {} } public void A2() { System.out.println("A2"); try { Thread.sleep(1000); } catch (InterruptedException e) {} } } class B { public void B1() { System.out.println("B1"); try { Thread.sleep(1000); } catch (InterruptedException e) {} } public void B2() { System.out.println("B2"); try { Thread.sleep(1000); } catch (InterruptedException e) {} } } OUTPUT: A1 A2 B1 B2
has comment: http://stackoverflow.com/comment/34779782

http://stackoverflow.com/comment/34764356
type: QuestionComment
has text: you must have an error in your xml files, check all files, like layout values and other
comment on: http://stackoverflow.com/q/22798098
score: 0
type: Comment

http://stackoverflow.com/q/22701668
tagged with: java
tagged with: http://stackoverflow.com/tag/xhtml
has body: I am trying to display a URL as a result in my UI after some processing. So far I have used URL: &lt;h:outputLink value= "#{entry.value}"&gt;&lt;h:outputText&gt;"#{entry.value}" &lt;/h:outputText&gt;&lt;/h:outputLink&gt; When I click on a link that is displayed the URL in the browser is of the form localhost:8080/ProjectName/URL But I want the page to be displayed when I click the URL on the UI. Any help would be great.
has comment: http://stackoverflow.com/comment/34661774
has comment: http://stackoverflow.com/comment/34924870
tagged with: uirepeat
tagged with: javabeans
score: 0
has comment: http://stackoverflow.com/comment/34612473
tagged with: jsf
answer count: 0
has title: Clicking on Links in JSF failing
type: UnansweredQuestion
linked to: http://stackoverflow.com/q/22699352
type: Question

http://stackoverflow.com/a/22740655
type: Answer
upvote count: 3
score: 3
answers question: http://stackoverflow.com/q/22740252
downvote count: 0
has body: Here is a simple implementation. def jhash(str) result = 0 mul = 1 max_mod = 2**31 - 1 str.chars.reverse_each do |c| result += mul * c.ord result %= max_mod mul *= 31 end result end And some sample runs jhash("aa") 3104 jhash("") 0 jhash("polygenelubricants") #Java returns -2147483648 1283535072 Note that the java implementation returns a int which is 32 bits wide(31 bits for unsigned). The Java hashcode implementation may also return negative values. This implementation will not mimic java's negative hashcode behaviour. Instead it will return a whole number between 0 and 2**31-1(Integer.MAX_VALUE)

grouplayout
type: Tag
tags question: http://stackoverflow.com/q/22802970
tag name: grouplayout

http://stackoverflow.com/a/22672662
has comment: http://stackoverflow.com/comment/34540032
has comment: http://stackoverflow.com/comment/34539948
has comment: http://stackoverflow.com/comment/34540057
type: Answer
score: 3
upvote count: 3
has comment: http://stackoverflow.com/comment/34538450
has comment: http://stackoverflow.com/comment/34538721
has body: You could use URL type, and it's methods. public static void main(String [] args){ try { URL url = new URL("https://www.google.com/search?q=X&amp;b=Y"); System.out.println("protocol is " + url.getProtocol()); // |-&gt; prints: 'https' System.out.println("hot is "+ url.getHost()); // url.getAuthority() is valid too, but may include the port // incase it's included in the URL // |-&gt; prints: 'www.google.com' System.out.println("path is " + url.getPath()); // |-&gt; prints: '/search' //WHat you asked for System.out.println(url.getProtocol()+"://"+ url.getAuthority()+url.getPath()); // |-&gt; prints: 'https://www.google.com/search' }catch(IOException e){ e.printStackTrace(); } } Output: protocol is https host is www.google.com path is /search https://www.google.com/search
downvote count: 0
has comment: http://stackoverflow.com/comment/34540030
has comment: http://stackoverflow.com/comment/34538524
answers question: http://stackoverflow.com/q/22672319

http://stackoverflow.com/q/22719999
type: AnsweredQuestion
has body: I've tried debugging with messages and stuff but the only value i get from event.getAction() is 0 ... which i believe is ACTION_DOWN why dont i detect ACTION_MOVE or ACTION_UP?? package com.andrewxd.test01; import android.content.Context; import android.graphics.Bitmap; import android.graphics.BitmapFactory; import android.graphics.Canvas; import android.graphics.Paint; import android.view.MotionEvent; import android.view.View; public class Game extends View { private Bitmap enemy; private Enemy enemyN; private Paint paint; private float x,y; public Game(Context context) { super(context); enemy = BitmapFactory.decodeResource(getResources(), R.drawable.enemy); enemy = Bitmap.createScaledBitmap(enemy, 300 , 300, false); enemyN = new Enemy(10, 10, enemy); paint = new Paint(); x = 0; y = 0; } @Override protected void onDraw(Canvas canvas){ canvas.drawRect(x, y, 50, 50, paint); } @Override public boolean onTouchEvent(MotionEvent event){ super.onTouchEvent(event); if(event.getAction() == MotionEvent.ACTION_DOWN){ x = event.getX(); y = event.getY(); invalidate(); } else if(event.getAction() == MotionEvent.ACTION_MOVE){ x = event.getX(); y = event.getY(); invalidate(); } return false; } } Am I doing something wrong? or is this supposed to work like this? And if this is supposed to be like this where do i detect touch movement
has title: Android onTouchEvent in a view class
type: Question
accepted answer: http://stackoverflow.com/a/22720079
tagged with: java
tagged with: touch
score: 0
answer count: 1
tagged with: android
has answer: http://stackoverflow.com/a/22720079

osmdroid
type: Tag
tag name: osmdroid
tags question: http://stackoverflow.com/q/22724697
tags question: http://stackoverflow.com/q/22748066
tags question: http://stackoverflow.com/q/22768537

http://stackoverflow.com/a/22731377
has comment: http://stackoverflow.com/comment/34644430
type: Answer
has body: If I understood corectly, your JPanel spawns on top of the game menu buttons and you can still click them? Make your menu inside a panel and make it invisible when game starts ex: game.start(); gameMenu.setVisible(false);
has comment: http://stackoverflow.com/comment/34644608
has comment: http://stackoverflow.com/comment/34645908
answers question: http://stackoverflow.com/q/22731244
score: 0

http://stackoverflow.com/q/22803409
tagged with: code-analysis
score: 1
has body: For identifying connection leaks in code, i'm using PMD. Now with PMD, it will identify all collection leaks and show the following error, if it didn't find connection.close(). C:\raghu\Harmony\branch\GlobalSKUPhase1A\source\Java\DataLoadServiceApp\src\dell\harmony\data\JdoServer.java:861: Ensure that resources like this Connection object are closed after use However, with our project code, we also use many customized connection close, i.e) instead of using connection.close(), we call a method and close the connection i.e) ResourceClosureUtil.closeDBConnection Now while running pmd, eventhough i've closed the connection using ResourceClosureUtil.closeDBConnection, it gives a false alarm, that connection is not closed. So i've modified the design.xml (ruleset) as follows. changes are highlighted with ** <?xml version="1.0"?> The Design ruleset contains rules that flag suboptimal code implementations. Alternate approaches are suggested. Ensure that resources (like Connection, Statement, and ResultSet objects) are always closed after use. 3 <property name="types" value="Connection,Statement,ResultSet"/> **<property name="closeTargets" value="ResourceClosureUtil.closeDBConnection"/>** public class Bar { public void foo() { Connection c = pool.getConnection(); try { // do stuff } catch (SQLException ex) { // handle exception } finally { // oops, should close the connection using 'close'! // c.close(); } } } Now with this change it is not giving any false alarm, when connection is closed with ResourceClosureUtil.closeDBConnection. Now we have many customized close methods like , "ClosureUtil.closeConnection", "Resource.close", how to stop false alarm with these methods? In order to solve, i've modified closeTargets property to include all such methods. changes highlighted with ** <property name="types" value="Connection,Statement,ResultSet"/> **<property name="closeTargets" value="ResourceClosureUtil.closeDBConnection"/> <property name="closeTargets" value="ClosureUtil.cl…
upvote count: 1
type: AnsweredQuestion
tagged with: pmd
tagged with: java
type: Question
answer count: 1
downvote count: 0
favorite count: 0
has comment: http://stackoverflow.com/comment/34776515
has answer: http://stackoverflow.com/a/22804522
accepted answer: http://stackoverflow.com/a/22804522
has title: Identifying Connection not closed in java code using PMD
tagged with: jdbc

http://stackoverflow.com/q/22772120
has answer: http://stackoverflow.com/a/22772212
possible better answer: http://stackoverflow.com/a/22772168
type: AnsweredQuestion
tagged with: java
has title: What is the basis of output order Hashset in Java
type: Question
has body: I am trying to print the the content of a Hashset. And it outputs it as [D, E, F, A, B, C]. I was expecting it to output something like [F, E, D, B, A, C]. Is there a logic behind this? public class TestSomething { public static void main(String[] args) { HashSet&lt;String&gt; hashSet = new HashSet&lt;String&gt;(); hashSet.add("F"); hashSet.add("E"); hashSet.add("D"); hashSet.add("B"); hashSet.add("A"); hashSet.add("C"); System.out.println(hashSet.toString()) } }
answer count: 3
tagged with: hashset
has answer: http://stackoverflow.com/a/22772168
accepted answer: http://stackoverflow.com/a/22772152
score: 0
has answer: http://stackoverflow.com/a/22772152

http://stackoverflow.com/comment/34639299
type: AnswerComment
type: Comment
has text: bro not getting this: String obj1, String obj2 and you can see more code,may be helpful to teach me, check this link: http://stackoverflow.com/questions/22553802/custom-listview-scroll-hiding-progressbar-process-and-imageview
comment on: http://stackoverflow.com/a/22728423
score: 0

http://stackoverflow.com/comment/61028976
score: 6
comment on: http://stackoverflow.com/a/34740998
type: AnswerComment
type: Comment
has text: Yes it is, he uses and links to joda's `DateTime` in the answer.

http://stackoverflow.com/comment/34756545
type: Comment
has text: Thank you for your answer! I think this is going to work. I have implemented an AsyncTask to get the current location so far. I just have problems with the visibility of my custom view. Even if I set the visibility in the xml-file to "gone" it's still visible.
comment on: http://stackoverflow.com/a/22790683
score: 0
type: AnswerComment

http://stackoverflow.com/comment/34545059
type: Comment
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/22676031
has text: @JohnGardner The problems are, every platform renders content differently, so you go a make it look okay on your system and the next person who runs it thinks "wow, this looks a mess" :P, `setSize` it also doesn't take into account the frame border insets which effect the viewable content. There are better solutions available the using `setSize` - I'm just saying, and yes, every situation is contextual.

http://stackoverflow.com/a/22696073
score: 0
type: Answer
has body: If you are using Java 8 you can use the Stream API with the distinct() operation to eleminate duplicates: List&lt;Integer&gt; list = Arrays.asList(5, 3, 6, 5, 4, 6); List&lt;Integer&gt; filtered = list.stream().distinct().collect(Collectors.toList()); System.out.println("filtered: " + filtered); // [5, 3, 6, 4]
answers question: http://stackoverflow.com/q/22695916

http://stackoverflow.com/a/22712778
has body: You can use a broadcast receiver registered for: android.net.conn.CONNECTIVITY_CHANGE listen the status changes and keep a variable with the current status More information here &lt;receiver android:name="your.package.WifiReceiver" &gt; &lt;intent-filter&gt; &lt;action android:name="android.net.conn.CONNECTIVITY_CHANGE" /&gt; &lt;/intent-filter&gt; &lt;/receiver&gt; And the Receiver: public class WifiReceiver extends BroadcastReceiver { public static boolean connected = false; @Override public void onReceive(Context context, Intent intent) { ConnectivityManager mgr = (ConnectivityManager) context .getSystemService(Context.CONNECTIVITY_SERVICE); NetworkInfo networkInfo = mgr .getNetworkInfo(ConnectivityManager.TYPE_WIFI); connected = networkInfo != null &amp;&amp; networkInfo.isConnected(); } } public boolean isConnected(){ return connected; }
score: 6
answers question: http://stackoverflow.com/q/22712631
type: AcceptedAnswer
downvote count: 0
accepted answer of: http://stackoverflow.com/q/22712631
type: Answer
upvote count: 6
has comment: http://stackoverflow.com/comment/34610589

http://stackoverflow.com/comment/34644061
has text: Saving them in DB and needed UI too!
comment on: http://stackoverflow.com/q/22731231
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/q/22769723
type: UnansweredQuestion
downvote count: 0
tagged with: javafx
has body: I'm playing a mp3 file with JavaFX's MediaPlayer, and the getCurrentTime() works fine, but when I use at some point the seek() method, the getCurrentTime() returns the wrong time. Is this a JavaFX issue?
type: Question
tagged with: audio
score: 3
tagged with: java
upvote count: 3
has comment: http://stackoverflow.com/comment/58906030
answer count: 1
has answer: http://stackoverflow.com/a/22778783
has title: JavaFX issue with MediaPlayer.seek() and MediaPlayer.getCurrentTime();
favorite count: 0

http://stackoverflow.com/q/22691732
has comment: http://stackoverflow.com/comment/34603839
has body: I have a MVC- structured web application. I have both application-, session-, and request scoped data, And I use a custom made Request Based MVC framework, similar to the ones in Spring and Struts. I have used this question's answer as a tutorial. I have a java object called ShowModel, which is passed as session scoped data. I use this to keep track of the users selection of visible components on the webpages. All of the possible visibility selections are represented by a checkbox. They are all set to default of visible/checked when first setting the session data. I have a listener on all of the checkboxes, that registers change, by class name "toggle", and sends it's id and checked/unchecked status by ajax to the server/servlet. See code example 1. I want to state that my experience with ajax is very limited. As all of my calls are intercepted by my Front Controller Servlet, I needed to make a corresponding action, to execute the ajax POST-request. This code has been successfully reached, and executed. See code example 2. My issue, however, is that my action pattern forces redirections. And in some mysterious way, the ajax object responsetext turns out to be the entire html of my index page. My datamodel is already updated, but as it turns out, this is a faulty approach, due to the front controller strategy pattern. So does anyone know of a way I can update my session scoped object's variables, without reloading the entire page? Code example 1 $(document).ready( function() { $('.toggle').change(function() { var id = this.value; var checked = this.checked; var json = new Object(); json.id = id; json.checked = checked; $.ajax({ url: "selectionmodelupdate", type: 'POST', dataType: 'json', data: JSON.stringify(json), contentType: 'application/json', mimeType: 'application/json', success: function (data) { $('.event').each(function (index, event) { //Here I will put code, to update the ".event"'s to be visible or not }); }, error:function(data,status,er) { console.log(a…
tagged with: servlets
score: 0
tagged with: front-controller
has comment: http://stackoverflow.com/comment/34618137
tagged with: jsp
has comment: http://stackoverflow.com/comment/34600906
tagged with: ajax
has comment: http://stackoverflow.com/comment/34576388
answer count: 0
type: UnansweredQuestion
linked to: http://stackoverflow.com/q/5637539
tagged with: java
linked to: http://stackoverflow.com/q/3541077
type: Question
has title: How can I update my session scoped data model in a front controller java servlet web app page, without reloading the web page?

http://stackoverflow.com/comment/34681988
type: AnswerComment
score: 1
type: Comment
has text: Don't build the whole tree then, just dynamically create it as you're doing the DFS.
comment on: http://stackoverflow.com/a/22752385

http://stackoverflow.com/comment/34598918
type: AnswerComment
comment on: http://stackoverflow.com/a/22706007
type: Comment
has text: Well, OP did not put the `""`, neither the `;` :-)
score: 0

http://stackoverflow.com/comment/34653312
type: QuestionComment
has text: I don't want to put the code for the full method in there as it is part of a project for school so will be picked up by the school plagiarism software - humour me imagine there was simply a System.out.println("test"); underneath the thread.sleep - what imn finding is that the print would instantly happen
comment on: http://stackoverflow.com/q/22736170
score: 0
type: Comment

http://stackoverflow.com/q/22708911
score: 6
has comment: http://stackoverflow.com/comment/34613113
has answer: http://stackoverflow.com/a/22746463
tagged with: android
favorite count: 0
type: Question
has comment: http://stackoverflow.com/comment/34615409
has comment: http://stackoverflow.com/comment/34667267
has comment: http://stackoverflow.com/comment/34652504
answer count: 1
upvote count: 6
has title: Download a large pdf with jsoup
tagged with: java
tagged with: jsoup
has body: I would like to download a large pdf file with jsoup. I have try to change timeout and maxBodySize but the largest file I could download was about 11MB. I think if there is any way to do something like buffering. Below is my code. public class Download extends Activity { static public String nextPage; static public Response file; static public Connection.Response res; @Override protected void onCreate(Bundle savedInstanceState) { // TODO Auto-generated method stub super.onCreate(savedInstanceState); Bundle b = new Bundle(); b = getIntent().getExtras(); nextPage = b.getString("key"); new Login().execute(); finish(); } private class Login extends AsyncTask&lt;Void, Void, Void&gt; { @Override protected void onPreExecute() { super.onPreExecute(); } @Override protected Void doInBackground(Void... params) { try { res = Jsoup.connect("http://www.eclass.teikal.gr/eclass2/") .ignoreContentType(true).userAgent("Mozilla/5.0") .execute(); SharedPreferences pref = getSharedPreferences( MainActivity.PREFS_NAME, MODE_PRIVATE); String username1 = pref.getString(MainActivity.PREF_USERNAME, null); String password1 = pref.getString(MainActivity.PREF_PASSWORD, null); file = (Response) Jsoup .connect("http://www.eclass.teikal.gr/eclass2/") .ignoreContentType(true).userAgent("Mozilla/5.0") .maxBodySize(1024*1024*10*2) .timeout(70000*10) .cookies(res.cookies()).data("uname", username1) .data("pass", password1).data("next", nextPage) .data("submit", "").method(Method.POST).execute(); } catch (IOException e) { e.printStackTrace(); } return null; } @Override protected void onPostExecute(Void result) { String PATH = Environment.getExternalStorageDirectory() + "/download/"; String name = "eclassTest.pdf"; FileOutputStream out; try { int len = file.bodyAsBytes().length; out = new FileOutputStream(new File(PATH + name)); out.write(file.bodyAsBytes(),0,len); out.close(); } catch (FileNotFoundException e) { e.printStackTrace(); } catch (IOException e) { e.printStackTrace(); } } } } I hope somebody…
downvote count: 0
type: UnansweredQuestion

http://stackoverflow.com/q/22705488
possible better answer: http://stackoverflow.com/a/22818445
favorite count: 0
has title: How to execute code which comes after a section where element is not found in a test method?
has body: Suppose, I am testing method which checks whether all links are present on page. Ex : @Test public void testLinks(){ driver.findElement(By.linkText("link1")); driver.findElement(By.linkText("link2")); driver.findElement(By.linkText("link3")); driver.findElement(By.linkText("link4")); driver.findElement(By.linkText("link5")); } In above code, suppose all links are present except link3 then test method's execution will stop after throwing error for link3 but still if I want code to be executed for checking link4 and link5, how can I achieve that using Java?
tagged with: testng
tagged with: selenium-webdriver
type: AnsweredQuestion
downvote count: 0
score: 1
tagged with: java
has comment: http://stackoverflow.com/comment/34597810
has comment: http://stackoverflow.com/comment/34597712
has answer: http://stackoverflow.com/a/22818445
type: Question
has comment: http://stackoverflow.com/comment/34597966
has answer: http://stackoverflow.com/a/22705651
accepted answer: http://stackoverflow.com/a/22705651
answer count: 2
upvote count: 1

http://stackoverflow.com/comment/34688053
comment on: http://stackoverflow.com/q/22755456
has text: what framework you use..??
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/a/22763660
has body: If the only comment in your file is CSS comment, you might consider something like : String html = ...; //HTML in String html.replaceAll("&lt;!--", ""); html.replaceAll("--&gt;", "");
downvote count: 0
answers question: http://stackoverflow.com/q/22763462
type: AcceptedAnswer
type: Answer
score: 3
upvote count: 3
accepted answer of: http://stackoverflow.com/q/22763462

http://stackoverflow.com/a/22787194
has body: No, 16 is CV_8UC3: ~ python Python 2.7.2 (default, Oct 11 2012, 20:14:37) [GCC 4.2.1 Compatible Apple Clang 4.0 (tags/Apple/clang-418.0.60)] on darwin Type "help", "copyright", "credits" or "license" for more information. &gt;&gt;&gt; import cv2 &gt;&gt;&gt; cv2.CV_8UC1 0 &gt;&gt;&gt; cv2.CV_8UC3 16 &gt;&gt;&gt; You have to convert it into grayscale: cvtColor(imageIn, imageOut, COLOR_BGR2GRAY); From the references: void Mat::convertTo(Mat&amp; m, int rtype, double alpha=1, double beta=0) const rtype – The desired destination matrix type, or rather, the depth (since the number of channels will be the same with the source one). If rtype is negative, the destination matrix will have the same type as the source. or split the channels and take only one of them, or convert to binary images using threshold EDIT: For a complete answer on how types (like 8UC1 etc) are build in opencv see this. For converting to a grayscale.. google it, it's full of good resources. Remember the references The basic image container
type: Answer
upvote count: 3
score: 3
answers question: http://stackoverflow.com/q/22787030
downvote count: 0

http://stackoverflow.com/comment/70721994
type: Comment
comment on: http://stackoverflow.com/a/34321248
type: AnswerComment
score: 0
has text: `println(CaseFormat.LOWER_HYPHEN.to(CaseFormat.UPPER_CAMEL, "load_id"))` gives you `Load_id`

http://stackoverflow.com/comment/34655424
type: QuestionComment
comment on: http://stackoverflow.com/q/22737553
type: Comment
has text: it works great @RC. thanks. How do you suggest I close this question? Maybe posting my modified pom.xml?
score: 0

http://stackoverflow.com/comment/34594946
comment on: http://stackoverflow.com/a/22653428
score: 0
type: AnswerComment
type: Comment
has text: The problem is in Actual result i think it is not getting the values expectedDropDownItems : [Day, Week, Month, Quarter, Semester, Year, RD Tech GroupICC, Center, Software Pack, Product, Project, Customer PRs, Severity, Priority ] actualDropDownItems : [, , , , , , , , , , , , , , ]

http://stackoverflow.com/a/22806660
has body: If we assume user will always input in XXXX (hhmm) format you can try using this code: public static void main(String[] args) { Scanner userInput = new Scanner(System.in); System.out.print("Enter first time value: "); int firstTime = userInput.nextInt(); System.out.print("Enter second time value: "); int secondTime = userInput.nextInt(); int hoursFirst = (int)(firstTime/100); int minutesFirst = firstTime%100; int hoursSecond = (int)(secondTime/100); int minutesSecond = secondTime%100; int difference = Math.abs((hoursSecond - hoursFirst - 1) * 60 + (60 - minutesFirst) + minutesSecond); System.out.println("Difference between " + hoursFirst + ":" + minutesFirst + " and " + hoursSecond + ":" + minutesSecond + " is " + difference + " minutes."); } Output example: Enter first time value: 1820 Enter second time value: 1610 Difference between 18:20 and 16:10 is 130 minutes.
type: Answer
answers question: http://stackoverflow.com/q/22805989
score: 0

http://stackoverflow.com/comment/34779555
score: 0
has text: Is it important that only T1 and T2 are blocked from accessing the methods or is it acceptable for all other threads to be blocked? The latter is much easier to achieve using locks.
comment on: http://stackoverflow.com/q/22806362
type: Comment
type: QuestionComment

aide-ide
tag name: aide-ide
type: Tag
tags question: http://stackoverflow.com/q/22677957

http://stackoverflow.com/q/22722671
type: Question
tagged with: sessionfactory
score: 0
accepted answer: http://stackoverflow.com/a/37680273
tagged with: java
tagged with: hibernate
answer count: 2
has body: This would be useful because I want to know if the pool is exhausted BEFORE I need to create a Transaction from Session in my DAOs. I would like to give feedback to the user about system overload (pool exhaustion), but I don't want to capture this specific Exception in every method of every DAO. I think Session opening would be the right time to check this.
possible better answer: http://stackoverflow.com/a/22724228
has answer: http://stackoverflow.com/a/22724228
has title: How to make Hibernate SessionFactory checkout JDBC connection from c3p0 upon session opening?
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/37680273
tagged with: c3p0
tagged with: connection

http://stackoverflow.com/q/22749590
tagged with: gridworld
score: 0
has body: The title says it all really. I'm trying to find and modify the critter source code, but I don't know where it's located on my Windows computer. I have gridworld and all, but the closest I get is critter.class. Searching my computer has done nothing too; it pops up the oh-so-helpful "Nothing found" message, and just ticks me off. Does anybody know where the source files are?
tagged with: location
answer count: 1
has answer: http://stackoverflow.com/a/22872131
has title: Where can I access the source code for gridworld actors?
type: AnsweredQuestion
tagged with: java
tagged with: methods
type: Question
accepted answer: http://stackoverflow.com/a/22872131

http://stackoverflow.com/comment/34586511
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/22698034
has text: Yeah...kind of difficult to answer in a concise form. Firstly you need to look at a cursor adapter approach - the most commonly used is `SimpleCursorAdapter`. If you do that, however, change the 'id' column to be `_id` (note the preceding underscore). Also, as I said, don't store your images as blobs in the DB just store a URI or filename. BTW, I'm a guitarist so I get the gist of what you're trying to do - a guitar "chord box" lookup app right?
score: 0

http://stackoverflow.com/comment/34670641
has text: yes because class variables are shared between instances , those will be shared among threads which has instance of Calculate class.
type: Comment
comment on: http://stackoverflow.com/a/22746043
score: 0
type: AnswerComment

http://stackoverflow.com/comment/34724760
comment on: http://stackoverflow.com/a/22776011
type: Comment
has text: It's not easy for me to test right now, but has the behavior changed since http://stackoverflow.com/a/5931718/616460 where it would (according to the comments there, which may be incorrect?) accept e.g. "abc" as a valid email?
type: AnswerComment
score: 0

http://stackoverflow.com/q/22737535
has comment: http://stackoverflow.com/comment/34794360
downvote count: 0
has comment: http://stackoverflow.com/comment/34655469
has answer: http://stackoverflow.com/a/22739407
favorite count: 0
tagged with: nvidia
has answer: http://stackoverflow.com/a/22791235
has comment: http://stackoverflow.com/comment/34655719
has answer: http://stackoverflow.com/a/40651617
has comment: http://stackoverflow.com/comment/34655554
score: 58
has comment: http://stackoverflow.com/comment/34655612
has answer: http://stackoverflow.com/a/27768329
has comment: http://stackoverflow.com/comment/34813056
has comment: http://stackoverflow.com/comment/44443188
has comment: http://stackoverflow.com/comment/34656727
has comment: http://stackoverflow.com/comment/34655768
has comment: http://stackoverflow.com/comment/34655039
tagged with: swing
upvote count: 58
tagged with: java-8
has comment: http://stackoverflow.com/comment/34657523
type: AnsweredQuestion
linked to: http://stackoverflow.com/q/17874717
has answer: http://stackoverflow.com/a/22815908
has comment: http://stackoverflow.com/comment/34656317
has comment: http://stackoverflow.com/comment/34656087
tagged with: rendering
tagged with: java
has body: I have installed IntelliJ IDEA (13.1.1 #IC-135.480) and JDK 1.8.0 (x64) and I generated some GUI with the GUI Form designer. Then I ran the code and realized that something is not alright. Here is a Screenshot of my GUI: The rendering of the Font seems to be not OK. Additionally the Button looses its Text, when I move my mouse over it. So I installed JDK 1.7.0_40 (x64), recompiled the Project and ran it again. The following Form appears, when i use JDK 1.7: The Rendering seems to be OK and the Button is also OK. So I installed the newest Graphics and Chipset drivers and much more, but the problem still exists. Have you ever had such problems with Java Swing UIs? Could you help me to fix my problems? Any help would be greatly appreciated. UPDATE: I created a small Project with only 1 JTextArea and 1 JButton and i have the same rendering problems. According to Andrew Thompson i changed the setSize() and I start from EDT. The Example below: package at.maeh.java.client.simpleTextClient; import javax.swing.*; import java.awt.*; public class SimpleClient extends JFrame { private JPanel panel1; private JTextArea textArea1 = new JTextArea(); private JButton button1 = new JButton(); public SimpleClient() { super("SimpleClient"); // Panel panel1 = new JPanel(); panel1.setLayout(new FlowLayout()); // BUtton button1.setText("TestButton"); // TextArea textArea1.setColumns(40); textArea1.setRows(15); // Add Components panel1.add(textArea1); panel1.add(button1); // Add to Frame this.getContentPane().add(panel1); // pack and set Visible pack(); setVisible(true); System.out.println("Constructor EDT: " + SwingUtilities.isEventDispatchThread()); } public static void main(String[] args) { SwingUtilities.invokeLater(SimpleClient::new); System.out.println("Main EDT: " + SwingUtilities.isEventDispatchThread()); } } The result is a simple JFrame with the Components in it. When I write some Text, or moove my mousePointer over the Button the components get rendered like this (Text: testsente…
has answer: http://stackoverflow.com/a/37832581
possible better answer: http://stackoverflow.com/a/26610279
has comment: http://stackoverflow.com/comment/68298188
has title: Swing rendering appears broken in JDK 1.8, correct in JDK 1.7
has answer: http://stackoverflow.com/a/26610279
accepted answer: http://stackoverflow.com/a/22791235
type: Question
answer count: 8
has comment: http://stackoverflow.com/comment/34657219
linked to: http://stackoverflow.com/q/16545982
linked to: http://stackoverflow.com/q/5621338
has comment: http://stackoverflow.com/comment/43768381
has answer: http://stackoverflow.com/a/24610467
has comment: http://stackoverflow.com/comment/34809954
has comment: http://stackoverflow.com/comment/41229458
has comment: http://stackoverflow.com/comment/34655679
has comment: http://stackoverflow.com/comment/42204063

http://stackoverflow.com/q/22662687
answer count: 2
has comment: http://stackoverflow.com/comment/34520652
accepted answer: http://stackoverflow.com/a/22663644
possible better answer: http://stackoverflow.com/a/44209436
has answer: http://stackoverflow.com/a/44209436
tagged with: android
has comment: http://stackoverflow.com/comment/34520439
score: 0
has answer: http://stackoverflow.com/a/22663644
has title: Is it possible that the service still runs after the app got killed with task manager?
has comment: http://stackoverflow.com/comment/34521619
has comment: http://stackoverflow.com/comment/34521551
type: Question
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/34520798
tagged with: java
has body: Hello im triying to run a service in background that it doesn't stop when app is destroyed by task manager. The idea of the service is verify every "x" min if there a new insert in a database that i got in a server. The service is running great even if i close the app but when i use the task manager to destroy my app all the threads are closed too. So i want to know if its possible to run a thread that ask in background forever unless user cancel it in the app itself, that ignore the destroy caused by task manager so in the future i can use notification bar to tell the user that a new insert happened in the database. Tryed: public int onStartCommand(Intent intent, int flags, int startId) { // TODO Auto-generated method stub askServer(); // i made a timertask that ask every "x" minute return START_STICKY; } As i read START_STICKY should run again the service if it get killed for some reason and i know that this can be done since some app get closed by taskmanager and still get notifications from it as whatsapp,bbms and others. Please tell me if im wrong in anything and thank you for reading!. UPDATE: Im not trying to break any law or security rule from Android and im not trying to ignore the stoping services option from an app in settings. I want that the service that listen for new incoming "events " inserts in my case keep running after user used the interface that appear when you press home for a while : UPDATE : sorry for talking to much about this app but is the one that i can use as an example. In whatsapp when i close the app by the interface that i showed above the process and services are killed but after a couple of second they relaunch, this is exactly what i want to do to keep user informed about database events. From setting you still can stop the service without problem or even i can put the option in the app itself to stop notifiying. Is a bad implementation call in OnDestroy() method an instance of the service so it relaunch after destroy? UPDATE : we…

http://stackoverflow.com/q/22722255
score: 26
tagged with: newline
has comment: http://stackoverflow.com/comment/34628656
has title: Why doesn't Java support multi-line strings?
tagged with: multiline
tagged with: string
favorite count: 0
has comment: http://stackoverflow.com/comment/34628311
linked to: http://stackoverflow.com/q/878573
has comment: http://stackoverflow.com/comment/34628620
has comment: http://stackoverflow.com/comment/34628282
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/34628110
has comment: http://stackoverflow.com/comment/65617173
upvote count: 29
has body: Why doesn't Java support multi-line strings? I know they dont, but I dont know why. Is there a good reason? Several other languages have this capability, even older ones, so why doesnt Java? As far as I know (not very far) it shouldnt be too had to add this functionality to your lexers/compilers. Edit: For clarification, I dont mean a string with a newline character in it. I mean something like this: String s = "Hello World"; Edit2: I dont know why people thought I was asking for opinions, I most certainly am not. I specifically asked for good reasons. I suppose I need to explicitly say based on facts as well?
has comment: http://stackoverflow.com/comment/34629372
answer count: 0
has comment: http://stackoverflow.com/comment/34628342
tagged with: java
downvote count: 3
has comment: http://stackoverflow.com/comment/34628322
has comment: http://stackoverflow.com/comment/34628204
has comment: http://stackoverflow.com/comment/34628157
type: Question

http://stackoverflow.com/q/22725593
has comment: http://stackoverflow.com/comment/34634335
accepted answer: http://stackoverflow.com/a/22725628
type: AnsweredQuestion
has body: This is not my code and I know this is not the right way to write this. I was asked this in an online test. public class HelloWorld{ public static void main(String []args){ int x = 10; x = x++ * ++x; System.out.println(x); } } Ouptut is 120. I don't understand why. Should it not be 132/121 ? Is it JVM dependent?
score: 1
tagged with: java
tagged with: output
has answer: http://stackoverflow.com/a/22725628
type: Question
has answer: http://stackoverflow.com/a/22725627
has answer: http://stackoverflow.com/a/22725614
has comment: http://stackoverflow.com/comment/34634385
upvote count: 2
linked to: http://stackoverflow.com/q/24853
answer count: 3
possible better answer: http://stackoverflow.com/a/22725614
downvote count: 1
has title: Output of this Java program
has comment: http://stackoverflow.com/comment/34634340
favorite count: 0

http://stackoverflow.com/a/22741763
type: Answer
has comment: http://stackoverflow.com/comment/34662403
has comment: http://stackoverflow.com/comment/34662440
upvote count: 2
accepted answer of: http://stackoverflow.com/q/22741678
score: 2
answers question: http://stackoverflow.com/q/22741678
has body: Tests are an integral part of the ProjectA project, and you definitely want them in the same repository as the sources that they test. And you probably have (or will have) other directories in your project (documentation, build file, scripts, etc.). So put the project root directory under SVN, and make sure to ignore the bin directory.
type: AcceptedAnswer
downvote count: 0

http://stackoverflow.com/comment/34804716
type: AnswerComment
has text: Couldnt see how its related to the issue.
type: Comment
comment on: http://stackoverflow.com/a/22818217
score: 1

http://stackoverflow.com/q/22762820
has comment: http://stackoverflow.com/comment/34700971
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/22763109
tagged with: java
has comment: http://stackoverflow.com/comment/34700936
has title: onClickListener get external objects
has comment: http://stackoverflow.com/comment/34701034
type: Question
score: 0
answer count: 2
has body: I'm changing the background button when user clicks. But I need change the background of 2 buttons: when I click in btnSim I need change the btnSim background and btnNao Background: holder.btnNao.setOnClickListener(new OnClickListener() { @Override public void onClick(View arg0) { ImageButton botao = (ImageButton) arg0; if (botao.getBackground().getConstantState()==getResources().getDrawable(R.drawable.rdb_off).getConstantState()) { botao.setBackgroundResource(R.drawable.rdb_on); } else botao.setBackgroundResource(R.drawable.rdb_off); } }); holder.btnSim.setOnClickListener(new OnClickListener() { @Override public void onClick(View arg0) { ImageButton botaoSim = (ImageButton) arg0; if (botaoSim.getBackground().getConstantState()==getResources().getDrawable(R.drawable.rdb_off).getConstantState()) { botaoSim.setBackgroundResource(R.drawable.rdb_on); } else botaoSim.setBackgroundResource(R.drawable.rdb_off); } }); EDIT more of my code: http://pastebin.com/Jf1ZDek5
tagged with: android
has answer: http://stackoverflow.com/a/22762968

http://stackoverflow.com/a/22672588
accepted answer of: http://stackoverflow.com/q/22672460
answers question: http://stackoverflow.com/q/22672460
has comment: http://stackoverflow.com/comment/34578721
has body: you can use html tags (e.g. &lt;p&gt; ) to accomplish word wrap functionality in JOPtionPane. use JOptionPane.showMessageDialog(null, "&lt;p style='width:300px;'&gt;"+msg+"&lt;/p&gt;", "Error", JOptionPane.ERROR_MESSAGE);
score: 0
type: AcceptedAnswer
type: Answer

http://stackoverflow.com/comment/34777776
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/22792579
score: 0
has text: you missed a return in you else clause, cause it will continue execution neverless.

http://stackoverflow.com/comment/34732377
comment on: http://stackoverflow.com/a/22780021
score: 0
type: AnswerComment
has text: @m0skit0 Yes, and? Added some example to demonstrate.
type: Comment

http://stackoverflow.com/comment/34543146
type: AnswerComment
has text: Sorry - stupid mistake on my part - Java strings are quote delimited. Fixed now.
score: 0
type: Comment
comment on: http://stackoverflow.com/a/22674521

http://stackoverflow.com/a/22774749
answers question: http://stackoverflow.com/q/22772113
has body: Include in the POST body a send_email=1 or send_email=0 param. You'll extract that, and see what the user wants to do. Search "how to get POST variables in JAVA". Accessing post variables using Java Servlets
score: 0
type: Answer

http://stackoverflow.com/a/22740535
upvote count: 1
has body: In this clause: if the object's identifier has the value assigned to a newly instantiated object, save() it "the value assigned to a newly instantiated object" means the default value that Java gives to an instance variable. For 'String' variable it would be 'null' and for 'int' variable it would be '0'. Next I'll present an example. It doesn't make much practical sense but it proves the rule. Let's get an object with identifier '0' from the database. The auto-increase is on for this identifier. We use session 1 to get the DAO and then close the session. Now let's initialize session 2 and get the same DAO with identifier '0'. We save the object retrieved using session 1 to the database with session 2. We can use save or saveOrUpdate methods to save the object. DAO is successfully saved with a new id to the database. When reproducing the example with object identifier '1' we get "NonUniqueObjectException" when saving the object and the database remains unchanged. NonUniqueObjectException is given as stated: if another object associated with the session has the same identifier, throw an exception We have proven that the instance variables are an exception to the "same identifier" rule.
answers question: http://stackoverflow.com/q/22739812
type: Answer
downvote count: 0
score: 1

http://stackoverflow.com/a/22756464
has comment: http://stackoverflow.com/comment/34689550
has comment: http://stackoverflow.com/comment/34727695
type: Answer
answers question: http://stackoverflow.com/q/22756094
upvote count: 2
score: 1
downvote count: 1
has body: In if(someEntity.hasNewSomeObj()) { someOperator.doStuff(someEntity.getSomeObj().getSomething()); } The call to someEntity.getSomeObj() may still return null as you declare @Nullable, so calling getSomething() then will result in a NPE.
has comment: http://stackoverflow.com/comment/34689299

code-duplication
tag name: code-duplication
tags question: http://stackoverflow.com/q/22792806
type: Tag

http://stackoverflow.com/a/22725148
downvote count: 0
score: 1
type: Answer
has comment: http://stackoverflow.com/comment/34633675
upvote count: 1
has body: I have never implemented this but it occurs to me something like this: For the first question, yes you would need to use | (instead of &amp;) to accumulate the options correctly if you are gonna accumulate options inside one variable, then to check which options are ON I would use a for: for(int i=0;i&lt;32;i++){ if(i&amp;options){//check if i-th option is ON option_function(i); } } and inside option_function() do the switch case. void option_function(int i){ switch(i) { case Option.A: .... } }
answers question: http://stackoverflow.com/q/22725047

http://stackoverflow.com/comment/34647844
comment on: http://stackoverflow.com/a/22733320
score: 0
type: AnswerComment
has text: @MBH I can see another problem having looked at the full code. You use `new Card();` to deal cards to player and computer. However, what that does it create a new, blank card. Your Card constructor sets `number` and `suit`, but since its a new Card, these values will have the default values of 0.
type: Comment

http://stackoverflow.com/comment/34602891
has text: Thank you for your answer! I edited my post for it. Unfortunately this is also not the perfect solution, I would like to have :(.
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/22692693
score: 0

http://stackoverflow.com/q/22747109
tagged with: arrays
answer count: 1
has comment: http://stackoverflow.com/comment/34672194
favorite count: 0
has comment: http://stackoverflow.com/comment/34672145
has comment: http://stackoverflow.com/comment/34672169
has answer: http://stackoverflow.com/a/22747638
type: AnsweredQuestion
score: 0
upvote count: 1
has comment: http://stackoverflow.com/comment/34672149
downvote count: 1
type: Question
accepted answer: http://stackoverflow.com/a/22747638
has title: Avoid out of bounds exception in 2D array
tagged with: java
tagged with: indexoutofboundsexception
has comment: http://stackoverflow.com/comment/34672571
has body: I'm trying to solve a problem which uses a 2D array, the problem of a rat in a maze. While checking the conditions trying to compile, it finds an Array index out of bounds exception... how can I check the values so it doesn't go out of the array bounds? static void solveMaze(){ int nSteps = 0; // Number of steps. int x = 0; int y = 0; // Starting point. boolean mazeCompleted = false; while (!mazeCompleted){ if(x == maze.mazeMatrix.length &amp;&amp; y == maze.mazeMatrix.length) mazeCompleted = true; else if(maze.mazeMatrix[x+1][y] == 0){ // Move right. maze.mazeMatrix[x+1][y] = 2; x++; nSteps++; } else if(maze.mazeMatrix[x-1][y] == 0){ // Move left. maze.mazeMatrix[x-1][y] = 2; x--; nSteps++; } else if(maze.mazeMatrix[x][y+1] == 0){ // Move down. maze.mazeMatrix[x][y+1] = 2; y++; nSteps++; } else if(maze.mazeMatrix[x][y-1] == 0){ // Move up. maze.mazeMatrix[x][y-1] = 2; y--; nSteps++; } } maze.printMatrix(); System.out.println("Maze COMPLETE! - With a total of " + nSteps + " steps."); } Tried before with two "for" loops to prevent the out of bounds but I just can't go diagonal in this problem.

http://stackoverflow.com/comment/34693415
type: QuestionComment
has text: I am actually reading a .java file and then storing all the identifiers of this .java code into a set in pass 1. And then in pass 2 i am using this set to replace the identifiers by the ceaser cipher equivalent of that identifier. Yeah i know that if the identifiers are same as the java classes name, it wont work. so could you please suggest me a parser that can actually find all the identifiers. Thnx
comment on: http://stackoverflow.com/q/22758039
score: 0
type: Comment

http://stackoverflow.com/q/22807055
type: Question
tagged with: jakarta-ee
accepted answer: http://stackoverflow.com/a/22807285
has body: I have tried to install Java EE 7 with updatetool to be able to run Java EE Tutorial examples. But the installation of updatetool fails. I have tried to start updatetool installation from the command line on my elementary os, then I saw the error when installing updatetool. Here is an image: http://oi58.tinypic.com/x6iumx.jpg Error text example 1: Input/output error: Connection failed for URL http://pkg.oracle.com/javaeesdk/7/native/release/manifest/0/updatetool@2.3.5%2C0-56.2852%3A20111207T211721Z: 503: Service Temporarily Unavailable Could not download application packages. This could be because: - a proxy server is needed to access the internet. Please ensure that the system proxy server settings are correct, or set the 'http_proxy' environment variable to the full URL of the proxy server. - the package server or network connection is slow. If you are getting time out errors you can try setting the PKG_CLIENT_CONNECT_TIMEOUT and PKG_CLIENT_READ_TIMEOUT environment variables and try again. For example to increase the timeouts to 300 seconds set them to 300 - the package server is down or otherwise inaccessible or it is generating invalid data. Please contact the provider of the package server. Error text example 2: File 138/564 Input/output error: Connection failed for URL http: //pkg.oracle.com/javaeesdk/7/native/release/file/0/217e83782a91f09fa7f35122412cd155263b107f: 502: Proxy Error Could not download application packages. This could be because: - a proxy server is needed to access the internet. Please ensure that the system proxy server settings are correct, or set the 'http_proxy' environment variable to the full URL of the proxy server. - the package server or network connection is slow. If you are getting time out errors you can try setting the PKG_CLIENT_CONNECT_TIMEOUT and PKG_CLIENT_READ_TIMEOUT environment variables and try again. For example to increase the timeouts to 300 seconds set them to 300 - the package server is down or otherwise inaccessible …
tagged with: glassfish
has comment: http://stackoverflow.com/comment/76210704
has answer: http://stackoverflow.com/a/22833433
answer count: 3
downvote count: 0
possible better answer: http://stackoverflow.com/a/37078017
favorite count: 0
has answer: http://stackoverflow.com/a/37078017
has title: Java EE 7 updatetool installation fails
tagged with: oracle-database
tagged with: java-ee-7
upvote count: 1
has answer: http://stackoverflow.com/a/22807285
type: AnsweredQuestion
linked to: http://stackoverflow.com/q/17633537
score: 1
tagged with: java

http://stackoverflow.com/comment/34600100
has text: I have tried doing this but there is one thing I didn't understand. I want to get "Text" from Second JSON which has same business_id as first json. I am not really getting review ("text") in JSON2 (in my example) I've also tried `query.put(dbObject.get("business_id"),"text");`
type: Comment
comment on: http://stackoverflow.com/a/22706352
score: 0
type: AnswerComment

http://stackoverflow.com/a/22776670
has comment: http://stackoverflow.com/comment/34725651
score: 2
upvote count: 2
accepted answer of: http://stackoverflow.com/q/22776660
has comment: http://stackoverflow.com/comment/34725663
has body: Casting a reference does not change the underling object. myObj is a variable that stores a reference to an A object. In your code, that object is a B. When you cast myObjt to a B you're narrowing the reference to a subclass so that you can invoke one of its methods. This does nothing to the B object.
type: AcceptedAnswer
downvote count: 0
answers question: http://stackoverflow.com/q/22776660
type: Answer

http://stackoverflow.com/a/22706382
type: Answer
has body: You are using different Parameter for views.it wont say exact line no where the exception occurred. check all your views where you misplaced the Layout.Parameter. For example suppose you are using RelativeLayout but some where u set parameter as LinearLayout params. or if u use Table layout and parameter as RelativeLayou.PayoutParams.
score: 0
answers question: http://stackoverflow.com/q/22705144

http://stackoverflow.com/comment/34711217
has text: That doesn't look like a class to me.
comment on: http://stackoverflow.com/q/22768615
type: Comment
type: QuestionComment
score: 1

http://stackoverflow.com/a/22709181
accepted answer of: http://stackoverflow.com/q/22706298
type: AcceptedAnswer
answers question: http://stackoverflow.com/q/22706298
has body: Add the MIME types with the WebsitePanel. http://blog.arvixe.com/mime-type-in-website-properties-–-websitepanel/ I don't know much about Arvixe, but that should hopefully get it working for you.
type: Answer
has comment: http://stackoverflow.com/comment/34606190
score: 0

http://stackoverflow.com/a/22753154
has comment: http://stackoverflow.com/comment/34720666
type: Answer
answers question: http://stackoverflow.com/q/22753131
upvote count: 4
has comment: http://stackoverflow.com/comment/34722071
has body: How about this: for (int a = 0; a &lt; 100; a++) { System.out.print(lList.get(a) + " "); if ((a &gt; 0) &amp;&amp; (a % 10) == 0)) System.out.println(); }
score: 4
accepted answer of: http://stackoverflow.com/q/22753131
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/34709538

http://stackoverflow.com/a/22682271
has comment: http://stackoverflow.com/comment/34660175
has comment: http://stackoverflow.com/comment/34555355
downvote count: 0
type: Answer
answers question: http://stackoverflow.com/q/22682129
score: 1
has body: No you mistook the effect of join(). when you do a t1.join()you are just asserting that the thread t1 will be finished before continuing the program. As you can see it's what you have, One exiting. 5 Main Thread Exiting One exit before the end of the main symbolized by the Main Thread Exiting. If you want your program to finish all the thread before finishing you should do : try { t1.join(); t2.join(); t3.join(); } catch (Exception e) { System.out.println(e); } If you want One to finish then 2 then 3 JoinDemo t1 = new JoinDemo("One"); try { t1.join(); } catch (Exception e) { System.out.println(e); } JoinDemo t2 = new JoinDemo("Two"); try { t2.join(); } catch (Exception e) { System.out.println(e); } JoinDemo t3 = new JoinDemo("Three"); try { t3.join(); } catch (Exception e) { System.out.println(e); }
upvote count: 1

http://stackoverflow.com/a/22724929
type: Answer
has body: If you encounter the same issue, uninstall the application, and then install it again. (Don't let Eclipse reinstall it in the usual way. Uninstall it completely from the device, manually.)
accepted answer of: http://stackoverflow.com/q/22674348
answers question: http://stackoverflow.com/q/22674348
score: 0
type: AcceptedAnswer

http://stackoverflow.com/a/22750378
type: Answer
answers question: http://stackoverflow.com/q/22749350
score: 0
has body: I'm not sure I understand what you want to achieve, but if you want to forbid whitespace characters in a JTexfield (this is what I understand by your question "accept no spaces"), here is how you can do: yourTextField.setDocument(new PlainDocument() { final Pattern WHITE_SPACES = Pattern.compile("\\s+"); public void insertString(int pOffs, String pStr, AttributeSet pA) throws BadLocationException { if (WHITE_SPACES.matcher(pStr).matches()) { return; // whitespace characters not allowed } } });

http://stackoverflow.com/a/23666625
has body: The Local filepath is useless on the server-side. It would only be of use to hackers. That's why browsers don't send it. Its a security measure. You should be glad its there. I'm surprised none of the existing answers pointed this out. On the server-side you decide where to save the file. You wouldn't want the user deciding that, obviously. Giving them the ability to decide where to save the file on your server would give them the ability to overwrite your system files.
score: 0
type: Answer
answers question: http://stackoverflow.com/q/22756186

http://stackoverflow.com/comment/34791740
comment on: http://stackoverflow.com/a/22781191
score: 0
type: AnswerComment
type: Comment
has text: I removed jars and I added dependencies to my `pom.xml`. It also works perfectly.

http://stackoverflow.com/comment/34627164
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/22720691
score: 0
has text: @Sp4mm4ge: you could probably do that, but do you want to? Browsers need to make several GET requests for very valid reasons (e.g. retrieve the resources linked from an HTML page). Also, take a look at HTTP 1.1 keep alive connections.

http://stackoverflow.com/q/22808357
has answer: http://stackoverflow.com/a/22809900
has answer: http://stackoverflow.com/a/22808964
type: AnsweredQuestion
tagged with: oop
tagged with: java
has title: Protected member difference in Java and c#
type: Question
tagged with: c#
accepted answer: http://stackoverflow.com/a/22808964
tagged with: protected
has body: I have the following code in Java public class First { protected int z; First() { System.out.append("First const"); } } class Second extends First { private int b; protected int a; } class Test { /** * @param args the command line arguments */ int a=0; public static void main(String[] args) { // TODO code application logic here First t=new Second(); t.z=10; work fine First x=new First(); x.z=1; // works fine } } so I can access z by creating object of base class C# class A { protected int x = 123; } class B : A { static void Main() { A a = new A(); B b = new B(); // Error CS1540, because x can only be accessed by // classes derived from A. // a.x = 10; // OK, because this class derives from A. b.x = 10; } } So i cannot access a, if through base class object. I found Java and C# similar from an OOP point of view, is there any difference between both languages for protected members? with reference to this doc
answer count: 2
downvote count: 0
favorite count: 0
has comment: http://stackoverflow.com/comment/34795030
score: 8
possible better answer: http://stackoverflow.com/a/22809900
upvote count: 8

http://stackoverflow.com/comment/34515820
has text: No, deserialization doesn't need to use a constructor (it's magic). The stacktrace is clearly telling you "the class doesn't exist on the classpath". If you ignore this clear message, I can't help you further.
type: Comment
type: QuestionComment
score: 1
comment on: http://stackoverflow.com/q/22660033

http://stackoverflow.com/comment/34724691
has text: Of course, your suggestion worked flawlessly. Thank you so very much for the support!
score: 0
type: Comment
comment on: http://stackoverflow.com/a/22776068
type: AnswerComment

scripting
tags question: http://stackoverflow.com/q/22747235
tags question: http://stackoverflow.com/q/22752196
tags question: http://stackoverflow.com/q/22748370
tag name: scripting
type: Tag

http://stackoverflow.com/a/22692303
score: 0
type: Answer
answers question: http://stackoverflow.com/q/22692073
has body: Remove the android:ems directive from your EditText.

http://stackoverflow.com/comment/34531795
comment on: http://stackoverflow.com/q/22668908
type: Comment
type: QuestionComment
has text: You appear to have one function inside another for a start. I.e. public static int binaryToDecimal can't be defined inside main
score: 0

http://stackoverflow.com/comment/34666902
type: QuestionComment
comment on: http://stackoverflow.com/q/22744154
score: 0
has text: Why you crate new ModelMap? Just use the one passed as argument, like in the else section.
type: Comment

http://stackoverflow.com/comment/34777752
comment on: http://stackoverflow.com/q/22804909
score: 0
type: Comment
type: QuestionComment
has text: what happens if you skip the tests? could be mem leak in a 3rd party plugin. Do you have the time to build separately each module and see which ones are with highest mem consumption? Do you remember what was last added before the build process started consuming this much memory?

http://stackoverflow.com/comment/34496995
score: 0
type: QuestionComment
has text: You should know that asking us to recommend or find a tool, library or favorite off-site resource is off-topic for Stack Overflow (as per [help/on-topic]) by now.
comment on: http://stackoverflow.com/q/22649050
type: Comment

http://stackoverflow.com/comment/34652120
comment on: http://stackoverflow.com/q/22728129
score: 0
type: Comment
type: QuestionComment
has text: Yes Punith Raj. I am in the process of testing connection to database.

http://stackoverflow.com/q/22755795
has answer: http://stackoverflow.com/a/22755887
upvote count: 7
has comment: http://stackoverflow.com/comment/34689366
downvote count: 1
type: Question
has comment: http://stackoverflow.com/comment/34688278
accepted answer: http://stackoverflow.com/a/46153735
has answer: http://stackoverflow.com/a/22776623
tagged with: jsp
favorite count: 0
has title: how to Retrieve data from database and display it in a jsp text fields using jdbc connection
has answer: http://stackoverflow.com/a/22757224
answer count: 5
score: 6
tagged with: jdbc
type: AnsweredQuestion
has body: I am retrieving data from database and displaying it in table in a JSP but I do not have any idea about how to display it on text fields. e.g. when I search a index number. the the result (name , address, age) must come to the textfeilds which are in my JSP My code: public class S2 extends HttpServlet { protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { response.setContentType("text/html"); PrintWriter out = response.getWriter(); Connection conn = null; String url = "jdbc:mysql://localhost:3306/"; String dbName = "shoppingCart"; String driver = "com.mysql.jdbc.Driver"; String userName = "root"; String password = ""; Statement st; try { Class.forName(driver).newInstance(); conn = DriverManager.getConnection(url + dbName, userName, password); System.out.println("Connected!"); String pid = request.getParameter("pid"); ArrayList al = null; ArrayList pid_list = new ArrayList(); String query = "select * from user where uid='" + pid + "' "; System.out.println("query " + query); st = conn.createStatement(); ResultSet rs = st.executeQuery(query); while (rs.next()) { al = new ArrayList(); out.println(rs.getString(1)); out.println(rs.getString(2)); out.println(rs.getString(3)); out.println(rs.getString(4)); out.println(rs.getString(5)); al.add(rs.getString(1)); al.add(rs.getString(2)); al.add(rs.getString(3)); al.add(rs.getString(4)); al.add(rs.getString(5)); System.out.println("al :: " + al); pid_list.add(al); } request.setAttribute("piList", pid_list); RequestDispatcher view = request.getRequestDispatcher("/searchview.jsp"); view.forward(request, response); conn.close(); System.out.println("Disconnected!"); } catch (Exception e) { e.printStackTrace(); }
has answer: http://stackoverflow.com/a/43857131
has answer: http://stackoverflow.com/a/46153735
possible better answer: http://stackoverflow.com/a/22755887
tagged with: java
tagged with: mysql

http://stackoverflow.com/a/68709279
downvote count: 1
upvote count: 2
answers question: http://stackoverflow.com/q/22694884
type: Answer
has body: List&lt;Integer&gt; list = new ArrayList&lt;&gt;(); list.add(1); list.add(2); list.add(3); Integer value = list.stream().filter((x-&gt;x.intValue()==8)).findFirst().orElse(null); I have used Integer type instead of primitive as it will have null pointer exception. you just have to handle this exception... looks succinct, I think ;)
score: 1

http://stackoverflow.com/comment/34750106
type: Comment
has text: I could just execute all needed Threads in the Activity class and after all calculations are done I could make the ProgressBar invisible. But how can I then start to draw? I mean, the onDraw() starts immediately when I open the Activity. I could use a If-Else-Block to check a boolean if the calculations are done. But how could I invalidate the view in a thread outside the view class?
type: QuestionComment
comment on: http://stackoverflow.com/q/22790021
score: 0

http://stackoverflow.com/comment/34771066
comment on: http://stackoverflow.com/a/22792499
type: AnswerComment
has text: Thanks, The first one did help. I use `IDeliverableHandle deliverable= workItemClient.findDeliverableByName(projectArea, currentFoundIn ,IDeliverable.SMALL_PROFILE ,null);` and I can get what I need now
score: 0
type: Comment

http://stackoverflow.com/a/22719007
answers question: http://stackoverflow.com/q/22707188
has body: The mirror setting in settings.xml says: Take every URL of every repository and replace it with the mirror, thus no request leave your company. This is usually as it should be. If you really want to bypass your artifact repository, you can exclude certain repositories: artifactory external:*,!java.net http://corporate-network-domain/nexus/content/groups/public Artifactory (By the way, you should use external:* instead of *, because the latter could introduce some hard to trace effects during integration testing) Note that this might violate company conventions. There is usually a reason for not allowing direct access to repositories "in the wild". The better way would be, as Seelenvirtuose suggested, to request your artifactory admin to include the java.net repository in the proxied repositories of your artifactory.
score: 0
type: Answer

http://stackoverflow.com/q/22796117
tagged with: java
has body: I have a project that runs in JBoss EAP 6.0. However, it currently requires that a custom script (.bat) is run at startup. This is possible in IntelliJ. When settings up a Run/Debug Configuration, a tab is provided titled "Startup/Connection" in which a "Startup script" can be targeted. Eclipse is my preferred IDE but it does not appear to have this option. I have tried several things without any results.
tagged with: jboss
tagged with: eclipse
has title: JBoss EAP 6.0 in Eclipse (Kepler): How do you run a custom script at startup?
score: 2
downvote count: 0
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/23616084
favorite count: 0
type: Question
upvote count: 2
answer count: 2
has answer: http://stackoverflow.com/a/22798781

http://stackoverflow.com/a/22740819
has comment: http://stackoverflow.com/comment/34673235
has comment: http://stackoverflow.com/comment/34669867
has comment: http://stackoverflow.com/comment/34673263
downvote count: 0
has comment: http://stackoverflow.com/comment/34666536
answers question: http://stackoverflow.com/q/22732575
has comment: http://stackoverflow.com/comment/34666655
has comment: http://stackoverflow.com/comment/34664459
type: Answer
has comment: http://stackoverflow.com/comment/34673283
score: 3
has comment: http://stackoverflow.com/comment/34673572
upvote count: 3
has comment: http://stackoverflow.com/comment/34669850
has body: In JSF versions prior to 2.0 it was only possible to store objects in the view only by using UIViewRoot.set/getAttribute. However in JSF 2.0 a separate view scope was introduced that can be used in EL via #{viewScope} or programatically using UIViewRoow.getViewMap(). Using the view scope is the recommended way to go. It is implemented using a Map that is kept in the UIViewRoot and is serialized the same way as the view attributes in thew view state so it has the same life as the view attributes. UPDATE According to Leonardo Uribe from MyFaces team: In JSF 2.2 it was decided to store view scope beans always in session (take a look at the description of @ViewScoped annotation in the javadoc). But you can just call facesContext.getViewRoot() and use the attribute map. Just remember the values there must be Serializable or implement StateHolder. So it looks like the portable way is to use the attributes map in UIViewRoot.
has comment: http://stackoverflow.com/comment/34673198
has comment: http://stackoverflow.com/comment/34673422

http://stackoverflow.com/a/22708818
has body: When running a GWT application from Eclipse in dev mode it uses the classpath as defined in your debug configuration. This is the build path of code you are using to compile plus any other jars or folders you have manually added. In addition, because it is a web app it will also use any jars in the WEB-INF/lib folder. When you get the message [WARN] Server class 'org.springframework.web.context.ContextLoaderListener' could not be found in the web app, but was found on the system classpath [WARN] Adding classpath entry 'file:/C:/company/m2/repo/org/springframework/spring-web/2.5.6/spring-web-2.5.6.jar' to the web app classpath for this session then this means the code could not be found in the WEB-INF/lib folder but was found on the classpath as defined by your debug configuration. GWT dev mode will add this jar to your running web app classpath. Generally this all works fine but if your code relies on classes that are looked up dynamically using some sort of classpath searching mechanism this process does not work. This is what is happening here - the namespace handler and associated schema will be in the camel jar but this is not on your classpath. The answer is simple - just add the jar containing the namespace handler to the WEB-INF/lib folder. I have this issue a lot - mainly with Spring but also the RSS library Rome. My project is built using Maven and to manage this I have configured Maven with a devmode profile that includes all the runtime dependencies I need with a goal that copies all my dependencies into the WEB-INF/lib folder. This means I can manage all my dependencies from Maven - useful when sharing a project.
score: 0
has comment: http://stackoverflow.com/comment/34708846
has comment: http://stackoverflow.com/comment/34621546
has comment: http://stackoverflow.com/comment/34621972
has comment: http://stackoverflow.com/comment/34689162
type: Answer
answers question: http://stackoverflow.com/q/22701853

http://stackoverflow.com/q/22657247
has answer: http://stackoverflow.com/a/22657553
downvote count: 0
has answer: http://stackoverflow.com/a/22657568
favorite count: 0
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/22657568
upvote count: 1
has title: Is it good design to have one ObjectFactory interface and class that implements it
tagged with: design-patterns
type: Question
score: 1
tagged with: java
possible better answer: http://stackoverflow.com/a/22657553
answer count: 2
has body: I'm wondering about the following class design. I have one interface which is called ObjectFactory and one class that implements it which is called ObjectFactoryImpl. The class ObjectFactoryImpl has all methods for creating objects from package and to create instance of new object from that package ObjectFactoryImpl instance is required. Class ObjectFactoryImpl is also used internally in all classes that belong to package in wich it resides. Is it a good or bad design?

http://stackoverflow.com/comment/34679588
has text: Ok. Do you have any other classes?
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/22750648
score: 0

http://stackoverflow.com/comment/34710477
has text: Okay, thanks for the help! I made `doSort()` generic (which required some casting within the method to straighten out all of the types), and now everything is flowing nicely
type: AnswerComment
score: 0
type: Comment
comment on: http://stackoverflow.com/a/22767796

http://stackoverflow.com/a/22787336
answers question: http://stackoverflow.com/q/22787195
score: 0
has body: You can't use sendRedirect method twice in the same place, also use requestDispatcher to forward to another resource within your application. For Example: while((ln=b.readLine())!=null) { lnnum++; if(username.equals(ln)) { request.getRequestDispatcher("resourcePath/index.jsp").forward(request, response); } } request.getRequestDispatcher("resourcePath/error.jsp").forward(request, response); if the while loop fail to send user to the index page, then send him him to the error page.,
type: Answer
has comment: http://stackoverflow.com/comment/34744934

http://stackoverflow.com/a/26369813
score: 1
downvote count: 1
answers question: http://stackoverflow.com/q/22666847
has body: You need to increase or disable the Request Timeout in the Glassfish Admin: server-config -&gt; Network Config -&gt; Network Listeners -&gt; &lt;LISTENER&gt; -&gt; HTTP A value of -1 will disable it. Tested in: GlassFish Server Open Source Edition 3.1.2.2
upvote count: 2
type: Answer

annotations
tags question: http://stackoverflow.com/q/22654644
type: Tag
tags question: http://stackoverflow.com/q/22654906
tags question: http://stackoverflow.com/q/22714915
tags question: http://stackoverflow.com/q/22667156
tags question: http://stackoverflow.com/q/22790375
tags question: http://stackoverflow.com/q/22745684
tags question: http://stackoverflow.com/q/22717744
tags question: http://stackoverflow.com/q/22745837
tags question: http://stackoverflow.com/q/22776247
tags question: http://stackoverflow.com/q/22655531
tags question: http://stackoverflow.com/q/22684741
tags question: http://stackoverflow.com/q/22762597
tags question: http://stackoverflow.com/q/22728870
tags question: http://stackoverflow.com/q/22703853
tags question: http://stackoverflow.com/q/22760583
tag name: annotations
tags question: http://stackoverflow.com/q/22760985
tags question: http://stackoverflow.com/q/22750449

http://stackoverflow.com/a/22772005
has comment: http://stackoverflow.com/comment/34756981
upvote count: 2
answers question: http://stackoverflow.com/q/22767888
has body: Why not using an external table : Create the table in MySQL CREATE TABLE federated_table ( id INT(20) NOT NULL AUTO_INCREMENT, name VARCHAR(32) NOT NULL DEFAULT '', other INT(20) NOT NULL DEFAULT '0', PRIMARY KEY (id), INDEX name (name), INDEX other_key (other) ) ENGINE=FEDERATED DEFAULT CHARSET=latin1 CONNECTION='mysql://fed_user@remote_host:9306/federated/test_table'; And you can use it in Vertica to join data from it : CREATE EXTERNAL TABLE ext1 (x integer) AS COPY FROM '/tmp/ext1.dat' DELIMITER ','; You can join regural and external tables in Vertica from version 7 up Another solution is using Pentaho or Talend to do this for you is a free ETL tool very good and easy to use !
downvote count: 0
type: Answer
score: 2
has comment: http://stackoverflow.com/comment/34718843

android-edittext
tags question: http://stackoverflow.com/q/22774996
tags question: http://stackoverflow.com/q/22703083
tags question: http://stackoverflow.com/q/22700841
tags question: http://stackoverflow.com/q/22798347
type: Tag
tags question: http://stackoverflow.com/q/22686153
tags question: http://stackoverflow.com/q/22668049
tags question: http://stackoverflow.com/q/22693471
tag name: android-edittext
tags question: http://stackoverflow.com/q/22698214
tags question: http://stackoverflow.com/q/22716421

http://stackoverflow.com/a/22754078
score: 0
answers question: http://stackoverflow.com/q/22754018
type: Answer
has body: What you're trying to do isn't really the best way to do things, but I'm assuming that the question being asked is how to import the jar correctly. If so: If using eclipse, Make sure the androidlib.jar file is in the libs folder. Right click on androidlib.jar and select Build Path &gt; Add to Build Path Right click on your project folder, go to Properties &gt; Java Build Path &gt; Order and Export and then make sure androidlib.jar is selected. The problem with your current code is that when you call getApplicationContext(), the Activity hasn't been started yet, therefore there is no context. A quick and dirty solution would be to rewrite the startGPS() method like this: public static void startGps(Context context, String message) { Toast.makeText(context, message, Toast.LENGTH_LONG).show(); } But I would much rather put that method inside some sort of Utilities class or even inside a parent Activity class.

http://stackoverflow.com/q/22769373
tagged with: java
has body: I wrote the code for Fibonacci series but I get error ArrayIndexOutofBoundsException. Can you please help me find source of this exception? class Fib { public static void main(String args[]) { int num = Integer.parseInt(args[0]); System.out.println("Fibonacci Series"); int f1, f2 = 0, f3 = 1; for (int i = 1; i &lt;= num; i++) { System.out.print(" " + f3 + " "); f1 = f2; f2 = f3; f3 = f1 + f2; } } }
has title: i wrote the code for fibonacci series but i get error ArrayIndexOutofBoundsException. can you please help me
has answer: http://stackoverflow.com/a/22769403
score: 0
answer count: 2
linked to: http://stackoverflow.com/q/3988788
has comment: http://stackoverflow.com/comment/34712595
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/22769507
type: Question

http://stackoverflow.com/q/22766272
tagged with: eclipse
score: 0
has comment: http://stackoverflow.com/comment/34707190
possible better answer: http://stackoverflow.com/a/22766317
has comment: http://stackoverflow.com/comment/34707242
answer count: 5
has title: Java code not printing to console in Eclipse
has answer: http://stackoverflow.com/a/22766305
has body: I have this java code in eclipse. When I run it, I assume I should get something back in the console at the bottom of eclipse. This is not the case. The console at the bottom of eclipse is blank. package com.veggiedogtreats.javacode; public class doobeedoobeedo { /** * @param args */ public static void main(String[] args) { int x = 1; while (x &lt; 0) { System.out.println("Doo"); System.out.println("Bee"); x = x + 1; } if (x == 2 ) { System.out.print("Do"); } } }
has answer: http://stackoverflow.com/a/22766289
type: AnsweredQuestion
tagged with: java
has answer: http://stackoverflow.com/a/22766317
has answer: http://stackoverflow.com/a/22766304
type: Question
has answer: http://stackoverflow.com/a/22766294
accepted answer: http://stackoverflow.com/a/22766294

http://stackoverflow.com/comment/34820627
comment on: http://stackoverflow.com/q/22804795
has text: Then you probably doesn't have java installed. Download java and install it again...
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/a/22668403
score: 1
has body: All the text sent to Java's System.err is red in Eclipse console only because it was printed on process Standard Error channel. To display Log4j logs in red in Eclipse console, you shall tell Log4j to also use this Standard Error channel, with such a line in your Log4j configuration file: log4j.appender.ConsoleAppender=org.apache.log4j.ConsoleAppender log4j.appender.ConsoleAppender.Target=System.err or if your configuration file is an XML configuration file: &lt;appender name="ConsoleAppender" class="org.apache.log4j.ConsoleAppender"&gt; .... &lt;param name="target" value="System.err"/&gt; .... &lt;/appender&gt;
answers question: http://stackoverflow.com/q/22662069
has comment: http://stackoverflow.com/comment/34551605
upvote count: 1
type: Answer
has comment: http://stackoverflow.com/comment/34549810
downvote count: 0

http://stackoverflow.com/comment/34655807
comment on: http://stackoverflow.com/q/22737903
score: 0
type: QuestionComment
has text: @Hussain and why can't `X` be set as a global variable in exactly the same way?
type: Comment

http://stackoverflow.com/a/22708103
has comment: http://stackoverflow.com/comment/34631592
has comment: http://stackoverflow.com/comment/34636908
upvote count: 4
downvote count: 0
has body: This function will wait until the table contains at least given number of rows public void waitUntilRowPopulates(WebElement element, final int rowCount) { final WebElement table = element; new FluentWait&lt;WebDriver&gt;(driver) .withTimeout(60, TimeUnit.SECONDS) .pollingEvery(10, TimeUnit.MILLISECONDS) .until(new Predicate&lt;WebDriver&gt;() { public boolean apply(WebDriver d) { List&lt;WebElement&gt; rawList = table.findElements(By.tagName("tr")); return (rawList.size() &gt;= rowCount); } }); }
type: AcceptedAnswer
score: 4
answers question: http://stackoverflow.com/q/22707284
type: Answer
has comment: http://stackoverflow.com/comment/35953422
accepted answer of: http://stackoverflow.com/q/22707284

http://stackoverflow.com/comment/34605081
type: Comment
has text: I've added an example with more detailed input and desired output.
comment on: http://stackoverflow.com/a/22669773
score: 0
type: AnswerComment

http://stackoverflow.com/comment/34680519
comment on: http://stackoverflow.com/a/22751592
type: AnswerComment
has text: hmm i tried that, but my calc GUI still crashed when I used it
score: 0
type: Comment

http://stackoverflow.com/comment/34543712
score: 0
type: Comment
comment on: http://stackoverflow.com/a/22675327
has text: Updated the answer. Yes, but for the given scenario this appears to be the cleanest and most efficient.
type: AnswerComment

http://stackoverflow.com/comment/34685214
type: Comment
type: QuestionComment
has text: 1) Post the relevant parts of your `pom.xml`. 2) Check the encoding of every file involved.
comment on: http://stackoverflow.com/q/22754164
score: 0

http://stackoverflow.com/a/22722949
has comment: http://stackoverflow.com/comment/34661281
has body: Its the height of title bar of JFrame that's why y starts visible after 22. Same for x that starts visible from 2 due to JFrame outer border width. Here is the sample code along with snapshot g.setColor(Color.RED); g.drawRect(3, 22, 200, 200); --EDIT-- I never suggest you to use it. Read below comments for it's drawbacks.
has comment: http://stackoverflow.com/comment/34645618
has comment: http://stackoverflow.com/comment/34632491
has comment: http://stackoverflow.com/comment/34629927
upvote count: 1
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/22722777
score: 0
has comment: http://stackoverflow.com/comment/34629952
answers question: http://stackoverflow.com/q/22722777
downvote count: 1
type: Answer

http://stackoverflow.com/comment/34767796
type: Comment
comment on: http://stackoverflow.com/q/22799968
has text: How to write it syntactically in the class. I am not sure if I am supposed to pass the head...
score: 0
type: QuestionComment

http://stackoverflow.com/a/22684375
has body: The loop might not run (the compiler doesn't know for sure) and thus a might not be initialized. This doesn't execute the print statement in the loop, just the assignment: for(;b&lt;=10;b++) a=b; System.out.println(a); //this will only run after the loop. In the above case if b was > 10 before the loop then a=b; would never be executed and the print statement would get un initialized a. I assume you mean this instead: for(;b&lt;=10;b++) { a=b; System.out.println(a); } If you intend to print a after the loop, initialize it to whatever value is appropriate, e.g. int a = 0;.
accepted answer of: http://stackoverflow.com/q/22684316
type: Answer
has comment: http://stackoverflow.com/comment/34559568
has comment: http://stackoverflow.com/comment/34559136
has comment: http://stackoverflow.com/comment/34559297
upvote count: 5
has comment: http://stackoverflow.com/comment/34559878
answers question: http://stackoverflow.com/q/22684316
score: 5
has comment: http://stackoverflow.com/comment/34560154
type: AcceptedAnswer
downvote count: 0

yammer
type: Tag
tags question: http://stackoverflow.com/q/22744721
tag name: yammer

http://stackoverflow.com/comment/34794074
type: AnswerComment
type: Comment
has text: It's my pleasure to help you.. :)
comment on: http://stackoverflow.com/a/22807590
score: 0

http://stackoverflow.com/comment/34692757
has text: The real world applications are not hello world application. They are very complex and involves hundreds of objects and their complexities. Spring is a framework that does many tasks for you, such as dependency injection, AOP etc. Go thru the link http://stackoverflow.com/questions/1610597/why-spring-framework
score: 0
comment on: http://stackoverflow.com/q/22758321
type: Comment
type: QuestionComment

http://stackoverflow.com/q/22670556
tagged with: java
type: Question
has body: What kind of values are we expecting for a enum class like one below. Confused about &lt;&lt; operators public enum FrequencyEnum { DAILY (1), WEEKLY (1 &lt;&lt; 1), BI_WEEKLY (1 &lt;&lt; 2), MONTHLY (1 &lt;&lt; 3), private short id; private FrequencyEnum(int id) { this.id = (short) id; } public short getId() { return id; } public void setId(short id) { this.id = id; } public static FrequencyEnum valueOf(short id) { for (FrequencyEnum status : FrequencyEnum.values()) { if (status.getId() == id) { return status; } } return null; } }
upvote count: 0
has comment: http://stackoverflow.com/comment/34534722
answer count: 1
favorite count: 0
has comment: http://stackoverflow.com/comment/34534668
has title: java enum << operator
has answer: http://stackoverflow.com/a/22670738
type: UnansweredQuestion
downvote count: 2
has comment: http://stackoverflow.com/comment/34534749
tagged with: enums
score: -2

http://stackoverflow.com/comment/34735087
comment on: http://stackoverflow.com/q/22781613
has text: how can you be sure if all data has arrived? inputStream.read(readBuffer) might only provide a semi-complete message while the transmission is ongoing.
type: Comment
type: QuestionComment
score: 0

http://stackoverflow.com/comment/34625308
type: QuestionComment
comment on: http://stackoverflow.com/q/22720691
has text: Does it happen if you make your own client, or use say Telnet?
score: 1
type: Comment

http://stackoverflow.com/a/22814895
has body: You can use package org.apache.mahout.text; and classes SequenceFilesFromLuceneStorageMRJob (for distributed convert) or SequenceFilesFromLuceneStorageDriver. More info about their usage you can find in mahout-0.9 tests. For example here: mahout-0.9/integration/src/test/java/org/apache/mahout/text/SequenceFilesFromLuceneStorageDriverTest.java mahout-0.9/integration/src/test/java/org/apache/mahout/text/SequenceFilesFromLuceneStorageMRJob.java and here https://mahout.apache.org/users/basics/creating-vectors-from-text.html Important note: Your Lucene index must be created with the same version of Lucene used in Mahout.
type: AcceptedAnswer
downvote count: 0
type: Answer
score: 2
upvote count: 2
accepted answer of: http://stackoverflow.com/q/22804169
answers question: http://stackoverflow.com/q/22804169

inheritance
tags question: http://stackoverflow.com/q/22675604
tags question: http://stackoverflow.com/q/22794164
tags question: http://stackoverflow.com/q/22717608
tags question: http://stackoverflow.com/q/22648885
tag name: inheritance
tags question: http://stackoverflow.com/q/22660651
tags question: http://stackoverflow.com/q/22747104
tags question: http://stackoverflow.com/q/22803363
tags question: http://stackoverflow.com/q/22676405
type: Tag
tags question: http://stackoverflow.com/q/22768091
tags question: http://stackoverflow.com/q/22736724
tags question: http://stackoverflow.com/q/22729775
tags question: http://stackoverflow.com/q/22776969
tags question: http://stackoverflow.com/q/22728702
tags question: http://stackoverflow.com/q/22798689
tags question: http://stackoverflow.com/q/22738945
tags question: http://stackoverflow.com/q/22758851
tags question: http://stackoverflow.com/q/22675026
tags question: http://stackoverflow.com/q/22767445
tags question: http://stackoverflow.com/q/22685574
tags question: http://stackoverflow.com/q/22750354

http://stackoverflow.com/q/22726128
type: Question
has body: I made a insert query that is running in Oracle but getting error in Hibernate. Query: insert into tmptable (dcol1, ncol1, ncol2) select TRUNC(hie.timestamp), min(hie.eventid), count(1) from eventtable hie where hie.eventid &gt;= 123 and hie.eventtype = 'NEW' and hie.key like 'SYS_%' and hie.timestamp between trunc(sysdate - 3) and trunc(sysdate) + to_dsinterval('00 23:59:59') group by TRUNC(hie.timestamp) order by TRUNC(hie.timestamp); When running from Spring MVC + Hibernate, it is giving following error: HTTP Status 500 - Request processing failed; nested exception is org.hibernate.hql.ast.QuerySyntaxException: unexpected token: 1 near line 1, column 113 [insert into tmp$genutil .....] Following is the code to insert data: /* TMP_TABLE_INSERT member variable has above Insert query */ Query query = getSession().createQuery(TMP_TABLE_INSERT); int result = query.executeUpdate(); System.out.println("Rows affected: " + result); Can you please suggest what is going wrong here?
has answer: http://stackoverflow.com/a/22726196
has title: Insert query not executing in Hibernate but in Oracle
score: 0
answer count: 1
type: UnansweredQuestion
tagged with: spring
tagged with: java
tagged with: hibernate

http://stackoverflow.com/q/22776533
has comment: http://stackoverflow.com/comment/34938472
has comment: http://stackoverflow.com/comment/35006198
downvote count: 0
has comment: http://stackoverflow.com/comment/35146724
favorite count: 0
type: UnansweredQuestion
has body: I am testing the JGSS sample on my local domain but have a problem with hostbased service. Below is the setup: obtain a keytab generated from command ktpass -princ myservice/host.my.example.com@MY.EXAMPLE.COM -mapuser krbsrv@my.example.com -crypto RC4-HMAC-NT -ptype KRB5_NT_PRINCILAL -pass krbpass -out myservice-host.keytab system admin run setspn -S myservice/host.my.example.com krbsrv to set SPN for active directory. from GssClient.java create the serverprincipal by: GSSName serverName = manager.createName(serverPrinc, GSSName.NT_HOSTBASED_SERVICE); this will result in java.security.PrivilegedActionException: GSSException: No valid credentials provided (Mechanism level: Server not found in Kerberos database (7)) exception. but if I call createName() with GSSName.NT_USER_NAME there will be no error. I have asked system admin and verified no duplicate for setspn -L krbsrv and setspln-X myservice/host.my.example.com. So would there be anything I have messed up? The server is running on Solaris and client is running on Windows, both on Java 6u27. Advice is greatly appreciated.
has comment: http://stackoverflow.com/comment/34953316
tagged with: jgss
answer count: 0
has comment: http://stackoverflow.com/comment/35152566
has comment: http://stackoverflow.com/comment/34997265
upvote count: 1
type: Question
score: 1
tagged with: java
has title: JGSS GSSName.NT_HOSTBASED_SERVICE not working for kerberos service keytab
has comment: http://stackoverflow.com/comment/34958749
tagged with: kerberos

http://stackoverflow.com/comment/34559043
type: Comment
comment on: http://stackoverflow.com/q/22684459
score: 0
has text: Finally i am looking for single query to check and update the table
type: QuestionComment

http://stackoverflow.com/comment/34631754
type: QuestionComment
comment on: http://stackoverflow.com/q/22724061
has text: @k_g "I am restricting it to not to use different if block"
score: 0
type: Comment

http://stackoverflow.com/a/22790377
score: 0
type: AcceptedAnswer
type: Answer
answers question: http://stackoverflow.com/q/22789374
accepted answer of: http://stackoverflow.com/q/22789374
has body: Hazelcast has a native Memcached protocol client http://hazelcast.org/docs/latest/manual/html-single/hazelcast-documentation.html#memcache-client

http://stackoverflow.com/comment/62675135
type: AnswerComment
comment on: http://stackoverflow.com/a/22806587
type: Comment
has text: You, sir, are a genius. Thank you for such a good explanation!
score: 1

http://stackoverflow.com/comment/48395708
type: Comment
has text: it works for JTextArea too just one line `textArea.setOpaque(false);`
type: AnswerComment
comment on: http://stackoverflow.com/a/22700611
score: 0

http://stackoverflow.com/comment/34510025
type: QuestionComment
has text: @Shriram any sample??
comment on: http://stackoverflow.com/q/22656737
score: 0
type: Comment

http://stackoverflow.com/comment/34641533
has text: Oh I was running it as a java application ! Thanks for your help ! :) I am running this program in command prompt.
comment on: http://stackoverflow.com/a/22729705
score: 0
type: AnswerComment
type: Comment

http://stackoverflow.com/a/22743641
has comment: http://stackoverflow.com/comment/34680997
has body: I think that you are misunderstanding what the JLS example is intended to show: static void reader() { if (f != null) { int i = f.x; // guaranteed to see 3 int j = f.y; // could see 0 } } This code does not guarantee that the latest value of f will be seen by the thread that calls reader(). But what it is saying is that if you do see f as non-null, then f.x is guaranteed to be 3 ... despite the fact that we didn't actually do any explicit synchronizing. Well is this implicit synchronization for finals in constructors useful? Certainly it is ... IMO. It means that we don't need to do any extra synchronization each time we accessed an immutable object's state. That is a good thing, because synchronization typically entails cache read-through or write-through, and that slows your program down. But what Pugh is saying is that you will typically need to synchronize to get hold of the reference to the immutable object in the first place. He is making the point that using immutable objects (implemented using final) does not excuse you from the need to synchronize ... or from the need to understand the concurrency / synchronization implementation of your application. The problem is that we still need to be sure that reader will se a non-null "f", and that's only possible if we use other synchronization mechanism that will already provide the semantics of allowing us to see 3 for f.x. And if that's the case, why bother using final for thread safety stuff? There is a difference between synchronizing to get the reference and synchronizing to use the reference. The first one I may need to do only once. The second one I may need to do lots of times ... with the same reference. And even if it is one-to-one, I have still halved the number of synchronizing operations ... if I (hypothetically) implement the immutable object as thread-safe.
has comment: http://stackoverflow.com/comment/34665787
type: Answer
score: 11
downvote count: 0
answers question: http://stackoverflow.com/q/22743223
has comment: http://stackoverflow.com/comment/34666450
has comment: http://stackoverflow.com/comment/34666076
has comment: http://stackoverflow.com/comment/34671660
has comment: http://stackoverflow.com/comment/34666339
has comment: http://stackoverflow.com/comment/34665863
has comment: http://stackoverflow.com/comment/34666540
upvote count: 11

http://stackoverflow.com/comment/34828844
has text: Thanks, that was the problem! I solved it with [this answer](http://stackoverflow.com/a/2001205/3318377).
type: AnswerComment
score: 0
comment on: http://stackoverflow.com/a/22807459
type: Comment

http://stackoverflow.com/comment/34671550
has text: @aliteralmind, nifty! NetBeans allows FreeMarker based autocomplete templates - all sorts of funky things are possible...
comment on: http://stackoverflow.com/a/22746715
score: 0
type: AnswerComment
type: Comment

processing
tags question: http://stackoverflow.com/q/22726610
type: Tag
tags question: http://stackoverflow.com/q/22786180
tags question: http://stackoverflow.com/q/22675322
tags question: http://stackoverflow.com/q/22649774
tags question: http://stackoverflow.com/q/22793129
tags question: http://stackoverflow.com/q/22691424
tags question: http://stackoverflow.com/q/22757105
tag name: processing

http://stackoverflow.com/comment/34497142
type: Comment
type: QuestionComment
has text: Use System.out.printf(...) and use format specifiers, like `%4d`.
comment on: http://stackoverflow.com/q/22649269
score: 1

http://stackoverflow.com/comment/34607728
score: 1
comment on: http://stackoverflow.com/q/22666762
has text: I posted this question on Heroku support area, and it seems like Play 2 builds tend to be slow, particularly on first push. Subsequent builds are incremental and shouldn't need an extended compile timeout. So they just extended my build time. Problem Solved!!!
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/42546143
type: Comment
has text: Seems: 4F - AID TLV, contains Oberthur's application (RID=A000000077). 50 - application label "CNI-CSE".
comment on: http://stackoverflow.com/a/22743298
score: 1
type: AnswerComment

http://stackoverflow.com/comment/34707356
comment on: http://stackoverflow.com/a/22765795
type: AnswerComment
type: Comment
has text: `shipper` and `dest` are table aliases - basically, since I'm joining the `customers` table twice (with a different condition for each one), I need a way to relate to the two different entities. Does this answer your question?
score: 0

http://stackoverflow.com/comment/44277954
comment on: http://stackoverflow.com/a/22957786
type: Comment
has text: Is destroy() method kills the process normally ? As I get the status of '1'by process.exitValue() after process.destro().
score: 0
type: AnswerComment

http://stackoverflow.com/q/22654850
linked to: http://stackoverflow.com/q/369639
type: Question
tagged with: java
score: 0
has body: I need to deploy my webapp to a non-managed Tomcat outside of NetBeans. Is there any way to do that using NetBeans? My NetBeans 7.4 came with Tomcat 7.0.41, but my Ubuntu 12.04 has got Tomcat 7.0.26 outside of NetBeans. I want deploy war to Tomcat 7.0.26. Because Tomcat 7.0.26 has a directory structure that is different from the one expected by NetBeans, I can't add Tomcat 7.0.26 to Netbeans. How can I deploy (and hot deploy) to Tomcat unmanaged by NetBeans ?
answer count: 1
has answer: http://stackoverflow.com/a/22673662
accepted answer: http://stackoverflow.com/a/22673662
tagged with: tomcat
has title: Deploy war to local Tomcat instance not managed by netbeans
tagged with: web-deployment
has comment: http://stackoverflow.com/comment/34552319
has comment: http://stackoverflow.com/comment/34540266
type: AnsweredQuestion
tagged with: netbeans

http://stackoverflow.com/comment/34807411
comment on: http://stackoverflow.com/a/22802457
has text: Ok, could you check the permission of your resource and if possible could you post your code or JNLP file. I faced the same issue and it was merely permission of the file.
type: Comment
score: 0
type: AnswerComment

http://stackoverflow.com/comment/34548339
type: QuestionComment
type: Comment
score: 0
has text: So far i've just used "red" and "Gibson" to validate that it actually works, but it doesn't :(
comment on: http://stackoverflow.com/q/22678169

http://stackoverflow.com/a/27124662
type: Answer
has comment: http://stackoverflow.com/comment/79650568
upvote count: 1
downvote count: 1
answers question: http://stackoverflow.com/q/22701554
score: 0
has body: Seems your application have dependency problem ViewExpiredException can be handled easily, it is a no problem handle ViewExpiredException full configured JSF project example JSF2.2 frontend

http://stackoverflow.com/comment/34710862
comment on: http://stackoverflow.com/a/22768210
type: AnswerComment
score: 0
type: Comment
has text: ahh of i was going to use bytes where each signature is on a new line and then scan them into an arraylist before the scan and then iterate through them for each file, is there a best format for the signatures?

http://stackoverflow.com/a/22675427
type: Answer
has body: I had the same trouble when I was doing a swing program with Java SE. I had to call xpath.evalute method about 12 different times, each time taking atleast 2-3 seconds which made my program awfully slow. The simple solution was to use a substring. It might sound naive and a lot of work, but it actually works if you just have under 10 different parameters to parse from the XML and most importantly the XML is reliable and well formatted. In your case with just 8 different parameters to parse in the entire document, this method is quite easily achievable. Just use a for-loop too. Implement something like this : First, parse your entire XML document to a string. Let's call it yourXmlDoc. And store the values of humidity in a String array. num1=0; num2=0; num3=0; for (int i=0;i&lt;*number of times you need to repeat*;i++){ num1=yourXmlDoc.indexOf("humidity",num3); num2=yourXmlDoc.indexOf("/humidity",num1); num3=num2; humidity[i]=yourXmlDoc.substring(num1+9,num2-1); System.out.println(humidity[i]); .. continue with more parameters to parse and let its starting point be num3 } P.S. This is possible only in case of a well formatted XML. Otherwise its very hard to implement and is a waste of time.
answers question: http://stackoverflow.com/q/22654309
accepted answer of: http://stackoverflow.com/q/22654309
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/34551201
score: 0

http://stackoverflow.com/q/22718859
has answer: http://stackoverflow.com/a/22719253
possible better answer: http://stackoverflow.com/a/22718949
has answer: http://stackoverflow.com/a/22718949
has answer: http://stackoverflow.com/a/22719061
has body: In Java, I want to see if a string contains the following: String link = "%5B%7E%5D/assets.jpg"; if (link.contains("%5B%7E%5D"){ System.out.println("Yes this contains: %5B%7E%5D"); } What is the regular expression for searching if a string contains: %5B%7E%5D?
tagged with: regex
answer count: 4
type: AnsweredQuestion
tagged with: java
has title: What's the Regular Expression for searching a String for "%5B%7E%5D"?
type: Question
has answer: http://stackoverflow.com/a/22718990
score: 0
accepted answer: http://stackoverflow.com/a/22718990
has comment: http://stackoverflow.com/comment/34621871

http://stackoverflow.com/q/22734849
has comment: http://stackoverflow.com/comment/34650489
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/80535144
accepted answer: http://stackoverflow.com/a/22743448
tagged with: garbage-collection
downvote count: 1
type: Question
tagged with: java
has body: My spark cluster hangs when I try to cache() or persist(MEMORY_ONLY_SER()) my RDDs. It works great and computes results in about 7min. if I don't use cache(). I've got 6 c3.xlarge EC2 instances (4 cores, 7.5 GB RAM each), which gives in total 24 cores and 37.7 GB. I run my application with the following command on master: SPARK_MEM=5g MEMORY_FRACTION="0.6" SPARK_HOME="/root/spark" java -cp ./uber-offline.jar:/root/spark/assembly/target/scala-2.10/spark-assembly_2.10-0.9.0-incubating-hadoop1.0.4.jar pl.instream.dsp.offline.OfflineAnalysis The data set is about 50GB of data partitioned into 24 files. I compressed it and stored in S3 bucket in 24 files (where each of it has size of 7MB to 300MB). I absolutely can't find a reason for such behaviour of my cluster, but it seems, like spark consumed all available memory and got into GC collecting loop. When I look into gc verbose, I can find a cycles like below: [GC 5208198K(5208832K), 0,2403780 secs] [Full GC 5208831K-&gt;5208212K(5208832K), 9,8765730 secs] [Full GC 5208829K-&gt;5208238K(5208832K), 9,7567820 secs] [Full GC 5208829K-&gt;5208295K(5208832K), 9,7629460 secs] [GC 5208301K(5208832K), 0,2403480 secs] [Full GC 5208831K-&gt;5208344K(5208832K), 9,7497710 secs] [Full GC 5208829K-&gt;5208366K(5208832K), 9,7542880 secs] [Full GC 5208831K-&gt;5208415K(5208832K), 9,7574860 secs] This finally leads to the messages like: WARN storage.BlockManagerMasterActor: Removing BlockManager BlockManagerId(0, ip-xx-xx-xxx-xxx.eu-west-1.compute.internal, 60048, 0) with no recent heart beats: 64828ms exceeds 45000ms ...and stops any progress in computing. This looks like the memory was consumed in 100%, but I tried to use machines with more RAM (like 30GB each), and the effect is the same. What might be the reason of such behaviour?? Could anybody help??
has comment: http://stackoverflow.com/comment/34662011
has title: apache-spark memory consumption for cache() / persist()
upvote count: 4
answer count: 2
tagged with: apache-spark
favorite count: 0
has comment: http://stackoverflow.com/comment/34650587
score: 3
possible better answer: http://stackoverflow.com/a/28379590
has comment: http://stackoverflow.com/comment/34653916
has answer: http://stackoverflow.com/a/28379590
has answer: http://stackoverflow.com/a/22743448

http://stackoverflow.com/a/22800830
type: Answer
score: 3
has comment: http://stackoverflow.com/comment/34769472
downvote count: 0
answers question: http://stackoverflow.com/q/22800788
upvote count: 3
has body: You can simplify it with a loop, for example: else if(x ==1) { text1.setText (text1.getText() + "arts"); text2.setText (text2.getText() + "add a bit"); text3.setText (text3.getText() + "add a bit"); text4.setText (text4.getText() + "add a bit"); text5.setText (text5.getText() + "add a bit"); text6.setText (text6.getText() + "add a bit"); text7.setText (text7.getText() + "add a bit"); text8.setText (text8.getText() + "add a bit"); text9.setText (text9.getText() + "add a bit"); text10.setText (text10.getText() + "add a bit"); text11.setText(text11.getText() + "add a bit"); } to for (int i = 1; i &lt; 12; i++){ text[i].setText(....) }

http://stackoverflow.com/q/22661207
score: 0
has comment: http://stackoverflow.com/comment/34568913
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/34527400
tagged with: java-8
type: Question
has answer: http://stackoverflow.com/a/23263416
tagged with: enums
tagged with: java
tagged with: hibernate
has body: is it possible to map a list of java.time.Month to a seperate Table like so: |MyEntity | |MyEntity_Month | |Month | |---------------------| |------------------| |---------------| |id : long | |myEntity_Id : long| |id : long | | |----|month_Id : long |----| | |---------------------| |------------------| |---------------| I have tried it like this but it that only creates a table MyEntity_Month with a myEntity_Id and values: @ElementCollection(targetClass = Month.class, fetch = FetchType.EAGER) @Enumerated(EnumType.STRING) @CollectionTable(name = "MyEntity_Months" , joinColumns = @JoinColumn(name = "myEntity_id")) private List&lt;Month&gt; months; The problem with that solution is that the values are repeated for each MyEntity instead of associated. Database view of the above annotation configuration: |MyEntity | |MyEntity_Month | |---------------------| |-----------------------| |id : long | |myEntity_id | MONTH | |... |----|-----------------------| |---------------------| |1 | NOVEMBER | |1 | DECEMBER | |2 | JANUARY | |2 | DECEMBER | |-----------------------| Is it possible to map via assocation table so that I need only 12 Month Strings in the database? I'm using Hibernate 4.3 / JPA 2.1 btw
has title: Mapping a list of Java 8 month enum in Hibernate
answer count: 1

http://stackoverflow.com/comment/34632083
type: QuestionComment
comment on: http://stackoverflow.com/q/22702906
score: 0
has text: @Andrew Thompson Ok. Maybe I assumed too much, but I basically was just trying to get rid of the ugly Windows XP style tabs. I ended up finding a solution though. I'll post a picture on my answer so you can see the 'nicer' ones.
type: Comment

http://stackoverflow.com/a/22742045
accepted answer of: http://stackoverflow.com/q/22740267
upvote count: 2
type: AcceptedAnswer
has body: Reading the error message makes the error immediately identifiable: SELECT v.company.companyId.companyCodev.company.companyId.branchCodefrom Don't you see that some spaces are missing in the query?
type: Answer
score: 2
downvote count: 0
answers question: http://stackoverflow.com/q/22740267

http://stackoverflow.com/q/22744277
has comment: http://stackoverflow.com/comment/34666869
tagged with: lucene
score: 0
answer count: 2
has comment: http://stackoverflow.com/comment/34667721
has body: First of all I am a total noob when it comes to Tika and Lucene. I am working through the Tika in Action book trying out the examples. In chapter 5 this example is given: package tikatest01; import java.io.File; import org.apache.tika.Tika; import org.apache.lucene.document.Document; import org.apache.lucene.document.Field; import org.apache.lucene.document.Field.Index; import org.apache.lucene.document.Field.Store; import org.apache.lucene.index.IndexWriter; public class LuceneIndexer { private final Tika tika; private final IndexWriter writer; public LuceneIndexer(Tika tika, IndexWriter writer) { this.tika = tika; this.writer = writer; } public void indexDocument(File file) throws Exception { Document document = new Document(); document.add(new Field( "filename", file.getName(), Store.YES, Index.ANALYZED)); document.add(new Field( "fulltext", tika.parseToString(file), Store.NO, Index.ANALYZED)); writer.addDocument(document); } } And this main method: package tikatest01; import java.io.File; import org.apache.lucene.index.IndexWriter; import org.apache.lucene.store.SimpleFSDirectory; import org.apache.lucene.util.Version; import org.apache.lucene.analysis.standard.StandardAnalyzer; import org.apache.tika.Tika; public class TikaTest01 { public static void main(String[] args) throws Exception { String filename = "C:\\testdoc.pdf"; File file = new File(filename); IndexWriter writer = new IndexWriter( new SimpleFSDirectory(file), new StandardAnalyzer(Version.LUCENE_30), MaxFieldLength.UNLIMITED); try { LuceneIndexer indexer = new LuceneIndexer(new Tika(), writer); indexer.indexDocument(file); } finally { writer.close(); } } } I've added the libraries tika-app-1.5.jar, lucene-core-4.7.0.jar and lucene-analyzers-common-4.7.0.jar to the project. Questions: With the current version of Lucene the Field.Index is deprecated, what should I use instead? MaxFieldLength is not found. I am missing an import?
has comment: http://stackoverflow.com/comment/34667308
has answer: http://stackoverflow.com/a/22750270
accepted answer: http://stackoverflow.com/a/22750270
type: AnsweredQuestion
possible better answer: http://stackoverflow.com/a/22745411
has title: Tika in Action book examples Lucene StandardAnalyzer does not work
tagged with: java
has answer: http://stackoverflow.com/a/22745411
type: Question
tagged with: apache-tika

http://stackoverflow.com/a/22668266
answers question: http://stackoverflow.com/q/22666935
has comment: http://stackoverflow.com/comment/34538133
downvote count: 0
has comment: http://stackoverflow.com/comment/34539134
has comment: http://stackoverflow.com/comment/34539063
type: Answer
upvote count: 1
score: 1
has comment: http://stackoverflow.com/comment/34538077
has body: Perhaps I'm nit-picking your wording, but all of the higher level API (JDO, JPA, and Ofy) use the low-level API, so all entities are really LL API entities. So, you note that "Objectify caches entities as the low level datastore Entity type", but wouldn't all higher level datastore API's do the same (assuming they've been instructed to use such caching)? So I don't think this has anything to do with ofy. Moving on, it seems natural that your 3rd test takes much longer then the others - the Entity type adds considerable overhead relative to the simple String and even Map types. I am a bit surprised that it takes that much longer, but taking a step back, you are fetching 1000 entities, so that is still &lt; 1 ms per entity. I think you should add 1 more test. There is a java API to get the size in memory of an instance (can't remember it off hand). Determine the memory size of the entities you are using in your test, and then change the string test to use an object of the same size. That way we can isolate whether this has anything to do with the Entity type itself, or is just a result of the considerably greater size of the objects being cached in the 3rd test. Update in response to new test results... Interesting. That does seem to confirm your theory that it is the serializing done by the memcache code that is causing the slowdown. That is odd, though - wouldn't memcache simply serialize the object in a manner very similar to what you are doing? Perhaps this post helps: manual serialization / deserialization of AppEngine Datastore objects The memcache interface that you are using for fetching Entity objects is: java.lang.Object get(java.lang.Object key) https://developers.google.com/appengine/docs/java/javadoc/com/google/appengine/api/memcache/MemcacheService#get(java.lang.Object) So it's not taking a seralizable, so rather then serializing the way that you are, it is probably using introspection. That would explain why 'EntityPreSerializedBenchmark' is much faster…

http://stackoverflow.com/comment/34612830
score: 0
type: Comment
type: AnswerComment
has text: Thanks @MenoHochschild, you are right. I have corrected the answer.
comment on: http://stackoverflow.com/a/22713861

http://stackoverflow.com/comment/34689639
score: 0
type: Comment
type: QuestionComment
has text: Hi Werner, if the upgrade to version 16 solves your problem it's common stack overflow practice to post your own solution as an answer and accept it.
comment on: http://stackoverflow.com/q/22672846

http://stackoverflow.com/a/22682288
score: 0
has body: The probable issue is like the dependent Jars are not in place. Are you providing any VM arguments to run your Application from Eclipse. If Yes, then please note you can't provide VM arguments in the Runnable Jar. Solution is , you can use "Launch4J" to pass VM arguments to your application. " VM arguments will not be part of the runnable JAR. Arguments can be passed on the command line when launching the JAR". While creating the Runnable Jar, check first checkbox "Extract Required Libraries into generated JAR". Cheers .. :) Subh
type: Answer
answers question: http://stackoverflow.com/q/22682072

http://stackoverflow.com/comment/34646721
comment on: http://stackoverflow.com/a/22732512
score: 0
type: AnswerComment
has text: You can do the delete yourself.or try to reword the question.to make it clearly and specific to your problem
type: Comment

http://stackoverflow.com/comment/34718446
has text: Is it possible that cython is using an interpreter with a grammar of >= 2.6 and jython is using a grammar of < 2.6? This seems like the bigger issue here.
score: 0
type: QuestionComment
comment on: http://stackoverflow.com/q/22771891
type: Comment

http://stackoverflow.com/comment/34602107
type: QuestionComment
comment on: http://stackoverflow.com/q/22707787
has text: @peeskillet i need to run same program twice and when i update city list in one window, it needs to affect other window.
score: 1
type: Comment

http://stackoverflow.com/q/22760234
has answer: http://stackoverflow.com/a/22760268
accepted answer: http://stackoverflow.com/a/22760268
type: AnsweredQuestion
tagged with: java
has body: I'm getting an error (in my android emulator) saying that "unfortunately, my_project_name has stopped.." when i try to run the app. I would appreciate some help with this. Here is the Logcat output: 03-30 10:43:32.079: D/AndroidRuntime(1228): Shutting down VM 03-30 10:43:32.079: W/dalvikvm(1228): threadid=1: thread exiting with uncaught exception (group=0xb4a84ba8) 03-30 10:43:32.099: E/AndroidRuntime(1228): FATAL EXCEPTION: main 03-30 10:43:32.099: E/AndroidRuntime(1228): Process: com.example.testproject28_3_2014, PID: 1228 03-30 10:43:32.099: E/AndroidRuntime(1228): java.lang.RuntimeException: Unable to start activity ComponentInfo{com.example.testproject28_3_2014/com.example.testproject28_3_2014.MainActivity}: java.lang.NullPointerException 03-30 10:43:32.099: E/AndroidRuntime(1228): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2195) 03-30 10:43:32.099: E/AndroidRuntime(1228): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2245) 03-30 10:43:32.099: E/AndroidRuntime(1228): at android.app.ActivityThread.access$800(ActivityThread.java:135) 03-30 10:43:32.099: E/AndroidRuntime(1228): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1196) 03-30 10:43:32.099: E/AndroidRuntime(1228): at android.os.Handler.dispatchMessage(Handler.java:102) 03-30 10:43:32.099: E/AndroidRuntime(1228): at android.os.Looper.loop(Looper.java:136) 03-30 10:43:32.099: E/AndroidRuntime(1228): at android.app.ActivityThread.main(ActivityThread.java:5017) 03-30 10:43:32.099: E/AndroidRuntime(1228): at java.lang.reflect.Method.invokeNative(Native Method) 03-30 10:43:32.099: E/AndroidRuntime(1228): at java.lang.reflect.Method.invoke(Method.java:515) 03-30 10:43:32.099: E/AndroidRuntime(1228): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:779) 03-30 10:43:32.099: E/AndroidRuntime(1228): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:595) 03-30 10:43:32.099: E/AndroidRuntime(1228): at dalvik.…
type: Question
has title: Error when starting up an Android app ("Unfortunately, project_name has stopped")
possible better answer: http://stackoverflow.com/a/22761189
has answer: http://stackoverflow.com/a/22761189
tagged with: eclipse
score: 0
answer count: 2
tagged with: android

jogl
tag name: jogl
tags question: http://stackoverflow.com/q/22775471
tags question: http://stackoverflow.com/q/22750636
type: Tag
tags question: http://stackoverflow.com/q/22718236

http://stackoverflow.com/q/22694596
has comment: http://stackoverflow.com/comment/34578069
has comment: http://stackoverflow.com/comment/34577953
has comment: http://stackoverflow.com/comment/34578704
has comment: http://stackoverflow.com/comment/34578547
type: Question
has comment: http://stackoverflow.com/comment/34577828
has comment: http://stackoverflow.com/comment/34577923
has comment: http://stackoverflow.com/comment/34578670
has comment: http://stackoverflow.com/comment/34577885
tagged with: arraylist
score: 0
has comment: http://stackoverflow.com/comment/34579262
has comment: http://stackoverflow.com/comment/34577675
has answer: http://stackoverflow.com/a/22696611
has comment: http://stackoverflow.com/comment/34579178
accepted answer: http://stackoverflow.com/a/22696611
has comment: http://stackoverflow.com/comment/34579026
answer count: 1
has comment: http://stackoverflow.com/comment/34577874
has comment: http://stackoverflow.com/comment/34579858
has comment: http://stackoverflow.com/comment/34578203
has comment: http://stackoverflow.com/comment/34578325
has comment: http://stackoverflow.com/comment/34579221
has comment: http://stackoverflow.com/comment/34578390
has comment: http://stackoverflow.com/comment/34577687
has comment: http://stackoverflow.com/comment/34579495
has body: The loop in the following code stops after the first element: public ArrayList&lt;Position&gt; moveOptions(Player p, Die d) { // Init array ArrayList&lt;Position&gt; options = new ArrayList&lt;&gt;(); Helper.m("Option size: " + options.size()); // Get player's pin positions (current) ArrayList&lt;Position&gt; pos = p.getPinPositions(); Helper.m("p.getPinPositions() size: " + pos.size()); int i = 0; for (Position ps : p.getPinPositions()) { Helper.m("I am in the loop"); // Get the pin in this position Pin pin = ps.getPin(); // Get next field according to the die Helper.m("The size of pos before 'next' call:" + pos.size()); Field next = ps.getPin().getNextFieldByDie(d); Helper.m("The size of pos after 'next' call:" + pos.size()); // If the die value doesn't exceed the board size if(next != null) { Helper.m("next is not null"); Helper.m("The size of pos before constructor call:" + pos.size()); Position possible = new Position(next, ps.getPin()); Helper.m("The size of pos after constructor call:" + pos.size()); options.add(possible); } Helper.m("The size of 'options' is now " + options.size()); i++; } Helper.m("I: " + i); Helper.m("The final size of 'options' is " + options.size()); Helper.m("The final size of 'pos' is " + pos.size()); return options; } After some investigation I got to the conclusion that this line is the issue: Position possible = new Position(next, ps.getPin()); The loop doesn't continue even if I put a 'continue' there or if I create a new empty instance of the Position outside the loop. Any suggestions? The output is this: Option size: 0 p.getPinPositions() size: 4 I am in the loop The size of pos before 'next' call:4 The size of pos after 'next' call:1 next is not null The size of pos before constructor call:1 The size of pos after constructor call:1 The size of 'options' is now 1 I: 1 The final size of 'options' is 1 The final size of 'pos' is 1 The Position class: /** * Keep pin positions in object */ public class Position { // Field object priv…
has comment: http://stackoverflow.com/comment/34578828
tagged with: instantiation
has comment: http://stackoverflow.com/comment/34579552
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/34577758
tagged with: java
has title: Java: new instance of the same type as the ArrayList loop stops the loop

http://stackoverflow.com/q/22797468
upvote count: 1
answer count: 1
tagged with: java
tagged with: formatting
has answer: http://stackoverflow.com/a/22797505
type: AnsweredQuestion
has body: I have a case where I would like to create a DecimalFormat by setting various options directly. For example, pattern.setNegativePrefix(myPrefix); pattern.setNegativeSuffif(mySuffix); pattern.setMinimumFractionDigits(2); etc. But when all's said and done, I'd like to actually capture the pattern string that represents that so I can reuse it again. Can I do that using this method or do I have to construct the pattern string myself and pass it in? In other words, I'm asking, is there an equivalent to the (non-existent) getPattern method in DecimalFormat?
downvote count: 0
score: 1
favorite count: 0
type: Question
has title: Java DecimalFormat get Pattern as text
accepted answer: http://stackoverflow.com/a/22797505

http://stackoverflow.com/comment/34503613
has text: @jegadees if you can justify what is wrong with answers in that thread, maybe show examples, and clarify what you mean by latest and why you think there would've been changes, you should add that to the question. It might get reopened then. Currently the question contains no reason to think it's nothing more than a duplicate.
score: 2
comment on: http://stackoverflow.com/q/22652953
type: Comment
type: QuestionComment

http://stackoverflow.com/a/29136632
has body: I also met this problem. I had config server name in hbase-site.xml rather than the IP, and my java client also stuck in this situation. So I set my client system host for the server name, and I solved this case.
answers question: http://stackoverflow.com/q/22755912
type: Answer
score: 0

http://stackoverflow.com/q/22652546
upvote count: 1
answer count: 1
downvote count: 1
favorite count: 0
score: 0
has answer: http://stackoverflow.com/a/22654485
accepted answer: http://stackoverflow.com/a/22654485
has title: Generic class that extends collection generic class
tagged with: generics
type: AnsweredQuestion
tagged with: java
type: Question
has body: I'm using Guava's LineProcessor interface when reading lines from files. I've created my class called Line Loader which will store lines read. I want it to be generic on choice of collection lines should be stored in so I wrote something like this: public abstract class LineLoader&lt;T&gt; implements LineProcessor&lt;Collection&lt;T&gt;&gt; { private final Collection&lt;T&gt; result; public LineLoader() { this.result = init(); } protected boolean add(final T line) { return result.add(line); } @Override public boolean processLine(final String line) throws Exception { final T data = parser.parseLine(line); if (data == null) { return false; } return add(data); } @Override public Collection&lt;T&gt; getResult() { return result; } protected abstract Collection&lt;T&gt; init(); } where with init() method I force subclasses to chose type of collection, for example: public abstract class LinkedLineLoader&lt;T&gt; extends LineLoader&lt;T&gt; { @Override protected Collection&lt;T&gt; init() { return new LinkedList&lt;T&gt;(); } } I planned on doing this: public class LineLoader&lt;T&gt; implements LineProcessor&lt;C&lt;T&gt; extends Collection&lt;T&gt;&gt; { private final C&lt;T&gt; result; public LineLoader() { result = new C&lt;T&gt;(); } protected boolean add(final T line) { return result.add(line); } @Override public boolean processLine(final String line) throws Exception { final T data = parser.parseLine(line); if (data == null) { return false; } return add(data); } @Override public C&lt;T&gt; getResult() { return result; } } so that latter subclases (if needed) could do: public class LinkedLineLoader&lt;T&gt; extends LineLoader&lt;LinkedList&lt;T&gt;&gt; { } but it's not possible. Is there a clean solution to this problem?

http://stackoverflow.com/a/22732042
has comment: http://stackoverflow.com/comment/34669770
type: Answer
has comment: http://stackoverflow.com/comment/34646189
has comment: http://stackoverflow.com/comment/34645847
answers question: http://stackoverflow.com/q/22731748
has comment: http://stackoverflow.com/comment/34646103
has body: First of all your hello.java should be already compiled n the class file should present in the current directory where the program is located. And for getting errors, you can get error stream from process class's object. BufferedReader stdError = new BufferedReader(new InputStreamReader(pr.getErrorStream())); String s=""; while ((s = stdError.readLine()) != null) System.out.println(s);
score: 0
has comment: http://stackoverflow.com/comment/34645615

http://stackoverflow.com/comment/34740544
type: Comment
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/22784733
has text: Thanks , i could able to resovle this now thank you very much once again .

c3p0
tags question: http://stackoverflow.com/q/22695281
tags question: http://stackoverflow.com/q/22788068
tags question: http://stackoverflow.com/q/22755376
tags question: http://stackoverflow.com/q/22722671
tag name: c3p0
type: Tag

http://stackoverflow.com/a/26817058
answers question: http://stackoverflow.com/q/22733132
has body: Compiler Vs Interpreter: Compiler Takes an entire program as input Interpreter Takes Single instructions as input. Intermediate Object Code is Generated No Intermediate Object Code is Generated Conditional Control Statements are Executed faster Conditional Control Statements are Executed slower Memory Requirement: More (Since Object Code is Generated) Memory Requirement: Less Program need not be compiled every time Every time higher level program is converted into lower level program Errorsare displayed after entire program is checked Errors are displayed for every instruction interpreted (if any) Example: C Compiler Example: BASIC
type: Answer
score: 0

http://stackoverflow.com/a/22691262
upvote count: 2
type: Answer
score: 2
has comment: http://stackoverflow.com/comment/34572748
has body: No. switch/case for String is only available for Java 7+, and Android Dalvik is based on Java 6. EDIT: note that starting with API 16 there are some Java 7 features included, check this other answer.
has comment: http://stackoverflow.com/comment/34574969
answers question: http://stackoverflow.com/q/22691232
downvote count: 0

methods
tags question: http://stackoverflow.com/q/22725415
tags question: http://stackoverflow.com/q/22700944
tags question: http://stackoverflow.com/q/22714741
tags question: http://stackoverflow.com/q/22800055
tags question: http://stackoverflow.com/q/22773478
tags question: http://stackoverflow.com/q/22774655
tags question: http://stackoverflow.com/q/22772224
tags question: http://stackoverflow.com/q/22766709
tags question: http://stackoverflow.com/q/22751109
tag name: methods
tags question: http://stackoverflow.com/q/22737724
tags question: http://stackoverflow.com/q/22786184
tags question: http://stackoverflow.com/q/22651226
tags question: http://stackoverflow.com/q/22672669
tags question: http://stackoverflow.com/q/22701694
tags question: http://stackoverflow.com/q/22727203
tags question: http://stackoverflow.com/q/22794329
tags question: http://stackoverflow.com/q/22771720
tags question: http://stackoverflow.com/q/22667671
type: Tag
tags question: http://stackoverflow.com/q/22803983
tags question: http://stackoverflow.com/q/22651308
tags question: http://stackoverflow.com/q/22650711
tags question: http://stackoverflow.com/q/22652518
tags question: http://stackoverflow.com/q/22774673
tags question: http://stackoverflow.com/q/22737789
tags question: http://stackoverflow.com/q/22693176
tags question: http://stackoverflow.com/q/22650300
tags question: http://stackoverflow.com/q/22798529
tags question: http://stackoverflow.com/q/22798153
tags question: http://stackoverflow.com/q/22739259
tags question: http://stackoverflow.com/q/22648226
tags question: http://stackoverflow.com/q/22673684
tags question: http://stackoverflow.com/q/22675651
tags question: http://stackoverflow.com/q/22749590
tags question: http://stackoverflow.com/q/22744083
tags question: http://stackoverflow.com/q/22750354
tags question: http://stackoverflow.com/q/22692809
tags question: http://stackoverflow.com/q/22736078
tags question: http://stackoverflow.com/q/22765820

http://stackoverflow.com/comment/36483337
type: Comment
score: 0
comment on: http://stackoverflow.com/q/22808223
has text: You don’t set the `JScrollBar`s to non-opaque but the entire `JScrollPane`. However, both won’t work. It’s not quite clear what behavior you expect from a `JScrollPane` with non-opaque `JScrollBar`s but it’s very likely that it will not work that way (*in principle*).
type: QuestionComment

http://stackoverflow.com/a/22733359
score: 1
type: AcceptedAnswer
answers question: http://stackoverflow.com/q/22722220
upvote count: 1
accepted answer of: http://stackoverflow.com/q/22722220
type: Answer
downvote count: 0
has body: I don't think HashMap is interoperable; it also isn't a Java xml type known to JAXB (the framework which turns SOAP XML into java instances which is probably why it's not described in the WSDL. You can use the tips in this post to provide an adapter Java class which tells the JAXB runtime how to convert your HashMap into an xml structure. However, I doubt this will be natively consumed by a .Net client as Dictionary. You could try to produce the xml structure described in this article from your Java adapter in the hopes that it will be interpreted as Dictionary.

http://stackoverflow.com/comment/34760594
type: Comment
has text: Did you create your new rich text item and then use: rtiDESC = newDoc.copyItem(rtiOLD,"Description");
comment on: http://stackoverflow.com/a/22766060
type: AnswerComment
score: 0

http://stackoverflow.com/a/22776261
upvote count: 1
downvote count: 0
answers question: http://stackoverflow.com/q/22775676
type: Answer
has body: The simplest approach, as mentioned before, would be simply to save each member in a text file and read them back in with a Scanner object (http://docs.oracle.com/javase/7/docs/api/java/util/Scanner.html). If you are concerned with how to write to a text file, I would suggest reading this article: http://www.mkyong.com/java/how-to-write-to-file-in-java-bufferedwriter-example/ which explains how to use the FileWriter Object. An alternative option would be to have Driver implement the serialisable interface which would allow you store the entire Driver object in a series of bytes, but this is slightly more complicated. A decent tutorial on serialisation can be found here: http://www.tutorialspoint.com/java/java_serialization.htm
score: 1

http://stackoverflow.com/comment/34749046
comment on: http://stackoverflow.com/q/22789293
has text: @JohnnyAW He wants to do exactly what he said he wants to do when he clearly listed his desired output array.
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/q/22684174
has answer: http://stackoverflow.com/a/22684936
tagged with: java
type: Question
has title: How to convert attributes to nodes of an xml in java?
score: 0
has body: I am parsing an XML file like STRUCT Structure where I am getting the child nodes of STRUCTURE and adding it to a nodeList. Can I have an option to add the attributes of STRUCTURE i.e, ID to a nodeList ? How to convert the attributes to a node and add it to a nodelist ? Please help me out. I am using the DOM parsing strategy
answer count: 1
tagged with: http://stackoverflow.com/tag/xml
type: UnansweredQuestion

http://stackoverflow.com/comment/34702765
score: 0
type: Comment
has text: `tokenize` is XPath 2.0, so you need an implementation which supports it such as Saxon 9. See [this question](http://stackoverflow.com/questions/926222/using-saxon-xpath-engine-in-java) about setting up Saxon in Java.
comment on: http://stackoverflow.com/a/22763691
type: AnswerComment

http://stackoverflow.com/q/22726061
type: AnsweredQuestion
tagged with: java
has title: how to get the child node value on attribute stax Java
type: Question
has body: I need guidance in STAX java I have xml file, I need to get the inner element value prior satisfying previous parent node book id attribute value. For example. This First Title This second of first book This First Title of second book This Second of second book I need the values of attribute from "chap" element based on comparing on of the book attribute id. Just hint would guide me.
score: 0
answer count: 1
tagged with: parsing
accepted answer: http://stackoverflow.com/a/22726210
tagged with: stax
has answer: http://stackoverflow.com/a/22726210
tagged with: http://stackoverflow.com/tag/xml

http://stackoverflow.com/comment/34846677
comment on: http://stackoverflow.com/q/22790312
score: 0
type: QuestionComment
has text: Best way to figure out how to do things is try to do it.
type: Comment

gwt
tags question: http://stackoverflow.com/q/22679138
tags question: http://stackoverflow.com/q/22778605
tags question: http://stackoverflow.com/q/22765319
tags question: http://stackoverflow.com/q/22703440
tags question: http://stackoverflow.com/q/22659882
tag name: gwt
tags question: http://stackoverflow.com/q/22772486
tags question: http://stackoverflow.com/q/22748071
tags question: http://stackoverflow.com/q/22711626
tags question: http://stackoverflow.com/q/22665522
tags question: http://stackoverflow.com/q/22768413
tags question: http://stackoverflow.com/q/22762397
tags question: http://stackoverflow.com/q/22703111
tags question: http://stackoverflow.com/q/22717940
tags question: http://stackoverflow.com/q/22695326
type: Tag
tags question: http://stackoverflow.com/q/22711185
tags question: http://stackoverflow.com/q/22788072
tags question: http://stackoverflow.com/q/22796112
tags question: http://stackoverflow.com/q/22771399
tags question: http://stackoverflow.com/q/22778470
tags question: http://stackoverflow.com/q/22791211
tags question: http://stackoverflow.com/q/22743000
tags question: http://stackoverflow.com/q/22679530
tags question: http://stackoverflow.com/q/22708214
tags question: http://stackoverflow.com/q/22714267
tags question: http://stackoverflow.com/q/22659063
tags question: http://stackoverflow.com/q/22759082
tags question: http://stackoverflow.com/q/22680714
tags question: http://stackoverflow.com/q/22807778
tags question: http://stackoverflow.com/q/22771804
tags question: http://stackoverflow.com/q/22722081
tags question: http://stackoverflow.com/q/22777633
tags question: http://stackoverflow.com/q/22670384
tags question: http://stackoverflow.com/q/22707020
tags question: http://stackoverflow.com/q/22803088
tags question: http://stackoverflow.com/q/22672699
tags question: http://stackoverflow.com/q/22691635
tags question: http://stackoverflow.com/q/22761356
tags question: http://stackoverflow.com/q/22650176
tags question: http://stackoverflow.com/q/22789635
tags question: http://stackoverflow.com/q/22776664
tags question: http://stackoverflow.com/q/22685202
tags question: http://stackoverflow.com/q/22701853
tags question: http://stackoverflow.com/q/22740332
tags question: http://stackoverflow.com/q/22776574
tags question: http://stackoverflow.com/q/22790511
tags question: http://stackoverflow.com/q/22688519
tags question: http://stackoverflow.com/q/22685447
tags question: http://stackoverflow.com/q/22681703

http://stackoverflow.com/a/22657026
answers question: http://stackoverflow.com/q/22656684
upvote count: 2
accepted answer of: http://stackoverflow.com/q/22656684
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/34512431
type: Answer
score: 2
downvote count: 0
has body: I think that @GuillermoMerino's solution is probably the best. But if you repeated this pattern a lot in your parsing you could abstract it as a helper method; e.g. public String matchWord(String input, String... words) { for (String word: word) do if (input.contains(word) ) { return word; } } return ""; } and use it like this: String element = matchWord(rawLogText, "RequestType", "ResponseType"); if (element.equals("")) { return; }

http://stackoverflow.com/comment/34754859
comment on: http://stackoverflow.com/q/22792734
has text: I don't know where is the problem, that's why I put these codes here.
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/q/22728932
type: AnsweredQuestion
score: 1
tagged with: java
possible better answer: http://stackoverflow.com/a/22728984
upvote count: 1
has body: NOTE: I am aware that this is dangerously close to many other questions. I haven't seen any, however, that do not pertain specifically to Android's OnClickListener interface. I am asking in a general sense. I understand the difference between instantiating an interface via an anonymous class... a la: private final Runnable runnable = new Runnable() { @Override public void run() { draw(); } }; ... and extending the interface. public class ClassyClass implements Runnable { ... //do other cool stuff here ... @Override public void run() { draw(); } ... //and more here ... } But, other than the obvious benefits from interfaces such as OnClickListener is there a strong advantage to either option? I would think that extending it would be the obvious choice because you are already creating that object - no duplication of effort. Is this right? I am asking in a general sense but, as I am currently working with Runnable, if it has sees an advantage from either option I'd love to know.
type: Question
accepted answer: http://stackoverflow.com/a/22729105
has answer: http://stackoverflow.com/a/22729118
answer count: 3
tagged with: runnable
downvote count: 0
favorite count: 0
tagged with: anonymous-class
tagged with: interface
has answer: http://stackoverflow.com/a/22729105
has title: Extending an Interface vs Instantiating via Anonymous Class
has answer: http://stackoverflow.com/a/22728984

http://stackoverflow.com/a/22797910
answers question: http://stackoverflow.com/q/22797274
type: Answer
has comment: http://stackoverflow.com/comment/66081620
upvote count: 2
score: 2
has body: Ok, it turns out I cannot call getActivity() directly from FREContext. I had to set it via my FREFunction: public class MyFunction implements FREFunction { @Override public FREObject call(FREContext context, FREObject[] passedArgs) { MyExtensionContext mec = (MyExtensionContext) context; // Set a local variable in MyExtensionContext to getActivity value mec.act = mec.getActivity(); mec.doThreadWork(); return null; } } And my FREContext now looks like this: public class MyExtensionContext extends FREContext { public Activity act; public void doThreadWork() { new Thread(new Runnable() { @Override public void run() { // Do stuff with Activity "act" here } } } } I'm not entirely sure why this works since it seems like an extra step that's getting the same getActivity() value, but it could be that this Activity is created at a different time than in FREContext.
type: AcceptedAnswer
downvote count: 0
accepted answer of: http://stackoverflow.com/q/22797274

http://stackoverflow.com/q/22704556
score: 2
downvote count: 0
favorite count: 0
linked to: http://stackoverflow.com/q/3031796
type: Question
has title: Bluetooth Connectivity Issues in Post ICS Versions
tagged with: android-bluetooth
linked to: http://stackoverflow.com/q/18657427
tagged with: sockets
tagged with: android
linked to: http://stackoverflow.com/q/21348789
has answer: http://stackoverflow.com/a/22910227
has body: I am able to connect to an external paired bluetooth hardware first time. After that if i repeat connect/disconect procedures sometimes getting exception. Exception = read failed, socket might closed or timeout, read ret: -1 and after many trials able to connect again.Sometimes second trial itself is successful The issue is observed with Devices:Nexux7(version 4.3) and MotoG(Kitkat) Code for connection: private static final UUID MY_UUID = UUID.fromString("00001101-0000-1000-8000-00805F9B34FB"); device = BluetoothAdapter.getDefaultAdapter().getRemoteDevice(devAddress); socket = device.createRfcommSocketToServiceRecord(MY_UUID); and calling socket.connect() from asynctask Code for closing socket:Subject if (in != null) { Logger.loge(CLASS_NAME + "." + "resetConnection", "in != null"); try { in.close(); } catch (Exception e) { // Log.d(TAG,"exception in closing inputstream - " + e.getMessage()); } in = null; } if (out != null) { Logger.loge(CLASS_NAME + "." + "resetConnection", "out != null"); try { out.close(); } catch (Exception e) { // Log.d(TAG,"exception in closing outputstream - " + e.getMessage()); } out = null; } if (socket != null) { Logger.loge(CLASS_NAME + "." + "resetConnection", "socket != null"); try { socket.close(); } catch (Exception e) { //Log.d(TAG,"exception in closing socket - " + e.getMessage()); } socket = null; } I have followed the links https://groups.google.com/forum/#!topic/android-developers/UxY5xME6V5s Android Bluetooth: java.io.IOException: Service discovery failed Disconnect a bluetooth socket in Android android bluetooth can&#39;t connect None of the solution provided help me to solve the issue. Any help will be appreciated... Thanks
linked to: http://stackoverflow.com/q/17763779
upvote count: 2
tagged with: java
answer count: 2
type: UnansweredQuestion
tagged with: bluetooth
has answer: http://stackoverflow.com/a/22911296

http://stackoverflow.com/comment/34540727
type: Comment
type: QuestionComment
has text: The "next" and "previous" variables in Element are private. In Lista(Lista lista1, Lista lista2) you try to access them directly , which is not allowed. Use the setNext, getNext, setPrevious, and getPrevious methods that you wrote in the Element class.
comment on: http://stackoverflow.com/q/22673150
score: 0

http://stackoverflow.com/a/22673619
accepted answer of: http://stackoverflow.com/q/22673236
answers question: http://stackoverflow.com/q/22673236
type: AcceptedAnswer
has body: You probably want this: package test; public class CircleExercise { public static void main(String[] args) { // you must increment the variable in 2 units for(int i = 0 ; i &lt; 3 ; i+=2) { Circle kreis = new Circle(); // and select different indexes: i and i+1 double radius = Double.parseDouble(args[i]); boolean filled = Boolean.parseBoolean(args[i+1]); System.out.println(i + ". Kreis:\nRadius: " + radius + "\nUmfang: " + kreis.getCircumference(radius) + "\nFlaeche: " + kreis.getArea(radius)); if (filled == true){ System.out.println(i + ". Kreis ist gefuellt."); } else System.out.println(i + ". Kreis ist nicht gefuellt.\n"); } } }
score: 0
type: Answer

http://stackoverflow.com/comment/34596680
type: Comment
type: QuestionComment
has text: Are you looking for "forgot password" like thing?
comment on: http://stackoverflow.com/q/22704423
score: 0

http://stackoverflow.com/a/34321248
has comment: http://stackoverflow.com/comment/70721994
type: Answer
answers question: http://stackoverflow.com/q/22764310
has body: import com.google.common.base.CaseFormat; protected static String replaceDashesWithCamelCasing(String input){ return CaseFormat.LOWER_HYPHEN.to(CaseFormat.UPPER_CAMEL, input); }
has comment: http://stackoverflow.com/comment/70722239
score: 0

http://stackoverflow.com/q/22677526
score: 0
tagged with: while-loop
answer count: 1
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/34547133
has comment: http://stackoverflow.com/comment/34557589
has body: I am trying to ask the user to input yes or no if it is yes then it will restart and the characteristics will be added since they make 2 selections. However, it doesn't let me ask Y/N and I've obviously screwed up somewhere. If possible how would I be able to minimize code as well instead of using that eyesore poorly optimized if statement. public static void main(String[]args) { //Number 1 Scanner scan = new Scanner(System.in); int num = 0; int num2 = 0; int num3 = 0; int count = 2; String yesno; do { System.out.println("Which aircraft would you like to simulate?"); System.out.println("1. Blimp"); System.out.println("2. Helicopter"); System.out.println("3. Fighter Jet"); System.out.println("4. Space Shuttle"); num = scan.nextInt(); if(num&lt;1 || num&gt;4) {System.out.println("Invalid");} } while(num&lt;1 || num&gt;4); do { System.out.println("What characteristics would you like? (Input one, then the other)"); System.out.println("1. Position Trim "); System.out.println("2. Force Breakout"); System.out.println("3. Force Gradient"); System.out.println("4. Force Friction"); System.out.println("5. Damping"); System.out.println("6. Hard Stop"); num2 = scan.nextInt(); num3 = scan.nextInt(); if(num2 == 1 || num3 == 1) { System.out.println("The position to which a flight control returns"); } if(num2 == 2 ||num3 == 2) { System.out.println("A force that returns a control to Trim. This is a constant force applied toward Trim which remains the same despite how far the control is moved (displacement) and how fast a control is moved (velocity)."); } if(num2 == 3 || num3 == 3) { System.out.println("A force that returns a control to Trim, but one that varies with displacement. The farther the control is moved, the stronger the force applied toward trim."); } if (num2 == 4 || num3 == 4) { System.out.println("A constant force that is opposite to the direction of movement"); } if(num2 == 5 || num3 == 5) { System.out.println("A force that is oppisite to the direction of movement. Damp…
tagged with: java
has comment: http://stackoverflow.com/comment/34547336
tagged with: loops
type: Question
has answer: http://stackoverflow.com/a/22679769
has title: Please help, having issues asking something within the while loop

http://stackoverflow.com/comment/34500031
comment on: http://stackoverflow.com/q/22650669
has text: @TBM - The file extension is irrelevant when using the Properties API.
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/q/22692822
accepted answer: http://stackoverflow.com/a/22692981
answer count: 1
downvote count: 0
has comment: http://stackoverflow.com/comment/34574158
has body: I have a string "thisisanexample". I want to split this into for example 4 char arrays like this: group[0]="this" group[1]="isan" group[2]="exam" group[3]="ple" How can I do this? Edit: String str = "thisisanexample"; String[] arr = str.split("(?&lt;=\\G.{4})"); c.drawText(arr[0], 100, 100, textPaint); c.drawText(arr[1], 100, 200, textPaint); c.drawText(arr[2], 100, 300, textPaint);
has title: Split string into string arrays of X characters
has comment: http://stackoverflow.com/comment/34574281
tagged with: string
favorite count: 0
tagged with: android
upvote count: 1
has answer: http://stackoverflow.com/a/22692981
type: AnsweredQuestion
score: 1
has comment: http://stackoverflow.com/comment/34574250
tagged with: java
type: Question

http://stackoverflow.com/comment/34773916
comment on: http://stackoverflow.com/q/22793454
score: 0
has text: 1) For better help sooner, post an [MCVE](http://stackoverflow.com/help/mcve) (Minimal Complete and Verifiable Example). 2) Use a consistent and logical indent for code blocks. The indentation of the code is intended to help people understand the program flow. 3) 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.
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/34547681
comment on: http://stackoverflow.com/a/22677630
score: 0
type: Comment
has text: @JatinKhurana Khurana true. i overlooked that.
type: AnswerComment

http://stackoverflow.com/a/22716966
downvote count: 0
type: Answer
score: 2
upvote count: 2
has body: The message of the root exception is telling you the problem: Caused by: java.io.EOFException: Can not read response from server. Expected to read 4 bytes, read 0 bytes before connection was unexpectedly lost. The network connection between your server and the database server is unstable. So this is not a problem of your software.
has comment: http://stackoverflow.com/comment/34618358
answers question: http://stackoverflow.com/q/22716862

http://stackoverflow.com/q/22656688
has title: Compile java with C#
has answer: http://stackoverflow.com/a/23402707
score: 1
tagged with: java
type: Question
tagged with: c#
tagged with: compilation
has body: I would like to compile a Java program through C#. Does anyone know why I cannot take the output of the program, while I can take the errors? How can I print the results from .java? Process p = new Process(); p.StartInfo.FileName = "C:\\Program Files\\Java\\jdk1.7.0_04\\bin\\javac"; p.StartInfo.UseShellExecute = false; p.StartInfo.Arguments = "c:\\java\\upgrade.java"; p.StartInfo.RedirectStandardInput = true; p.StartInfo.RedirectStandardError = true; p.StartInfo.CreateNoWindow = true; p.StartInfo.RedirectStandardOutput = true; p.Start(); p.WaitForExit(); resultcode.Text = p.StandardOutput.ReadToEnd();
upvote count: 2
has comment: http://stackoverflow.com/comment/34513089
answer count: 1
downvote count: 1
favorite count: 0
type: UnansweredQuestion

http://stackoverflow.com/q/22751109
has comment: http://stackoverflow.com/comment/34679652
type: Question
score: -2
has answer: http://stackoverflow.com/a/22751157
has comment: http://stackoverflow.com/comment/34679627
downvote count: 2
answer count: 1
tagged with: if-statement
tagged with: java
tagged with: methods
has body: I'm writing a program that, for sake of ease, I would like to call a function from within an if/if else. I keep getting the message "non-static method select1() cannot be referenced from a static context". Sample of code: If else, leading to method: option = input.nextInt(); if (option == 1){select1();} if (option == 2) {System.out.println("boo");} if (option == 3) {System.out.println("hehe");} else {System.out.println("blahh");} } } static void main select1();{ System.out.println("");}; I'm relatively new at programming, so any help would be great!
has title: Trying to call a method within an if else.. Where am I going wrong?
has comment: http://stackoverflow.com/comment/34679614
tagged with: function
upvote count: 0
has comment: http://stackoverflow.com/comment/34679646
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/34679628
favorite count: 0

http://stackoverflow.com/a/22762245
upvote count: 5
accepted answer of: http://stackoverflow.com/q/22761909
type: AcceptedAnswer
downvote count: 0
has body: Typically, in http based client-server scheme, server always responds to a request. There is no way server can send anything (notification) without client request it. But there are use cases for server pushing the data to client without client requesting and hence Server-Push came into picture. Jersey provides Server Push in the form of Server-Sent Events (SSE). The documentation says, Server-Sent Events (SSE) is a mechanism that allows server to asynchronously push the data from the server to the client once the client-server connection is established by the client Please note that the client needs to establish connection with the server first. You might call that first client request as Registration. Once the connection is established, the server can send/push data to client. The linked mention also has a working example as well.
type: Answer
answers question: http://stackoverflow.com/q/22761909
score: 5

http://stackoverflow.com/q/22805176
type: Question
tagged with: java-7
tagged with: threadpool
has comment: http://stackoverflow.com/comment/34781361
has title: newCachedThreadPool with ThreadFactory
has comment: http://stackoverflow.com/comment/34779263
has answer: http://stackoverflow.com/a/22808816
accepted answer: http://stackoverflow.com/a/22808816
score: 0
has comment: http://stackoverflow.com/comment/34779044
answer count: 1
tagged with: multithreading
linked to: http://stackoverflow.com/q/18305953
type: AnsweredQuestion
has body: I am implement a thread pool for my application and I want to use newCachedThreadPool along with ThreadFactory, and I wonder what I wrote below is correct. 1.The idea of using newCachedThreadPool is that thread can be reusable, and that idle thread will be terminated appropriately like the jdk7 doc provided. However, when I wrote the code, I have some doubt since in newThread(Runnable r), I return new instance of MyThread, and I also does MyThread myThread = new MyThread(); in main. So please if an experienced developers can point out whether what I did below are correct or not, I would greatly appreciated. Thank you import java.util.concurrent.ExecutorService; import java.util.concurrent.Executors; import java.util.concurrent.ThreadFactory; public class ThreadFactoryTest{ public static void main(String[] args) { ExecutorService cachedPool = Executors.newCachedThreadPool(new MyThreadFactory()); MyThread myThread = new MyThread(); cachedPool.submit(myThread); } } class MyThreadFactory implements ThreadFactory{ @Override public Thread newThread(Runnable r) { return new MyThread(r); } } class MyThread extends Thread { public MyThread(Runnable r){ super(r); } public MyThread(){ super(); } @Override public void run() { Thread t = Thread.currentThread(); if(t instanceof MyThread){ System.out.println("Thread is MyThread"); } System.out.println("Inside: " + this.getName()); Utils.awesome(); } } class Utils{ public static void awesome(){ Thread t = Thread.currentThread(); if(t instanceof MyThread){ System.out.println("Inside awesome() and Thread is MyThread. Provide special awesomeness for MyThread."); } } } When I run the above program it produces Thread is MyThread Inside: Thread-1 Inside awesome() and Thread is MyThread. Provide special awesomeness for MyThread. which are the correct outputs, what I am asking is whether I am setting up correctly.
has comment: http://stackoverflow.com/comment/34777108
tagged with: java
has comment: http://stackoverflow.com/comment/34777373
has comment: http://stackoverflow.com/comment/34779293

http://stackoverflow.com/a/22735469
score: 0
has body: in your declaration change it to public class ICPaymentFragment then hover over ICPaymentFragment and click rename compilation unit.... make sure you update the class name in your constructor you can change it to whatever you want
type: Answer
answers question: http://stackoverflow.com/q/22735430

http://stackoverflow.com/q/22752911
score: 0
has title: Getting NetBeans to accept MiniJava
answer count: 1
tagged with: netbeans-7
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/22753114
tagged with: java
type: Question
has body: I have some pre-made MiniJava code that I'd like to use in NetBeans, but I don't think such packages exist in NetBeans to let me use it. How can I get it to work in NetBeans, as this is something I HAVE to use for my project?

http://stackoverflow.com/q/22673211
has comment: http://stackoverflow.com/comment/34539737
has comment: http://stackoverflow.com/comment/34539668
has comment: http://stackoverflow.com/comment/34539812
has comment: http://stackoverflow.com/comment/34539805
tagged with: java
has comment: http://stackoverflow.com/comment/34539700
has title: Java List containsAll returning false?
downvote count: 2
has comment: http://stackoverflow.com/comment/34539602
has answer: http://stackoverflow.com/a/22673410
has body: This is returning false....im expecting true List&lt;String&gt; listA // [941, 946, 940, 942] List&lt;String&gt; listB //[941, 942, 940, 946,888, 466, 777] listB.containsAll(listA) //FALSE ??
type: Question
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/34539455
has comment: http://stackoverflow.com/comment/34539509
score: -2
has comment: http://stackoverflow.com/comment/34539777
has comment: http://stackoverflow.com/comment/34539484
has comment: http://stackoverflow.com/comment/34539549
has comment: http://stackoverflow.com/comment/34539507
upvote count: 0
accepted answer: http://stackoverflow.com/a/22673410
answer count: 1
has comment: http://stackoverflow.com/comment/34539514
favorite count: 0

http://stackoverflow.com/a/22714200
has body: You need to specify the lucene query as a whole. @Query("START n=node:WRInteraction({0}) WHERE n.pubMillis &gt;= {1} AND n.pubMillis &lt;= {2} RETURN n") Iterable&lt;WRInteraction&gt; getInteractionsByTermAndDateRange(String query, long startMillis, long endMillis); Call this method like: repository.getInteractionsByTermAndDateRange("content:*" + term + "*", 0, 0);
type: Answer
accepted answer of: http://stackoverflow.com/q/22713653
upvote count: 1
score: 1
answers question: http://stackoverflow.com/q/22713653
type: AcceptedAnswer
downvote count: 0

http://stackoverflow.com/q/22805368
favorite count: 0
possible better answer: http://stackoverflow.com/a/55599539
has answer: http://stackoverflow.com/a/55599539
tagged with: android
has comment: http://stackoverflow.com/comment/87022338
has title: Firebase android proxy setting
upvote count: 13
tagged with: firebase
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/25369063
tagged with: java
score: 13
type: Question
has comment: http://stackoverflow.com/comment/35070430
has body: I have made an android app https://play.google.com/store/apps/details?id=com.confesco.maggi which works with firebase as database which works well when I use 3G net.The problem occurs when I use it under a proxy of our college it doesnot get connected to the database.Is there any way I can get around with this problem.Thanks in advance.
tagged with: proxy
answer count: 2
has answer: http://stackoverflow.com/a/25369063
downvote count: 0

http://stackoverflow.com/a/22661790
type: AcceptedAnswer
answers question: http://stackoverflow.com/q/22661334
type: Answer
accepted answer of: http://stackoverflow.com/q/22661334
has comment: http://stackoverflow.com/comment/34519784
has body: You could make a javascript function which loads a PHP-Page in intervals. Something like this: create 3 files: file.js, onlinecheck.php and log.txt file.js: function tellTheServerThatIAmStillHere() { $.post('onlinecheck.php', {onlineStatus: iAmStillHere}); /* Sends a post to the file onlinecheck.php with the parameter "onlineStatus: iAmStillHere" */ timer = window.setTimeout(tellTheServerThatIAmStillHere,8000); /* sends a new post every 8 seconds */ } onlinecheck.php: &lt;?php if(isset($_POST["onlineStatus"])) { if($_POST["onlineStatus"] == "iAmStillHere") { $fd = fopen("log.txt", "w"); fwrite($fd, date("[d.m.Y - H:i:s] ").$_SERVER['REMOTE_ADDR'].": He is still here"); //Puts out something like "[26.03.2014 - 13:57:33] 127.0.0.1: He is still here" fclose($fd); } } Now you could check in the logfile if the browser is still online, if that's what you meant.
has comment: http://stackoverflow.com/comment/34519895
score: 0

http://stackoverflow.com/q/22723440
has body: I would like to hear what all relationships exists here. I assume that here exists relationships like dependency and aggregation with 1-1 multiplicity? public class Main { public Main() { Model model = new Model(); View view = new View(); Controller controller = new Controller(view, model); } public static void main(String[] args) { new Main(); } } public class Controller { private Model model; private View view; public Controller(Model model, View view) { this.model = model; this.view = view; } } public class Model { ... } public class View { ... }
favorite count: 0
has comment: http://stackoverflow.com/comment/34632576
has answer: http://stackoverflow.com/a/22751331
linked to: http://stackoverflow.com/q/20138948
tagged with: relationships
has title: uml relationships in this java code
type: AnsweredQuestion
upvote count: 2
score: 1
tagged with: java
tagged with: uml
downvote count: 1
type: Question
accepted answer: http://stackoverflow.com/a/22751331
answer count: 1

http://stackoverflow.com/a/22666654
score: 2
downvote count: 0
accepted answer of: http://stackoverflow.com/q/22665919
answers question: http://stackoverflow.com/q/22665919
has comment: http://stackoverflow.com/comment/34529157
upvote count: 2
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/34529117
has body: Hypothesis: your Student class does not implement .equals()/.hashCode(). By default, when() you mock a method call, mockito will check whether its argument(s) .equals() the one(s) you have passed it as (an) argument(s) to the mocked method. However, if you don't implement .equals(), then you will have the case that: final Student s1 = new Student("foo", "bar"); final Student s2 = new Student("foo", "bar"); s1.equals(s2); // &lt;--- FALSE! And this is what happens here. In your first scenario, you create a Student which appears, to you, logically equal but that is not what Mockito wants. Therefore, in your first scenario, .get() will return null. In your second however, you pass the same reference; since you don't implement .equals(), Object's .equals() takes place, and for this .equals() implementation, obj1.equals(obj2) if and only if obj1 == obj2 -- which is the case. Continuing the code above, in your case: s1 == s2; // FALSE! (as in first test) s1 == s1; // true (as in second test) If you wanted to be more "loose" to arguments, you'd have to write custom argument matchers; Mockito can also do that (with the help of its hamcrest dependency). All this banter to say that you should solve your problem by making your Student class implement .equals()/.hashCode().
type: Answer

http://stackoverflow.com/a/22797449
has comment: http://stackoverflow.com/comment/34763134
downvote count: 0
answers question: http://stackoverflow.com/q/22797406
has body: You can't use == on strings. You should use: "SplashScreen".equals(test) Test might be null, it is better to call equals() on "SplashScreen" since you know that it is no null.
type: Answer
score: 2
upvote count: 2
has comment: http://stackoverflow.com/comment/34763222

http://stackoverflow.com/comment/58765773
type: Comment
has text: You should provide a simple code example to support your answer.
comment on: http://stackoverflow.com/a/35538313
type: AnswerComment
score: 0

http://stackoverflow.com/comment/34597112
has text: You did enable injection into non managed beans (e.g. with `@EnableSpringConfigured`)?
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/22705095
score: 1

http://stackoverflow.com/comment/34799675
type: AnswerComment
type: Comment
has text: Although I'm considering the proposed XMLStreamWriter way as a workaround only, it seems to be the only compatible way to solve my problem - thanks.
comment on: http://stackoverflow.com/a/22817635
score: 0

http://stackoverflow.com/q/22788894
has title: how do I handle this messy variable shadowing?
possible better answer: http://stackoverflow.com/a/22789008
accepted answer: http://stackoverflow.com/a/22789310
favorite count: 0
has comment: http://stackoverflow.com/comment/34748476
upvote count: 1
type: AnsweredQuestion
tagged with: oop
has answer: http://stackoverflow.com/a/22789310
score: 1
tagged with: java
has body: I have a SharedFolder class that implements an abstract Endpoint class, the problem is related to one of the attributes of the subclass (baseDir) that depends on the value of another attribute (environment) that gets updated after the instantiation of the class, here's what I'm talking about: public class SharedFolderEndpoint extends Endpoint { private String name = "SharedFolder"; private String hostname = "somehostname"; private Environment environment; private String baseDir; private String format = "someformat" private String pattern = "somepattern"; public SharedFolderEndpoint() { } ... The basedir path depends on the value of the environment, the variable needs to be initialized with something like this: this.baseDir= "/env-"+this.environment+"/somefolder/files"; The class is instantiated by the GUI and then the user has to pick the environment he/she wants to interact with, so, as you can see, prior to this manual interaction this.environment references a null value. I wonder if there would be an elegant solution to update this value without creating a new method to append the value to the path. Any ideas?
type: Question
answer count: 2
has answer: http://stackoverflow.com/a/22789008
downvote count: 0

http://stackoverflow.com/a/22711175
type: Answer
has body: I am just summarizing the Jersey 2.x docs sent by Bhesh in comment: Servlet 2.x Container (Java EE 5, Glassfish 2.x), you need to hook Jersey as a Servlet. MyApplication org.glassfish.jersey.servlet.ServletContainer ... ... MyApplication /myApp/* or a Servlet Filter: MyApplication org.glassfish.jersey.servlet.ServletContainer ... ... MyApplication /myApp/* Servlet 3.x Container Descriptorless case (Java EE 6, 7; Glassfish 3, 4)There is no need for web.xml configuration for the simplest case. Instead an custom ResourceConfig class is needed with @ApplicationPath annotation for configuration: @ApplicationPath("resources") public class MyApplication extends ResourceConfig { public MyApplication() { packages("org.foo.rest;org.bar.rest"); } } Configuring with web.xml javax.ws.rs.core.Application javax.ws.rs.core.Application /myresources/* In this case all the root resource classes (the classes annotated with @Path annotation) as well as any providers that are annotated with @Provider annotation packaged with the application will be automatically registered in the JAX-RS application.
score: 8
upvote count: 8
accepted answer of: http://stackoverflow.com/q/22691971
answers question: http://stackoverflow.com/q/22691971
type: AcceptedAnswer
downvote count: 0

http://stackoverflow.com/a/22725292
answers question: http://stackoverflow.com/q/22725264
has body: You are potentially calling next twice each loop. Just store it once and use it later more than once, so you don't advance two tokens when you meant to advance only one token. String next = src.next(); if(next.equals(".")) { System.out.println("0"); } else { System.out.println(next); }
score: 0
type: Answer

http://stackoverflow.com/comment/34584747
comment on: http://stackoverflow.com/a/22698383
score: 0
type: Comment
has text: See also: http://stackoverflow.com/questions/1066318/how-to-read-a-single-char-from-the-console-in-java-as-the-user-types-it?lq=1
type: AnswerComment

http://stackoverflow.com/a/22765449
type: Answer
has comment: http://stackoverflow.com/comment/34706083
has comment: http://stackoverflow.com/comment/34706473
has comment: http://stackoverflow.com/comment/34705871
has comment: http://stackoverflow.com/comment/34705630
has body: You need to replace the spaces with the code "%20". URL encoding replaces a space with this code. To read data I usually use the BufferedReader but like this: URL url = new URL("URL"); HttpURLConnection conn = (HttpURLConnection)url.openConnection(); BufferedReader rd = new BufferedReader(new InputStreamReader(conn.getInputStream())); String s, response = ""; while ((s = rd.readLine()) != null) { response += s; }
answers question: http://stackoverflow.com/q/22765373
downvote count: 0
score: 1
has comment: http://stackoverflow.com/comment/34705698
has comment: http://stackoverflow.com/comment/34705756
upvote count: 1

http://stackoverflow.com/a/22769835
has body: You could change the return type for an object of the class HigherSame, this way you have both your booleans.
upvote count: 5
type: Answer
answers question: http://stackoverflow.com/q/22769724
downvote count: 0
score: 5

http://stackoverflow.com/comment/34552772
score: 2
type: AnswerComment
comment on: http://stackoverflow.com/a/22680836
has text: A getter might be useful, but it's not necessary at all to implement equals()
type: Comment

http://stackoverflow.com/q/22776511
has answer: http://stackoverflow.com/a/22778898
accepted answer: http://stackoverflow.com/a/22778898
has comment: http://stackoverflow.com/comment/34725424
tagged with: lambda
tagged with: java-8
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/34725439
downvote count: 0
has title: Java 8 lambda expression identity contract
has comment: http://stackoverflow.com/comment/34725465
score: 7
tagged with: java
type: Question
has comment: http://stackoverflow.com/comment/34749309
possible better answer: http://stackoverflow.com/a/22811408
has answer: http://stackoverflow.com/a/22811408
has comment: http://stackoverflow.com/comment/34725908
answer count: 2
has body: The JavaDoc for the LambdaMetaFactory of Java 1.8 specifies that lambda capture "may involve allocation of a new function object, or may return an existing function object", but it doesn't specify when and under what circumstances it might choose one way or the other. Looking at the actual implementation of the LambdaMetaFactory, on the other hand, it is clear that it happens if and only if the lambda expression captures no parameters. What I'm wondering is, is this behavior actually specified somewhere (outside of the JavaDoc) and can be relied upon? It would be nice to know whether I can rely on a lambda expression's identity being constant or not.
upvote count: 7
has comment: http://stackoverflow.com/comment/34748219
has comment: http://stackoverflow.com/comment/34725401
has comment: http://stackoverflow.com/comment/34749425
favorite count: 0
has comment: http://stackoverflow.com/comment/34738262

http://stackoverflow.com/a/22737960
upvote count: 2
answers question: http://stackoverflow.com/q/22737853
has body: I would guess that the XML you presented (without saying which file it really is, and despite that the XML text is not even valid) is the layout of the PlaceholderFragment you add at the beginning. However, the fragment is not immediately added, just scheduled to be added by the FragmentManager. Therefore when you are immediately trying to find its UI components, the activity fails to do so, and the add reference is set to null by findViewById.
accepted answer of: http://stackoverflow.com/q/22737853
type: AcceptedAnswer
downvote count: 0
type: Answer
score: 2

http://stackoverflow.com/a/22747281
has comment: http://stackoverflow.com/comment/34673116
has body: Probably you have the source code but it's not an eclipse project. Try to see How to create a project from existing source in Eclipse and then find it?
has comment: http://stackoverflow.com/comment/34672491
type: Answer
answers question: http://stackoverflow.com/q/22747231
score: 3
upvote count: 3
has comment: http://stackoverflow.com/comment/34672519
has comment: http://stackoverflow.com/comment/34673228
downvote count: 0

http://stackoverflow.com/q/22758774
has answer: http://stackoverflow.com/a/22768852
favorite count: 0
possible better answer: http://stackoverflow.com/a/22760612
tagged with: curve-fitting
has answer: http://stackoverflow.com/a/22760612
type: AnsweredQuestion
score: 1
has comment: http://stackoverflow.com/comment/34695754
tagged with: java
accepted answer: http://stackoverflow.com/a/22768852
has comment: http://stackoverflow.com/comment/34696067
upvote count: 1
has body: I have a data set of a single measurement vs. time (about 3000 points). I'd like to smooth the data by fitting a curve through it. The experiment is a multi-stage physical process so I am pretty sure a single polynomial won't fit the whole set. Therefore I'm looking at a piecewise series of polynomials. I'd like to specify how many polynomials are used. This seems to me to a fairly straightforward thing and I was hoping that there would be some pre-built library to do it. I've seen org.apache.commons.math3.fitting.PolynomialFitter in Apache Commons Math but it seems to only work with a single polynomial. Can anyone suggest the best way to do this? Java preferred but I could work in Python.
type: Question
has comment: http://stackoverflow.com/comment/34695707
has comment: http://stackoverflow.com/comment/34693368
answer count: 2
has title: Smoothing experimental data with piecewise functions
downvote count: 0

http://stackoverflow.com/q/22795237
has comment: http://stackoverflow.com/comment/34758976
has body: I'm trying to use the following regular expression to find all e-mails in an html string: RegExp [A-Z0-9._%+-]+@[A-Z0-9.-]+\\.[A-Z]{2,4} HTML ddawson@gcitravel.net. I'm using matcher.find() which is supposed to find substrings is it not? When I perform the search it is coming up empty, any ideas why?
has comment: http://stackoverflow.com/comment/34872789
tagged with: regex
has answer: http://stackoverflow.com/a/22795364
answer count: 3
has title: Why does this Regular Expression not match anything?
upvote count: 1
has comment: http://stackoverflow.com/comment/34759325
tagged with: java
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/22795325
has answer: http://stackoverflow.com/a/22795429
has comment: http://stackoverflow.com/comment/34759323
downvote count: 0
score: 1
favorite count: 0
type: Question

http://stackoverflow.com/comment/34767730
comment on: http://stackoverflow.com/a/22799838
score: 0
type: AnswerComment
type: Comment
has text: @aliteralmind or it could be to have the loop terminate at source.size()-1

http://stackoverflow.com/comment/34714353
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/22722399
score: 0
has text: Ok, questions: 1) Are the JSP files in WEBINF/jsps as noted in the config? 2) How are you returning the view name from the controller? Are you sending back just the name, as in "myView" or are you sending back the entire view "myView.jsp"? 3) Do you have the jstl.jar and standard.jar in your WEBINF/lib folder? 4) Are there any errors or warnings in the logs when you start? 5) What version of Spring and which app server are you using?

http://stackoverflow.com/q/22794276
favorite count: 0
has comment: http://stackoverflow.com/comment/34757810
has body: I am using I.E. 11 and have just reinstalled Java 7.51 My security settings for the browser are the lowest default possible and under the Java in the Control Panel I have set the security to medium (the lowest) as well. When I try to run any Java apps I get this (ironically trying to run Java uninstall) How do I get to the point where the app will run after a prompt?
has comment: http://stackoverflow.com/comment/34757448
type: Question
upvote count: 2
has comment: http://stackoverflow.com/comment/34757640
has comment: http://stackoverflow.com/comment/34757677
tagged with: java
answer count: 0
type: UnansweredQuestion
has title: Java is blocking signed certificates
tagged with: security
score: 2
downvote count: 0
has comment: http://stackoverflow.com/comment/34769045

http://stackoverflow.com/a/22746331
score: 2
downvote count: 0
upvote count: 2
has body: if( button[i].setEnabled(false)) { JOptionPane.showMessageDialog(null," Button is disables "); break; } setEnabled() returns void that's why it gives you error, maybe you mean .isEnabled()? if(!button[i].isEnabled()) { JOptionPane.showMessageDialog(null," Button is disables "); break; } isEnabled() returns true if the button is enabled, false if disabled.
answers question: http://stackoverflow.com/q/22746280
has comment: http://stackoverflow.com/comment/34670815
type: Answer
has comment: http://stackoverflow.com/comment/34670994

slidingmenu
tag name: slidingmenu
tags question: http://stackoverflow.com/q/22674204
type: Tag

http://stackoverflow.com/comment/34683747
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/22753279
has text: Whenever I input 2 into the console, the program terminates without any errors.
type: Comment

http://stackoverflow.com/a/22703089
downvote count: 0
score: 1
answers question: http://stackoverflow.com/q/22703008
type: Answer
upvote count: 1
has body: When you want descending order, as you already do: int result= a[ i ].getTitle().compareTo(a[ j ].getTitle()); int result2= a[ j ].getTitle().compareTo(a[ i ].getTitle()); Ascending is the opposite of descending, so just negativize the comparisons: int result= a[ i ].getTitle().compareTo(a[ j ].getTitle()) * -1; int result2= a[ j ].getTitle().compareTo(a[ i ].getTitle()) * -1; To optionally do it, you could pass in a boolean: int result= a[ i ].getTitle().compareTo(a[ j ].getTitle()) * (isAscending ? -1 : 1); int result2= a[ j ].getTitle().compareTo(a[ i ].getTitle()) * (isAscending ? -1 : 1); (You say your sorting works well descending, and this answer assumes that's true. I've not verified it.)
accepted answer of: http://stackoverflow.com/q/22703008
type: AcceptedAnswer

http://stackoverflow.com/a/22688400
score: 2
downvote count: 2
answers question: http://stackoverflow.com/q/22687771
has body: Your response should be something like this to be qualified as Json Array. { "songs":[ {"2562862600": {"id":"2562862600", "pos":1}}, {"2562862620": {"id":"2562862620", "pos":1}}, {"2562862604": {"id":"2562862604", "pos":1}}, {"2573433638": {"id":"2573433638", "pos":1}} ] } You can parse your response as follows String resp = ...//String output from your source JSONObject ob = new JSONObject(resp); JSONArray arr = ob.getJSONArray("songs"); for(int i=0; i&lt;arr.length(); i++){ JSONObject o = arr.getJSONObject(i); System.out.println(o); }
upvote count: 4
type: Answer

http://stackoverflow.com/q/22683464
type: AnsweredQuestion
has title: How to instantiate subclasses of an abstract class?
tagged with: java
score: -1
type: Question
favorite count: 0
tagged with: abstract-class
has answer: http://stackoverflow.com/a/22683578
answer count: 3
accepted answer: http://stackoverflow.com/a/22683578
tagged with: subclass
has answer: http://stackoverflow.com/a/22683636
downvote count: 1
has comment: http://stackoverflow.com/comment/34557178
upvote count: 0
possible better answer: http://stackoverflow.com/a/22683636
has answer: http://stackoverflow.com/a/22683536
has body: I am stumped at the end of my program. I am making a bank account java program and am having issues integrating an abstract class and a subclass together. public abstract class Account { public static void main(String args[]) { CheckingAccount Account1 = new CheckingAccount(); } public Account() { // } public class CheckingAccount extends Account { // } } I have tried the CheckingAccount class outside and taking away the public from the class however, then I get the error message that it cannot find the main for the Account class. The same error comes up as stated above if I add static to the CheckingAccount class.

http://stackoverflow.com/comment/34657226
type: AnswerComment
comment on: http://stackoverflow.com/a/22737993
score: 1
type: Comment
has text: Yeah I'll post a picture on my answer. It's for a game I'm creating, because to learn how to use Java GUI better, which I've never been to good at.

http://stackoverflow.com/comment/34711649
has text: Thank you. When I try doing as suggested, I get an error because I'm trying to work with non-static values (EditText) within the static Fragment class. What would be the risk of making the Fragment class non-static? Regarding option B, is there any reason not to do this? I can only guess that the autogenerated Eclipse code is according to some kind of _standard_. I'm hesitant to deviate. I just want to make sure I'm doing things right and learning as I go. Thanks again for the reply.
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/22768541
type: Comment

http://stackoverflow.com/q/22648953
has answer: http://stackoverflow.com/a/22649207
type: Question
upvote count: 0
score: -1
answer count: 1
has body: Program is running now. It runs but then crashes. In my files folder it creates an encrypted file but it is blank. It also does not produce a decrypted file at all. I also changed the bit size to 128. What else I am missing in order to properly implement AES? This is the modified program import javax.crypto.KeyGenerator; import javax.crypto.SecretKey; import javax.crypto.Cipher; import java.security.NoSuchAlgorithmException; import java.security.InvalidKeyException; import java.security.InvalidAlgorithmParameterException; import javax.crypto.NoSuchPaddingException; import javax.crypto.BadPaddingException; import javax.crypto.IllegalBlockSizeException; import java.io.BufferedReader; import java.io.FileInputStream; import java.io.FileOutputStream; import java.io.FileReader; import java.io.IOException; import java.io.InputStream; import java.io.OutputStream; import javax.crypto.Cipher; import javax.crypto.CipherInputStream; import javax.crypto.CipherOutputStream; import javax.crypto.SecretKey; import javax.crypto.spec.SecretKeySpec; import javax.crypto.spec.DESKeySpec; public class MyCiphers { public static void main(String[] args) { try { BufferedReader br = new BufferedReader(new FileReader("key.txt")); String key = br.readLine(); br.close(); FileInputStream fis = new FileInputStream("original.txt"); FileOutputStream fos = new FileOutputStream("encrypted.txt"); encrypt(key, fis, fos); FileInputStream fis2 = new FileInputStream("encrypted.txt"); FileOutputStream fos2 = new FileOutputStream("decrypted.txt"); decrypt(key, fis2, fos2); } catch (Throwable e) { e.printStackTrace(); } } public static void encrypt(String key, InputStream is, OutputStream os) throws Throwable { encryptOrDecrypt(key, Cipher.ENCRYPT_MODE, is, os); } public static void decrypt(String key, InputStream is, OutputStream os) throws Throwable { encryptOrDecrypt(key, Cipher.DECRYPT_MODE, is, os); } public static void encryptOrDecrypt(String key, int mode, InputStream is, OutputStream os) throws Throwa…
favorite count: 0
tagged with: aes
type: UnansweredQuestion
tagged with: encryption
has title: AES Key From File Trouble
tagged with: des
tagged with: java
downvote count: 1

http://stackoverflow.com/q/22775233
has comment: http://stackoverflow.com/comment/34733924
answer count: 2
has comment: http://stackoverflow.com/comment/34732650
has title: Is it a bad idea to change the Spring Batch Meta-Data tables manually?
tagged with: spring-batch
possible better answer: http://stackoverflow.com/a/31228045
accepted answer: http://stackoverflow.com/a/22788561
has answer: http://stackoverflow.com/a/31228045
downvote count: 1
favorite count: 0
has answer: http://stackoverflow.com/a/22788561
has comment: http://stackoverflow.com/comment/34732135
has body: Background I'm using Spring Batch 2.1.8, and run jobs by CommandLineJobRunner. Such as: java org.springframework.batch.core.launch.support.CommandLineJobRunner classpath:launchContext.xml theJobId Problem At some condition such as a server crash, running job could be interrupted. But the interrupted job left a STARTED status in the Spring Batch Meta-Data tables, and can't be run again. org.springframework.batch.core.repository.JobExecutionAlreadyRunningException: A job execution for this job is already running I can think of two solutions: Solution1 Add a new job parameter and change it everytime to make it a "new" job for Spring Batch. Such as: java org.springframework.batch.core.launch.support.CommandLineJobRunner classpath:launchContext.xml theJobId times=0 And when need to rerun it, do clear all corresponding output data, count up times once, and then rerun the job. Solution2 Change the Spring Batch Meta-Data tables manually. To update the status to make the job restartable. Such as: UPDATE BATCH_JOB_EXECUTION SET END_TIME = SYSTIMESTAMP, STATUS = 'FAILED', EXIT_CODE = 'FAILOVER' WHERE JOB_EXECUTION_ID = (SELECT MAX(JOB_EXECUTION_ID) FROM BATCH_JOB_EXECUTION WHERE JOB_INSTANCE_ID = (SELECT MAX(JOB_INSTANCE_ID) FROM BATCH_JOB_INSTANCE WHERE JOB_NAME = 'XXX')); I've tried it and it seems works well. Question Is Solution2 a bad idea? Are there any traps? Thanks in advance. And any other solutions are appreciated.
type: AnsweredQuestion
score: 7
tagged with: java
upvote count: 8
type: Question

http://stackoverflow.com/q/22697330
has comment: http://stackoverflow.com/comment/34583571
has title: Equal strings does not match for same values
has answer: http://stackoverflow.com/a/22697789
has comment: http://stackoverflow.com/comment/34583044
type: Question
has comment: http://stackoverflow.com/comment/34582782
tagged with: java
has comment: http://stackoverflow.com/comment/34582813
has comment: http://stackoverflow.com/comment/34582927
has comment: http://stackoverflow.com/comment/34582721
possible better answer: http://stackoverflow.com/a/22697397
has comment: http://stackoverflow.com/comment/34583502
has comment: http://stackoverflow.com/comment/34582763
has comment: http://stackoverflow.com/comment/34583194
upvote count: 3
answer count: 2
linked to: http://stackoverflow.com/q/513832
has comment: http://stackoverflow.com/comment/34583317
has body: I am matching two java Strings ,It matches most of the equal Strings but for some values it does not match even the Strings are totally same . public static Person SearchPersonByID(String id) { for(int i=0;i&lt;personList.size();i++) { Person p=new Person(); p=personList.get(i); String useride=p.UserId.toString(); System.out.println(p.UserId+"=="+id); if(useride.contains(id)||useride.equals(id)) { System.out.println("Matched"); return p; } }return null; } I have debugged the program ,although values are exactly same still it is returning null. Here is the values i want to match ..Kindly help me ahsan7==ahsan7 they are same and yet it returns null public class Person { String Status; String MobileNo; String Hobbies; String PersonName; String Password; String LastSeen; String UserId; String location; String Adress; String EmailId; String Type; String ImageAdress; int port; DefaultListModel&lt;String&gt; FriendsList=new DefaultListModel&lt;&gt;(); Person() { } }
has comment: http://stackoverflow.com/comment/34582894
downvote count: 6
tagged with: string
has comment: http://stackoverflow.com/comment/34583275
favorite count: 0
has comment: http://stackoverflow.com/comment/34582742
has comment: http://stackoverflow.com/comment/34582863
has comment: http://stackoverflow.com/comment/34583062
score: -3
has comment: http://stackoverflow.com/comment/34582925
has comment: http://stackoverflow.com/comment/34582807
accepted answer: http://stackoverflow.com/a/22697789
has comment: http://stackoverflow.com/comment/34583534
has answer: http://stackoverflow.com/a/22697397
has comment: http://stackoverflow.com/comment/34582850
type: AnsweredQuestion

http://stackoverflow.com/q/22756577
has comment: http://stackoverflow.com/comment/34689905
tagged with: java
tagged with: multithreading
has body: BlockingQueue&lt;String&gt; queue = new ArrayBlockingQueue&lt;String&gt;(10); for(int i=0; i&lt;queue.size(); i++){ queue[i] = new ArrayBlockingQueue&lt;String&gt;(); } System.out.println("queue size in main "+queue.size()); ***// queue.size() returning 0 why???*** Thread t2 = new Thread(new AccountTransaction(queue)); t2.start(); Thread t1 = new Thread(new BankInfo(queue));
type: Question
tagged with: blockingqueue
has comment: http://stackoverflow.com/comment/34695141
score: 0
answer count: 2
has title: how can initialize size of blocking queue with ArrayBlockingQueue<String>() to show get msg in another thread
has answer: http://stackoverflow.com/a/22850712
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/22756880

http://stackoverflow.com/comment/34643054
has text: MyClass.class.getResourceAsStream("myFile.raw"); returns the Stream on PC, but null on android
score: 0
type: Comment
comment on: http://stackoverflow.com/q/22730636
type: QuestionComment

http://stackoverflow.com/comment/34735764
score: 1
comment on: http://stackoverflow.com/a/22770283
has text: try right-clicking the parent project and selecting run as -> maven install. Does the error happen now? Do the eclipse projects show errors (red x)?
type: AnswerComment
type: Comment

http://stackoverflow.com/comment/34683456
score: 4
has text: What exactly do you have a problem with? So far your question reads as "write a code for me".
comment on: http://stackoverflow.com/q/22753235
type: Comment
type: QuestionComment

http://stackoverflow.com/q/22651383
has answer: http://stackoverflow.com/a/22651405
linked to: http://stackoverflow.com/q/16752073
has answer: http://stackoverflow.com/a/22651729
tagged with: android-asynctask
possible better answer: http://stackoverflow.com/a/22651791
has answer: http://stackoverflow.com/a/22651782
tagged with: android
accepted answer: http://stackoverflow.com/a/22651782
has title: Android Login Thread
answer count: 4
type: AnsweredQuestion
tagged with: java
tagged with: multithreading
type: Question
has answer: http://stackoverflow.com/a/22651791
has body: I am new to Android. I have a UI thread, the user clicks "Login." Once they click login, a thread is created (Android's AsyncTask) that goes to the internet (HTTPPost) and validates the input. There is also a "Progress Bar." Now my question is, how do I go back to the Activity (UI thread?) so I can close and start a new activity. One naive idea that I came up with was to make the AsyncTask class a subclass of the Activity. This way in the "onPostExecute" method, I can finish the Activity. Is there a proper way to do this?
score: 0

http://stackoverflow.com/q/22655531
has comment: http://stackoverflow.com/comment/34510101
has comment: http://stackoverflow.com/comment/34510229
tagged with: java
tagged with: hibernate
tagged with: hql
type: Question
has body: i have 4 tables in which purchaseOrder has relation ship with sullpier ,item,and ordertype. reference key of all table to purchaseOrder is supplierIdfk,itemIdfk,orderTypeIdfk. so my question how can i get record of purchaseOrder record who has suplliername="XXX" , suplliername is one of the column of supplier table. i am using hibernate annotation and for backhand i am using mysql. i have mapped all the entity with annotation. Thanks For your Time. My table looks like this CREATE TABLE `purchaseorder` ( `id` int(11) NOT NULL AUTO_INCREMENT, `discount` double NOT NULL, `finalAmount` double NOT NULL, `remark` varchar(255) DEFAULT NULL, `shipDate` datetime DEFAULT NULL, `unitPrice` double NOT NULL, `itemIdfk` int(11) DEFAULT NULL, `orderIdfk` int(11) DEFAULT NULL, `supplierIdfk` int(11) DEFAULT NULL, PRIMARY KEY (`id`), KEY `indexPurchaseOrderShipDate` (`shipDate`), KEY `FKDFD4BAAD36B52348` (`itemIdfk`), KEY `FKDFD4BAADFD3C54D4` (`orderIdfk`), KEY `FKDFD4BAAD79028B3A` (`supplierIdfk`), CONSTRAINT `FKDFD4BAAD36B52348` FOREIGN KEY (`itemIdfk`) REFERENCES `item` (`id`), CONSTRAINT `FKDFD4BAAD79028B3A` FOREIGN KEY (`supplierIdfk`) REFERENCES `supplier` (`id`), CONSTRAINT `FKDFD4BAADFD3C54D4` FOREIGN KEY (`orderIdfk`) REFERENCES `ordertype` (`id`) ) ENGINE=InnoDB AUTO_INCREMENT=2 DEFAULT CHARSET=utf8; my Entity code for purchaseOrder is like this. package org.chillies.database; import java.util.Date; import javax.persistence.Entity; import javax.persistence.GeneratedValue; import javax.persistence.GenerationType; import javax.persistence.Id; import javax.persistence.JoinColumn; import javax.persistence.ManyToOne; import org.hibernate.annotations.Index; @Entity public class PurchaseOrder { private int id; private Date shipDate; private double unitPrice; private double discount; private double finalAmount; private String remark; private OrderType orderType; private Supplier supplier; private Item item; private static final String KeyOrderId = "orderIdfk"; private static final…
has answer: http://stackoverflow.com/a/22784396
has title: Hibernate Annotation Query confusion
score: 0
has comment: http://stackoverflow.com/comment/34510525
answer count: 3
has answer: http://stackoverflow.com/a/22656958
has comment: http://stackoverflow.com/comment/34509455
possible better answer: http://stackoverflow.com/a/22656958
tagged with: annotations
tagged with: hibernate-mapping
has answer: http://stackoverflow.com/a/22658360
accepted answer: http://stackoverflow.com/a/22784396
linked to: http://stackoverflow.com/q/1612334
has comment: http://stackoverflow.com/comment/34511522
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/34511606

http://stackoverflow.com/q/22658523
tagged with: android
accepted answer: http://stackoverflow.com/a/22659958
has comment: http://stackoverflow.com/comment/34513675
has body: I have tried many solutions to read files but no one were working. I need a method to read a system file and show the text in a toast or in a dialog. Of course my app has root permission. I have to show the content of "eoc_status" in a toast after a checkbox click. For example; Runtime.getRuntime().exec("/sys/kernel/abb-chargalg/eoc_status").getInputStream(); I need to open text files.
has comment: http://stackoverflow.com/comment/34513029
downvote count: 1
type: Question
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/34513490
upvote count: 5
tagged with: java
has answer: http://stackoverflow.com/a/22659958
answer count: 1
has comment: http://stackoverflow.com/comment/34523881
score: 4
has title: Read android system file
has comment: http://stackoverflow.com/comment/34513761
favorite count: 0

http://stackoverflow.com/comment/34585297
has text: @skiwi's singletonCollector was smaller and easier to follow than this, that's why I gave him the check. But good to see consensus in the answer: a custom `Collector` was the way to go.
type: AnswerComment
comment on: http://stackoverflow.com/a/22695424
score: 0
type: Comment

http://stackoverflow.com/comment/34733341
comment on: http://stackoverflow.com/q/22768216
has text: @Yevgeniy.Chernobrivets Thank you for the insight - I will verify the same.
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/q/22802232
tagged with: java
type: Question
has title: Remove all elements from a List after a particular index
answer count: 2
downvote count: 0
accepted answer: http://stackoverflow.com/a/22802295
has body: Is there any convenient way in List/ArrayList by which we can remove all elements of a List after a particular index. Instead of manually looping through it for removing. To be more explanatory, if I have a list of 10 elements, I want to mention index 3 and then all elements after index 3 gets removed and my list would consist of only starting 4 elements now (counts from 0)
possible better answer: http://stackoverflow.com/a/22802346
favorite count: 0
has answer: http://stackoverflow.com/a/22802346
linked to: http://stackoverflow.com/q/32929410
has answer: http://stackoverflow.com/a/22802295
score: 107
type: AnsweredQuestion
upvote count: 107

http://stackoverflow.com/q/22719264
accepted answer: http://stackoverflow.com/a/22719505
has answer: http://stackoverflow.com/a/52869703
tagged with: netbeans
has title: Relocate working copy to new SVN repository not working in Netbeans
possible better answer: http://stackoverflow.com/a/52869703
score: 1
upvote count: 1
has body: My locally installed SVN repository was relocated &amp; is no longer available at the previous location. Infact the previous path is even no longer valid. I tried to move the working directory in Netbeans this way: Project Name-> Subversion-> Working Copy-> Relocate... But I believe due to previous path no longer valid it does not allow to me relocate the repository for this working copy. (When I try to submit the relocate repository dialog in netbeans, the submit button just does not work) How do I relocate the repository for my working copy ? Other ways ?
type: AnsweredQuestion
tagged with: svn
tagged with: java
type: Question
answer count: 3
has answer: http://stackoverflow.com/a/22719505
downvote count: 0
has answer: http://stackoverflow.com/a/59117447
favorite count: 0

http://stackoverflow.com/a/22679385
has body: Check Out This Answer. It's working PROGRAM: String filter = "phoneNumber eq 763436 and carrier eq 'AT and T Mobility' and site startswith 256"; String[] split = filter.split("\\s*and\\s*(?=([^']*'[^']*')*[^']*$)"); for (String s : split) { String[] split1 = s.trim().split(" ",3); for (String s1 : split1) { System.out.println(""+s1.replaceAll("'", "")); } } OUTPUT: phoneNumber eq 763436 carrier eq AT and T Mobility site startswith 256 Check out the updated program as that one works for all types of input strings like below, 1.String filter = "'phone Number' eq '763436' and carrier eq 'AT and T Mobility' and site 'startswith' '256'"; 2.String filter = "'phone Number' eq '763436' and carrier eq 'AT and T Mobility' and site 'starts with' '256'"; 3.String filter = "'phone and Number' eq '763436' and carrier eq 'AT and T Mobility' and site 'starts with' '256'"; 4.String filter = "phoneNumber eq '763436' and carrier eq 'AT and T Mobility' and site startswith '256'"; 5.String filter = "phoneNumber eq 763436 and carrier eq 'AT and T Mobility' and site startswith 256"; even more you can as many strings like above with as single quotes.it's working for all of them.. UPDATED PROGRAM String filter = "'phone Number' eq 763436 and carrier eq 'AT and T Mobility' and site 'startswith' '256'"; String[] split = filter.split("\\s*and\\s*(?=([^']*'[^']*')*[^']*$)"); for (String s : split) { String[] split1 = s.trim().split("\\s* \\s*(?=([^']*'[^']*')*[^']*$)"); for (String s1 : split1) { System.out.println("" + s1.replaceAll("'", "")); } } OUTPUT: phone Number eq 763436 carrier eq AT and T Mobility site startswith 256 Check the updated code and update the status
answers question: http://stackoverflow.com/q/22678833
has comment: http://stackoverflow.com/comment/34556228
has comment: http://stackoverflow.com/comment/34602353
score: 0
has comment: http://stackoverflow.com/comment/34550437
type: Answer

http://stackoverflow.com/q/22776969
upvote count: 6
has comment: http://stackoverflow.com/comment/112766911
accepted answer: http://stackoverflow.com/a/22777066
tagged with: java
answer count: 3
linked to: http://stackoverflow.com/q/63756025
possible better answer: http://stackoverflow.com/a/22777135
has answer: http://stackoverflow.com/a/22777131
has answer: http://stackoverflow.com/a/22777135
tagged with: inheritance
score: 6
has body: Code: class A { static { System.out.println("loading A static 1"); } static { System.out.println("loading A static 2 B.c= "+B.c); } static { System.out.println("loading static 3"); } static int a=10; A(){ } } class B extends A{ static { System.out.println("loading B A.a= "+A.a); } static int c = 50; } public class Test { public static void main(String[] args) { new B(); } } Output: loading A static 1 loading A static 2 B.c= 0 loading static 3 loading B A.a= 10 From this out put can we say that the parent class loads after the child class but child class initialize after the parent class? If so how JVM loads class hierarchies?
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/22777066
downvote count: 0
tagged with: initialization
favorite count: 0
tagged with: classloader
type: Question
has title: How JVM loads parent classes in Java

http://stackoverflow.com/q/22690260
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/22691852
tagged with: tomcat7
answer count: 1
has body: I have created the sample application with OSGI. I have deployed in the Apache Ace. It is in the apache-ace-1.0.0-bin\server-allinone\store path. How can I test/view the application? For eg: http://localhost:8080/test/index.jsp How can I proceed after this? How can I Test the application? Any help is highly appreciated. Thanks!! George
score: 0
tagged with: java
accepted answer: http://stackoverflow.com/a/22691852
tagged with: apache-ace
tagged with: apache
has title: How to test or view the installed OSGI bundles in Apache Ace
type: Question
tagged with: osgi

http://stackoverflow.com/a/22742868
score: 0
type: Answer
answers question: http://stackoverflow.com/q/22742728
has body: It dose have modifier--default, which is always implict. A field or a method modified with default is accessable to classes that share the same package with the field or method.

aop
tags question: http://stackoverflow.com/q/22660260
tags question: http://stackoverflow.com/q/22733613
tag name: aop
tags question: http://stackoverflow.com/q/22713287
type: Tag

http://stackoverflow.com/a/33282907
has body: I know this is likely trivial for the groovy people here, but in my case, I wanted to change the location of the Class-Path in the manifest file depending on whether I was going to run in the production environment or local environment. I did this by making my build.gradle's jar section look like this: jar { from configurations.runtime manifest { attributes ('Main-Class': 'com.me.Main', 'Class-Path': configurations.runtime.files.collect { jarDir+"/$it.name" }.join(' ') ) } } In this case, the argument to gradle build is passed like so: $ gradle build -PjarDir="/opt/silly/path/"
type: Answer
score: 2
upvote count: 2
answers question: http://stackoverflow.com/q/22659463
downvote count: 0

http://stackoverflow.com/comment/34659375
score: 0
type: Comment
type: QuestionComment
has text: "I am really confused by shallow clone and deep clone.". Yes :) A deep copy should be that way, that changes aren´t in the source too. That´s why it is a "deep" copy: Not only a second instance of your class is created, but every member in it is newly created too for the copy.
comment on: http://stackoverflow.com/q/22740001

http://stackoverflow.com/comment/34541604
comment on: http://stackoverflow.com/a/22667577
type: Comment
type: AnswerComment
has text: Thanks for all suggestions, I know have a better understanding of my errors.
score: 0

http://stackoverflow.com/q/22801834
has comment: http://stackoverflow.com/comment/34803314
has comment: http://stackoverflow.com/comment/34798875
tagged with: java
has comment: http://stackoverflow.com/comment/34796805
type: Question
has comment: http://stackoverflow.com/comment/34801555
has answer: http://stackoverflow.com/a/22801885
tagged with: eclipse
has body: I have a project with mixed scala and java code. But I am unable to use scala objects inside java class. No matter what I do, it's throwing me ClassNotFoundException for the scala imports. Example : import scala.collection.Seq; public class TestScalaImport { public static void main(String[] args) throws ClassNotFoundException{ try { Class.forName("scala.collection.Seq"); }catch (ClassNotFoundException e) { throw e; } } } I have my scala library in the classpath, in run configurations and I am using Eclipse. How do I resolve this ? EDIT Relevant pom snippet : <plugins> org.scala-tools maven-scala-plugin compile compile compile test-compile testCompile test-compile process-resources compile I am using Scala library version 2.10
score: 0
answer count: 2
has comment: http://stackoverflow.com/comment/34770795
tagged with: classnotfoundexception
tagged with: scala
type: UnansweredQuestion
tagged with: maven
has answer: http://stackoverflow.com/a/22802464
has title: Java ClassNotFoundException for scala import in Java
has comment: http://stackoverflow.com/comment/34770830

awk
tag name: awk
type: Tag
tags question: http://stackoverflow.com/q/22711489

http://stackoverflow.com/q/22791538
has answer: http://stackoverflow.com/a/22796195
has answer: http://stackoverflow.com/a/22863695
answer count: 3
tagged with: playframework
score: 2
tagged with: junit
downvote count: 0
favorite count: 0
upvote count: 2
accepted answer: http://stackoverflow.com/a/22796195
type: AnsweredQuestion
tagged with: playframework-2.0
has body: In the latest documentation, this template test is given as an example. @Test public void renderTemplate() { Content html = views.html.index.render("Coco"); assertThat(contentType(html)).isEqualTo("text/html"); assertThat(contentAsString(html)).contains("Coco"); } But how am I supposed to run this? I tried it on its own, inside the run() method on a fake server, a real server, along side an actual running server, and I always get this error. [error] Test ApplicationTest.testInServer failed: java.lang.RuntimeException: There is no HTTP Context available from here. There are literally two pages on testing in the documentation and I have no idea how to actually run any of these tests. Is there an example class anywhere that doesn't use deprecated methods (things have changed since Play 1 and most things don't work any more).
tagged with: java
type: Question
has title: PlayFramework 2 template testing
has answer: http://stackoverflow.com/a/22795063
possible better answer: http://stackoverflow.com/a/22863695

http://stackoverflow.com/a/22763803
answers question: http://stackoverflow.com/q/22763441
has comment: http://stackoverflow.com/comment/34820135
has comment: http://stackoverflow.com/comment/34805082
has comment: http://stackoverflow.com/comment/34805108
accepted answer of: http://stackoverflow.com/q/22763441
has comment: http://stackoverflow.com/comment/34706498
has comment: http://stackoverflow.com/comment/34805914
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/34844080
upvote count: 1
has comment: http://stackoverflow.com/comment/34809652
type: Answer
has comment: http://stackoverflow.com/comment/34800050
downvote count: 0
has comment: http://stackoverflow.com/comment/34832240
has body: Well, it's better to change the format of your JSON, but in case it you don't have a chance to do that and if the structure of response is always the same as above, the possible solution is to do the following (assuming out is JSON response of type String): ArrayList&lt;Item&gt; items = new ArrayList&lt;Item&gt;(); JSONArray jsonArray = new JSONArray(out); JSONObject jsonObject = new JSONObject(); Set&lt;String&gt; tempSet = new HashSet&lt;String&gt;(); for (int i = 0; i&lt;jsonArray.length();i++){ jsonObject = jsonArray.getJSONObject(i); if (!tempSet.contains(jsonObject.getString("titulo"))){ items.add(new SectionItem(jsonObject.getString("titulo"))); tempSet.add(jsonObject.getString("titulo")); } items.add(new EntryItem(jsonObject.getString("nombrelinea"), jsonObject.getString("monto"))); } P.S. Edit was made to reflect the issue described in comments
has comment: http://stackoverflow.com/comment/34830711
has comment: http://stackoverflow.com/comment/34796089
score: 1

http://stackoverflow.com/q/22796049
has body: I'm getting this error when executing "play clean test" for every play project on my system: [info] Compiling 9 Scala sources and 302 Java sources to $HOME/Workspace/sis/target/scala-2.10/test-classes... [error] error while loading , error in opening zip file scala.reflect.internal.MissingRequirementError: object scala.runtime in compiler mirror not found. at scala.reflect.internal.MissingRequirementError$.signal(MissingRequirementError.scala:16) at scala.reflect.internal.MissingRequirementError$.notFound(MissingRequirementError.scala:17) at scala.reflect.internal.Mirrors$RootsBase.getModuleOrClass(Mirrors.scala:48) at scala.reflect.internal.Mirrors$RootsBase.getModuleOrClass(Mirrors.scala:40) at scala.reflect.internal.Mirrors$RootsBase.getModuleOrClass(Mirrors.scala:61) at scala.reflect.internal.Mirrors$RootsBase.getPackage(Mirrors.scala:172) at scala.reflect.internal.Mirrors$RootsBase.getRequiredPackage(Mirrors.scala:175) at scala.reflect.internal.Definitions$DefinitionsClass.RuntimePackage$lzycompute(Definitions.scala:181) at scala.reflect.internal.Definitions$DefinitionsClass.RuntimePackage(Definitions.scala:181) at scala.reflect.internal.Definitions$DefinitionsClass.RuntimePackageClass$lzycompute(Definitions.scala:182) at scala.reflect.internal.Definitions$DefinitionsClass.RuntimePackageClass(Definitions.scala:182) at scala.reflect.internal.Definitions$DefinitionsClass.AnnotationDefaultAttr$lzycompute(Definitions.scala:997) at scala.reflect.internal.Definitions$DefinitionsClass.AnnotationDefaultAttr(Definitions.scala:996) at scala.reflect.internal.Definitions$DefinitionsClass.syntheticCoreClasses$lzycompute(Definitions.scala:1126) at scala.reflect.internal.Definitions$DefinitionsClass.syntheticCoreClasses(Definitions.scala:1125) at scala.reflect.internal.Definitions$DefinitionsClass.symbolsNotPresentInBytecode$lzycompute(Definitions.scala:1169) at scala.reflect.internal.Definitions$DefinitionsClass.symbolsNotPresentInBytecode(Definitions.scala:1169) at scala.re…
score: 4
favorite count: 0
has answer: http://stackoverflow.com/a/22821887
tagged with: scala
type: UnansweredQuestion
downvote count: 1
type: Question
tagged with: sbt
upvote count: 5
tagged with: java
tagged with: playframework
answer count: 1
has title: Error "scala.reflect.internal.MissingRequirementError: object scala.runtime in compiler mirror not found" when compiling Play framework tests

http://stackoverflow.com/a/22780341
accepted answer of: http://stackoverflow.com/q/22780308
type: AcceptedAnswer
downvote count: 0
answers question: http://stackoverflow.com/q/22780308
type: Answer
score: 2
upvote count: 2
has body: In the below Class A isn't x a local variable too since it is in blocks({}) No. It's not in a block. It's in a class declaration, but that's not a block as such. "Block" isn't synonymous with "text in braces". To be a bit clearer, local variables are declared in: Methods Constructors Static initializers Instance initializers If you look at the production for a class declaration, that's not a Block (unlike the production for static initializers and instance initializers).

http://stackoverflow.com/q/22737229
tagged with: date
has answer: http://stackoverflow.com/a/22746017
answer count: 2
downvote count: 0
favorite count: 0
accepted answer: http://stackoverflow.com/a/22746017
has comment: http://stackoverflow.com/comment/34654480
score: 2
type: AnsweredQuestion
has title: How to format Gregorian date using SimpleDateformat
upvote count: 2
has body: I have a Gregorian Date in a String format, I want format it in java.util.Date using SimpleDateFormat I want to do something like that: String gDate="20-Aug-2012"; DateFormat sdf= new SimpleDateFormat(dd-MMM-yyyy"); Date dDate=sdf.parse(gDate); But this throws java.text.ParseException: Unparseable date: "20-Aug-2013"
has comment: http://stackoverflow.com/comment/34654424
type: Question
possible better answer: http://stackoverflow.com/a/22737271
tagged with: simpledateformat
tagged with: java
tagged with: date-formatting
has answer: http://stackoverflow.com/a/22737271

http://stackoverflow.com/a/22706007
has comment: http://stackoverflow.com/comment/34599134
has comment: http://stackoverflow.com/comment/34598589
score: 0
has comment: http://stackoverflow.com/comment/34598900
has comment: http://stackoverflow.com/comment/34598741
answers question: http://stackoverflow.com/q/22705846
has comment: http://stackoverflow.com/comment/34598918
has comment: http://stackoverflow.com/comment/34598873
type: Answer
has body: I would replace { and } from the string then get array from that using: String values[] = data .replace("{","").replace("}","").split(","); Then iterate over array and put the key-value pairs in a Map by spliting array element with: String[] value= values[index].split(":"); and using value[0] as a key and value[1] as a pair. Or as another option I suggest to use some JSON api for java. Here is the sample code: String data ="{Id:1492,Name:Antony ,School:DPS}"; String values[] = data .replace("{","").replace("}","").split(","); Map&lt;String, String&gt; map = new TreeMap&lt;String, String&gt;(); for (int i = 0; i &lt; values.length; i++) { String value[] = values[i].split(":"); map.put(value[0], value[1]); } System.out.println(map.toString());
has comment: http://stackoverflow.com/comment/34599150
has comment: http://stackoverflow.com/comment/34598706
has comment: http://stackoverflow.com/comment/34598804

http://stackoverflow.com/comment/34700228
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/22762353
has text: Without the code to compare it to, we have no idea how to diagonose it.
score: 0

http://stackoverflow.com/comment/34547268
has text: Alright, I appreciate the help. I'll fiddle around with it a bit, but I think the problem lies in my temp, now that I took a long look at my code. LinkNode<E> temp = new LinkNode<E>(newData, null); I think this line is my issue. my first NPX occurs in a condition that is only supposed to be used if the queue is empty (in the addToQueue method), so I'm assigning my head and tail values to temp, so temp must be empty, but the only point I'm setting temp I'm setting it to (newData, null). I'm not sure what that null does exactly, but that may be my issue with the NPXs everywhere
type: AnswerComment
score: 0
type: Comment
comment on: http://stackoverflow.com/a/22676935

http://stackoverflow.com/q/22662939
type: AnsweredQuestion
downvote count: 0
score: 1
tagged with: java
tagged with: hibernate
tagged with: orm
has title: Hibernate - Version property invokes automatic update on change?
type: Question
tagged with: jpa
answer count: 1
upvote count: 1
has body: When retrieving entities and manipulating some of their properties programmatically an automatic update is invoked, with no manual call to session.update() by hibernate on commit incrementing my db-generated version column. (Even validation takes place). I was surprised about my high version values and validation. Hibernate 4.3.1 The entities are still attached to the session. Pseudo-code: Session session = sessinFactory.openSession(); Transaction tr = session.beginTransaction(); Entity entity = session.get(Entity.class, 1); entity.setFoo("foo"); tr.commit(); session.close(); // here fake-update takes place Question: Is this a feature? I could try to detach instances that i am going to manipulate. Or is this a bug? For me its more a bug, since I did not invoked an update. But not an fake-update.
favorite count: 0
has answer: http://stackoverflow.com/a/22731909
accepted answer: http://stackoverflow.com/a/22731909

http://stackoverflow.com/comment/34529826
score: 1
type: QuestionComment
type: Comment
has text: You forgot to insert the `for` loop to insert the blanks in the second case, i.e. within `for(i=2;i<=n;i++)`.
comment on: http://stackoverflow.com/q/22667839

http://stackoverflow.com/a/22673410
has comment: http://stackoverflow.com/comment/34540090
has comment: http://stackoverflow.com/comment/34540218
has comment: http://stackoverflow.com/comment/34539837
upvote count: 5
has comment: http://stackoverflow.com/comment/34540263
has comment: http://stackoverflow.com/comment/34540262
answers question: http://stackoverflow.com/q/22673211
downvote count: 0
has comment: http://stackoverflow.com/comment/34540304
has comment: http://stackoverflow.com/comment/34588108
has comment: http://stackoverflow.com/comment/34540312
accepted answer of: http://stackoverflow.com/q/22673211
score: 5
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/34540440
has comment: http://stackoverflow.com/comment/34587830
has comment: http://stackoverflow.com/comment/34540079
has body: false result means that some values in listA do not have corresponding (equal) values in listB. It may be caused by some unnecessary whitespaces. You need to know that "foo".equals(" foo") will return false which means used values are not equal, because space also count as characters. If each string is properly formatted, the sample data you have provided works just fine. import java.util.Arrays; import java.util.List; public class Test { public static final void main(String[] ignored) { List&lt;String&gt; listA = Arrays.asList(new String[]{"941", "946", "940", "942"}); List&lt;String&gt; listB = Arrays.asList(new String[]{"941", "942", "940", "946", "888", "466", "777"}); System.out.println(listB.containsAll(listA)); } } Output: true
has comment: http://stackoverflow.com/comment/34540528
type: Answer

http://stackoverflow.com/q/22715004
upvote count: 5
tagged with: parcelable
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/22715073
downvote count: 0
favorite count: 0
has body: I have an ArrayList of a custom class to be passed from an activity to another. I make the class implements Parcelable. However, every time when I use the passed ArrayList I get NullPointException. So I decide to check the class of the return value of getParcelableArrayList() and I got java.lang.Integer. I wonder how to explain this. Code of the first Activity: public void onItemClick(AdapterView&lt;?&gt; arg0, View arg1, int arg2, long arg3) { // TODO Auto-generated method stub Intent intent = new Intent(this, WeiboBrowseActivity.class); intent.putParcelableArrayListExtra(WeiboBrowseActivity.KEY_WEIBO_INFO_LIST, weiboInfoList); intent.putExtra(WeiboBrowseActivity.KEY_SELECTED_WEIBO_INDEX, arg2); startActivity(intent); overridePendingTransition(R.anim.in_from_right, R.anim.out_to_left); } Code of the second Activity: private void initWeiboInfos() { Log.d("cosmo","the type is: " + getIntent().getExtras().get(KEY_WEIBO_INFO_LIST).getClass().getName()); weiboInfos = getIntent().getExtras().getParcelableArrayList(KEY_WEIBO_INFO_LIST); if (weiboInfos == null) { Log.d("cosmo", "weiboInfos null"); //I got this log } else { Log.d("cosmo", "weiboInfos not null"); } } Code of the Parcelable Class: public class WeiboInfo implements Parcelable { private String absolutePath; private long createTimestamp; public WeiboInfo() { super(); this.setAbsolutePath(""); this.setCreateTimestamp(new Date().getTime()); } public WeiboInfo(String absolutePath, long createTimestamp) { super(); this.setAbsolutePath(absolutePath); this.setCreateTimestamp(createTimestamp); } public WeiboInfo(Parcel in) { super(); this.setAbsolutePath(in.readString()); this.setCreateTimestamp(in.readLong()); } public String getAbsolutePath() { return absolutePath; } public void setAbsolutePath(String absolutePath) { this.absolutePath = absolutePath; } public long getCreateTimestamp() { return createTimestamp; } public void setCreateTimestamp(long createTimestamp) { this.createTimestamp = createTimestamp; } @Override…
type: Question
has title: getParcelableArrayList returns null
score: 5
tagged with: android
accepted answer: http://stackoverflow.com/a/22715073
tagged with: java
answer count: 1

http://stackoverflow.com/comment/34681434
comment on: http://stackoverflow.com/q/22752027
has text: `x.equals("a")!= true` can be reduced to `!x.equals("a")`
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/34629520
score: 0
has text: The exception says: Caused by: org.h2.jdbc.JdbcBatchUpdateException: La columna "PROYECTO" no permite valores nulos (NULL) NULL not allowed for column "PROYECTO"; SQL statement: insert into INCIDENCIAS (USUARIO_CREACION, FECHA_CREACION, DESCRIPCION, FECHA_Y_HORA, USUARIO_ULTIMA_MODIFICACION, FECHA_ULTIMA_MODIFICACION, ID_PROYECTO, ID_USUARIO, VERSION, ID) values (?, ?, ?, ?, ?, ?, ?, ?, ?, ?) [23502-175]. The columns that apear in the sentence are the same that I defined in the class. The column PROYECTO is not defined in the class. For you information I'm using an in-memory database H2.
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/22698405

http://stackoverflow.com/q/22714854
has comment: http://stackoverflow.com/comment/34615131
type: Question
tagged with: java
has title: Error Inserting Photo from Drawable using MySQLHelper
tagged with: sql
tagged with: sqlite
has comment: http://stackoverflow.com/comment/34615227
has comment: http://stackoverflow.com/comment/34615402
has body: I'm currently facing difficulty getting a specific image to appear, and after looking at the error messages I can't decipher why it's not showing up at all. Here's the LogCat: 03-28 13:45:49.552: E/SpannableStringBuilder(21649): SPAN_EXCLUSIVE_EXCLUSIVE spans cannot have a zero length 03-28 13:45:49.552: E/SpannableStringBuilder(21649): SPAN_EXCLUSIVE_EXCLUSIVE spans cannot have a zero length 03-28 13:45:53.047: E/SQLiteDatabase(21649): Error inserting photo=[B@433d3d88 name=Chord Name: A-7th 03-28 13:45:53.047: E/SQLiteDatabase(21649): android.database.sqlite.SQLiteConstraintException: column name is not unique (code 19) 03-28 13:45:53.047: E/SQLiteDatabase(21649): at android.database.sqlite.SQLiteConnection.nativeExecuteForLastInsertedRowId(Native Method) 03-28 13:45:53.047: E/SQLiteDatabase(21649): at android.database.sqlite.SQLiteConnection.executeForLastInsertedRowId(SQLiteConnection.java:905) 03-28 13:45:53.047: E/SQLiteDatabase(21649): at android.database.sqlite.SQLiteSession.executeForLastInsertedRowId(SQLiteSession.java:788) 03-28 13:45:53.047: E/SQLiteDatabase(21649): at android.database.sqlite.SQLiteStatement.executeInsert(SQLiteStatement.java:86) 03-28 13:45:53.047: E/SQLiteDatabase(21649): at android.database.sqlite.SQLiteDatabase.insertWithOnConflict(SQLiteDatabase.java:1469) 03-28 13:45:53.047: E/SQLiteDatabase(21649): at android.database.sqlite.SQLiteDatabase.insert(SQLiteDatabase.java:1339) 03-28 13:45:53.047: E/SQLiteDatabase(21649): at com.finalyearproject.MySQLiteHelper.insertCrdDetails(MySQLiteHelper.java:77) 03-28 13:45:53.047: E/SQLiteDatabase(21649): at com.finalyearproject.ChordImages.onCreate(ChordImages.java:63) 03-28 13:45:53.047: E/SQLiteDatabase(21649): at android.app.Activity.performCreate(Activity.java:5206) 03-28 13:45:53.047: E/SQLiteDatabase(21649): at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1083) 03-28 13:45:53.047: E/SQLiteDatabase(21649): at android.app.ActivityThread.performLaunchActivity(ActivityT…
tagged with: android
has comment: http://stackoverflow.com/comment/34615598
answer count: 0
score: 0
type: UnansweredQuestion
tagged with: android-sqlite

http://stackoverflow.com/comment/34641437
has text: You should post your stacktrace if your app crashes.
score: 0
type: Comment
comment on: http://stackoverflow.com/q/22729649
type: QuestionComment

http://stackoverflow.com/a/22746344
downvote count: 0
score: 3
type: Answer
has comment: http://stackoverflow.com/comment/34670940
has body: if( button[i].setEnabled(false)) { JOptionPane.showMessageDialog(null," Button is disables "); break; } You are indeed trying to check a void type in a conditional statement, this can't be done. Since setEnabled returns void (nothing). What you should be doing is checking the getter method of 'Enabled', so: if (!button[i].isEnabled()) { JOptionPane.showMessageDialog(null," Button is disables "); break; } Note the '!' before the statement, this makes it negative
upvote count: 3
answers question: http://stackoverflow.com/q/22746280
has comment: http://stackoverflow.com/comment/34670792
accepted answer of: http://stackoverflow.com/q/22746280
type: AcceptedAnswer

http://stackoverflow.com/comment/34544493
score: 0
type: AnswerComment
type: Comment
has text: @Sangeeth: Does `"abc"` appear anywhere in your source?
comment on: http://stackoverflow.com/a/22671647

http://stackoverflow.com/q/22798529
tagged with: methods
downvote count: 1
type: Question
has answer: http://stackoverflow.com/a/22798540
type: AnsweredQuestion
has title: Why is a method body filled with semicolons acceptable syntax?
accepted answer: http://stackoverflow.com/a/22798540
answer count: 3
score: 5
favorite count: 0
has body: public static void main(String[] args) { System.out.println("World Hello!");;;;;;;;;;;;;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;;;;; ;;;;;;;;; ;;;;;;; ;;;;;;;;;;;;;; ;;;;; } The normal person is me wants to say: "What are all of those semicolons doing there!?"
possible better answer: http://stackoverflow.com/a/22798582
upvote count: 6
has answer: http://stackoverflow.com/a/22798582
has answer: http://stackoverflow.com/a/22799662
tagged with: java

http://stackoverflow.com/comment/34718922
type: QuestionComment
comment on: http://stackoverflow.com/q/22772494
has text: unfortunately they refused to help in software issues (according to them, they are always right and dont make mistakes jeje)
score: 0
type: Comment

http://stackoverflow.com/q/22741556
has body: There is a strange restriction in java.io.DataOutputStream.writeUTF(String str) method, which limits the size of an UTF-8 encoded string to 65535 bytes: if (utflen > 65535) throw new UTFDataFormatException( "encoded string too long: " + utflen + " bytes"); It is strange, because: there is no any information about this restriction in JavaDoc of this method this restriction can be easily solved by copying and modifying an internal static int writeUTF(String str, DataOutput out) method of this class there is no such restriction in the opposite method java.io.DataInputStream.readUTF(). According to the said above I can not understand the purpose of a such restriction in the writeUTF method. What have I missed or misunderstood?
favorite count: 0
upvote count: 20
accepted answer: http://stackoverflow.com/a/22741597
has title: DataOutputStream: purpose of the "encoded string too long" restriction
type: AnsweredQuestion
downvote count: 0
tagged with: java
has answer: http://stackoverflow.com/a/22741597
tagged with: dataoutputstream
type: Question
score: 20
has comment: http://stackoverflow.com/comment/34663481
tagged with: restriction
answer count: 1

http://stackoverflow.com/comment/34699895
has text: In which container are you uploading the files?
type: Comment
score: 0
comment on: http://stackoverflow.com/q/22755857
type: QuestionComment

http://stackoverflow.com/a/23162463
score: 1
answers question: http://stackoverflow.com/q/22722379
type: AcceptedAnswer
downvote count: 0
type: Answer
upvote count: 1
accepted answer of: http://stackoverflow.com/q/22722379
has body: What I ended up doing is adding the libraries (repositories) as sub-modules in git and as modules in my project. So, I don't know if the answer is really "No, it can't be done", but that's how I solved the problem for now. Hope it helps anyone.

http://stackoverflow.com/a/22681870
answers question: http://stackoverflow.com/q/22681798
score: 0
type: Answer
has body: The jar file can be downloaded here. And the API is located here org.artarus.snowball.ext.englishStemmer you can download here

http://stackoverflow.com/a/71075614
score: 0
type: Answer
answers question: http://stackoverflow.com/q/22694884
has body: public List<state> getAllActiveState() { List<Master> master = masterRepository.getActiveExamMasters(); Master activeMaster = new Master(); try { activeMaster = master.stream().filter(status -> status.getStatus() == true).reduce((u, v) -> { throw new IllegalStateException(); }).get(); return stateRepository.getAllStateActiveId(activeMaster.getId()); } catch (IllegalStateException e) { logger.info(":More than one status found TRUE in Master"); return null; } } In this above code, As per the condition if its find more than one true in the list then it will through the exception. When it through the error will showing custom message because it easy maintain the logs on server side. From Nth number of element present in list just want only one element have true condition if in list there are more than one elements having true status at that moment it will through an exception. after getting all the this we using get(); to taking that one element from list and stored it into another object. If you want you added optional like Optional<activeMaster > = master.stream().filter(status -> status.getStatus() == true).reduce((u, v) -> {throw new IllegalStateException();}).get();

http://stackoverflow.com/q/22683448
tagged with: jform
tagged with: country
tagged with: java
type: Question
has answer: http://stackoverflow.com/a/22683657
has title: Implementing a Drop Down Menu with a Country List into a JavaForm
score: 0
answer count: 1
tagged with: user-interface
tagged with: drop-down-menu
accepted answer: http://stackoverflow.com/a/22683657
linked to: http://stackoverflow.com/q/16801951
has body: So, I was wondering how I would go about implementing a list of all the countries in the world, into my JavaForm. As I don't want to sit and write out all the countries in the world, I would like to implement a outside list, but I can't find anywhere where I can actually find out how to implement a drop down list like this: https://i.sstatic.net/zdaEk.jpg I came here therefore looking for some help. This is what my current GUI looks like, and then I would like a drop down menu to be beneath the country panel.
type: AnsweredQuestion

http://stackoverflow.com/a/22785685
has comment: http://stackoverflow.com/comment/34756435
type: Answer
upvote count: 2
score: 2
accepted answer of: http://stackoverflow.com/q/22784651
type: AcceptedAnswer
downvote count: 0
answers question: http://stackoverflow.com/q/22784651
has body: Timestamp.getTime() considers the Nanoseconds as well. So even the toString() returns a same output, actually there is a nano difference. But java.util.Date only deals with Milliseconds.

http://stackoverflow.com/comment/34682663
type: Comment
comment on: http://stackoverflow.com/a/22744120
type: AnswerComment
score: 0
has text: Interesting, thanks, i ignored the existence of green threads.

http://stackoverflow.com/q/22711626
has body: In my GWT application, I am having a JSONArray object. I take an input string and do some processing on a large number of files that are opened and insert elements in the JSONArray object based on some condition. On giving some input that would insert a large number of elements in the JSONArray, I get this exception: RangeError: Maximum call stack size exceeded If I give an input, with which there wouldn't be relatively less number of elements being put in the JSONArray object, I don't get such an exception. Is there any limit on the the number of elements that can be put in a JSONArray? If so, what is the number?
tagged with: gwt
type: AnsweredQuestion
has title: GWT - What is the maximum number of elements that can be put in a JSONArray?
accepted answer: http://stackoverflow.com/a/22716018
has comment: http://stackoverflow.com/comment/34608496
tagged with: java
tagged with: http://stackoverflow.com/tag/json
type: Question
score: 0
answer count: 1
has answer: http://stackoverflow.com/a/22716018

http://stackoverflow.com/comment/34775498
has text: See this [thread](http://stackoverflow.com/a/660350/945317)
comment on: http://stackoverflow.com/q/22804561
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/34617288
score: 2
comment on: http://stackoverflow.com/q/22716447
type: Comment
has text: javascript gets executed in a browser, so you could use a browser automatisation framework like for example webdriver/selenium
type: QuestionComment

http://stackoverflow.com/a/22731950
has comment: http://stackoverflow.com/comment/34653250
has comment: http://stackoverflow.com/comment/34652751
accepted answer of: http://stackoverflow.com/q/22717005
type: Answer
downvote count: 0
has comment: http://stackoverflow.com/comment/34654019
has comment: http://stackoverflow.com/comment/34652455
score: 1
has body: Here is an example. In this case I create a local Database /tmp/test. Attention: If you want to use Derby as a service, you have to change the URL in getConnection() and start the database by yourself. You also can change the filename of the database at the same position. The example can read the whole data with getData() or a single value with getOneName(String). In the constructor we create and fill the database (if necessary), read the whole data, read a single letter and read a non exististing letter. Hope that helps import java.sql.Connection; import java.sql.DriverManager; import java.sql.PreparedStatement; import java.sql.ResultSet; import java.sql.SQLException; import java.sql.Statement; import java.util.HashMap; import java.util.Map; public class TestApp { public static void main(String[] args) throws SQLException { TestApp myTestApp = new TestApp(); } public TestApp() throws SQLException { this.createAndFillDatabase(); Map&lt;String, String&gt; allData = this.getData(); String oneData = this.getOneName("A"); String noData = this.getOneName("D"); System.out.println("allData = " + allData); System.out.println("oData = " + oneData); System.out.println("noData = " + noData); } private Connection getConnection() throws SQLException { return DriverManager.getConnection("jdbc:derby:/tmp/test;create=true"); } private void createAndFillDatabase() throws SQLException { try (Connection conn = getConnection()) { ResultSet tables = conn.getMetaData().getTables(null, null, "POSSIBLESQLTABLE", null); if (!tables.next()) { // create table Statement stmt = conn.createStatement(); stmt.execute("CREATE TABLE possibleSqlTable(\n" + " letter VARCHAR(1) NOT NULL PRIMARY KEY\n" + ", name VARCHAR(14)\n" + ")"); // insert data String[][] data = {{"A", "alpha-static"}, {"B", "beta-static"}, {"C", "charlie-static"}}; PreparedStatement pstmt = conn.prepareStatement("INSERT INTO possibleSqlTable(letter,name) VALUES (?,?)"); for (String[] row : data) { pstmt.setString(1, row[0]); pstmt…
upvote count: 1
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/34652500
answers question: http://stackoverflow.com/q/22717005

http://stackoverflow.com/comment/34678312
score: 0
type: Comment
has text: also post your main layout xml
comment on: http://stackoverflow.com/a/22749948
type: AnswerComment

http://stackoverflow.com/a/22765280
type: Answer
has body: What did the extending accomplish that can't be done using a simple java enum ? You can just use if else blocks and and invoke equals method.
answers question: http://stackoverflow.com/q/22765009
has comment: http://stackoverflow.com/comment/34705861
score: 0

http://stackoverflow.com/a/22655542
has comment: http://stackoverflow.com/comment/34508061
has body: Simple One: public static String generate(String userId,int index){ String partialUserId=userId.substring(0,7); String idxString=String.format("%03d", index); return (partialUserId+idxString); } Presumed that you pass id with length greater than 7 otherwise throws an Exception.
score: 0
type: Answer
has comment: http://stackoverflow.com/comment/34508132
answers question: http://stackoverflow.com/q/22655138

http://stackoverflow.com/comment/34602687
has text: I am implementing CBC in Java and in CBC you need to have entire plaintext message and then fed them to appropriate library function to process for encryption. @michele
type: AnswerComment
comment on: http://stackoverflow.com/a/22707975
type: Comment
score: 0

http://stackoverflow.com/comment/34498458
score: 0
type: Comment
comment on: http://stackoverflow.com/a/22649487
has text: Hmmm, well, if you look at [the javadocs](http://docs.oracle.com/javase/7/docs/api/java/util/concurrent/ThreadPoolExecutor.html) for it, there is a method that allows you to access the queue, but "Method getQueue() allows access to the work queue for purposes of monitoring and debugging. Use of this method for any other purpose is strongly discouraged." The whole point of the cachedThreadPool is that it begins all tasks you set it as soon as it can (it's not single threaded), creating new threads or reusing old ones as needed. ScheduledThreadPoolExecutor lets you schedule tasks.
type: AnswerComment

http://stackoverflow.com/comment/34614400
has text: This seems to really blur the lines between interfaces and abstract classes.
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/22713721
score: 3

http://stackoverflow.com/comment/98604341
type: AnswerComment
has text: Nice, Clear and Concise explanation. Liked it Sir.
score: 0
type: Comment
comment on: http://stackoverflow.com/a/22672120

http://stackoverflow.com/q/22782493
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/22784215
tagged with: java
tagged with: hibernate
has comment: http://stackoverflow.com/comment/34738550
type: Question
upvote count: 2
has comment: http://stackoverflow.com/comment/34735972
has answer: http://stackoverflow.com/a/22784215
answer count: 1
tagged with: jpa
has comment: http://stackoverflow.com/comment/34738618
has comment: http://stackoverflow.com/comment/34738796
favorite count: 0
has body: I have an object called Lecture and it has 2 fields which are both of type Teacher class Lecture{ private Teacher teacher; private Teacher subsTeacher; } Lets assume a Teacher may teach many lectures. So there is a one to many relation between Teacher -> Lecture Now in Teacher class I have: @OneToMany(mappedBy = "teacher") @Cascade(value = {org.hibernate.annotations.CascadeType.DETACH, org.hibernate.annotations.CascadeType.LOCK}) public Set&lt;Lecture&gt; getLectures() { return lectures; } However, this will not return me the Lectures the teacher is subsTeacher to. But I need them as well. How can I achieve this? Table structure: Table: Lecture Columns: id, teacher_id, substeacher_id Table Teacher: Columns: id, name
score: 2
has comment: http://stackoverflow.com/comment/34736098
downvote count: 0
has title: Hibernate @OneToMany mapped by 2 different columns

http://stackoverflow.com/comment/34535507
has text: I agree it's unusual with setters, but why getters? Inheriting getters seems common.
type: Comment
score: 0
comment on: http://stackoverflow.com/a/22670358
type: AnswerComment

http://stackoverflow.com/q/22762910
tagged with: java
has body: I need to display a CLOB field with longer than 4000 characters in a text field using in iReport. I am using iReport version 5.5.0, I tried converting the CLOB to InputStream but it did not work, all I get is: java.io.ByteArrayInputStream@43842a66 I tried getSubString(long,int) but it only works for strings smaller than 4000 chars. stringValue() and toString() also did not work. Thanks for any help. EDIT: Clob.getSubString(long,int) method worked fine in my latter tests, I don't know why it didn't work before. So I used: $F{FIELD}.getSubString( (long)1, (int)$F{FIELD}.length() ) eventually. It may not be the best option, but I figured max length of a String (2147483647) is more than enough for the field.
type: Question
accepted answer: http://stackoverflow.com/a/22763273
answer count: 2
downvote count: 0
has title: How to display CLOB (or BLOB) String in iReport?
favorite count: 0
has answer: http://stackoverflow.com/a/63724585
tagged with: clob
has answer: http://stackoverflow.com/a/22763273
possible better answer: http://stackoverflow.com/a/63724585
tagged with: jasper-reports
type: AnsweredQuestion
tagged with: ireport
score: 3
tagged with: blob
upvote count: 3

http://stackoverflow.com/comment/34655929
type: Comment
score: 1
has text: @tanishalfelven: hm, what did it output?
type: AnswerComment
comment on: http://stackoverflow.com/a/22737993

http://stackoverflow.com/tag/csv
type: Tag
tags question: http://stackoverflow.com/q/22722383
tag name: csv
tags question: http://stackoverflow.com/q/22752976
tags question: http://stackoverflow.com/q/22795903
tags question: http://stackoverflow.com/q/22756803
tags question: http://stackoverflow.com/q/22727303
tags question: http://stackoverflow.com/q/22757029
tags question: http://stackoverflow.com/q/22764073
tags question: http://stackoverflow.com/q/22705981
tags question: http://stackoverflow.com/q/22766911
tags question: http://stackoverflow.com/q/22717005
tags question: http://stackoverflow.com/q/22710155

http://stackoverflow.com/a/24140681
has body: Do you already have an Persistence Unit? If not, create one as follows. Right click on the project, select New -> Other. Click the Persistence Category, then the Persistence Unit file type. A persistence.xml file (PU) will be created. Include your entity classes in the PU and set the Table Generation Strategy to Create. When you run your project, the tables will be created.
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/53982049
type: Answer
accepted answer of: http://stackoverflow.com/q/22743447
score: 2
downvote count: 0
answers question: http://stackoverflow.com/q/22743447
has comment: http://stackoverflow.com/comment/53985517
upvote count: 2

http://stackoverflow.com/a/22680889
upvote count: 0
answers question: http://stackoverflow.com/q/22679862
has comment: http://stackoverflow.com/comment/34553658
score: -2
has comment: http://stackoverflow.com/comment/34591958
has comment: http://stackoverflow.com/comment/34553007
downvote count: 2
has comment: http://stackoverflow.com/comment/34553392
has body: For me this is a simple question. In XML just use string-array and then in java code cast it to integer that all.
type: Answer

http://stackoverflow.com/a/22708869
answers question: http://stackoverflow.com/q/22708070
has body: Maybe try to define the EditText.setOnFocusChangedListener : public abstract void onFocusChange (View v, boolean hasFocus){ if(v.getId() == (yourEditTextID) &amp;&amp; hasFocus == false){ //Check your editTextValue //if not in range, show an error (Toast ?) and refocus } }
score: 0
type: Answer

http://stackoverflow.com/a/22724994
has comment: http://stackoverflow.com/comment/34633466
answers question: http://stackoverflow.com/q/22724871
has comment: http://stackoverflow.com/comment/34633345
has comment: http://stackoverflow.com/comment/34633623
score: 0
has comment: http://stackoverflow.com/comment/34633426
has body: Try this code in your onCreate() method : Intent intent = getIntent(); if( intent != null ) { String name = intent.getStringExtra("TAG_NAME"); Log.d("", "Value passed = " + name); TextView txtContact = (TextView) findViewById(R.id.name); txtContact.setText(name); String email = intent.getStringExtra("TAG_EMAIL"); Log.d("", "Value passed = " + email); TextView txtContact1 = (TextView) findViewById(R.id.email); txtContact1.setText(email); }
type: Answer
has comment: http://stackoverflow.com/comment/34633516
has comment: http://stackoverflow.com/comment/34633448

http://stackoverflow.com/q/22804296
tagged with: hive
type: Question
has answer: http://stackoverflow.com/a/22804467
tagged with: hadoop
downvote count: 0
answer count: 1
accepted answer: http://stackoverflow.com/a/22804467
tagged with: jvm
favorite count: 0
has body: Im having a small doubt. I have been reading about HIVE. And i have the below question in my mind Whether HIVE runs on java virtual machine (JVM) ? I have googled but i couldnot find any answer . Can any one explain me
type: AnsweredQuestion
score: 1
tagged with: java
has title: where does the hive runs and role of JVM
upvote count: 1

http://stackoverflow.com/q/22774099
has comment: http://stackoverflow.com/comment/34732559
tagged with: java
has answer: http://stackoverflow.com/a/75654981
has answer: http://stackoverflow.com/a/63145949
has answer: http://stackoverflow.com/a/41099907
type: Question
tagged with: cucumber
has answer: http://stackoverflow.com/a/77023288
score: 4
tagged with: cucumber-jvm
has body: I understand that @CucumberOptions is used to pass Cucumber options. However, due to the limitation that Java annotations only allow inline constants, it is quite cumbersome to use @CucumberOptions. So, is there a dynamic way to pass Cucumber options when using cucumber-junit? Thank you very much.
downvote count: 0
answer count: 7
favorite count: 0
has comment: http://stackoverflow.com/comment/34801303
has answer: http://stackoverflow.com/a/77220310
has answer: http://stackoverflow.com/a/33769299
has title: Pass cucumber options dynamically in cucumber-junit?
type: UnansweredQuestion
upvote count: 4
has answer: http://stackoverflow.com/a/53717905
tagged with: cucumber-junit

http://stackoverflow.com/q/22785129
has comment: http://stackoverflow.com/comment/34748747
type: Question
tagged with: javascript
tagged with: htmlunit
has title: JavaScript call using HtmlUnit
downvote count: 0
favorite count: 0
has comment: http://stackoverflow.com/comment/34746409
has comment: http://stackoverflow.com/comment/34749444
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/34749054
has body: I'm trying to get page content, that javascript function getWines() returns. The page I'm trying to get info from is http://hedonism.co.uk/wines/. So I'm using HtmlUnit and wrote the following code: final WebClient webClient = new WebClient( BrowserVersion.INTERNET_EXPLORER_10); webClient.getOptions().setThrowExceptionOnScriptError(false); webClient.getOptions().setJavaScriptEnabled(false); final HtmlPage page = webClient.getPage(url); String javaScriptCode = "getWines(1)"; ScriptResult result = page.executeJavaScript(javaScriptCode); Page page1 = result.getNewPage(); StringBuffer p = WebGet.getBuffPageContent(page1.getUrl().toString(), true); System.out.println(p.toString()); But it seems such approach isn't working. I receive the same page I had before function call with the same source code, so I'm not able to get info about, for example, wine name. Maybe I'm totally doing incorrect?
answer count: 0
score: 1
tagged with: java
upvote count: 1

http://stackoverflow.com/q/22675381
has answer: http://stackoverflow.com/a/22675408
type: Question
answer count: 2
downvote count: 0
has title: Java - Newline and forward slash delimiter
tagged with: regex
favorite count: 0
type: UnansweredQuestion
has body: mykeyboard.useDelimiter("[/\n]"); Is what I'm using for a delimiter. I am trying to input dates in the format of mm/dd/yyyy. However, the delimiter for new line will not work. For instance 11/12/1900 and hitting enter gives me this error: Exception in thread "main" java.util.InputMismatchException at java.util.Scanner.throwFor(Unknown Source) at java.util.Scanner.next(Unknown Source) at java.util.Scanner.nextInt(Unknown Source) at java.util.Scanner.nextInt(Unknown Source) Only when I input 11/12/1900/ does it actually work.
upvote count: 1
score: 1
tagged with: java
has answer: http://stackoverflow.com/a/22675418

http://stackoverflow.com/comment/34560265
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/22685245
has text: You are making a basic mistake here. Arrays in java start at index 0, so even thought you have a length of N, the maximum array index is N-1.

http://stackoverflow.com/comment/34650141
type: Comment
comment on: http://stackoverflow.com/a/22693816
type: AnswerComment
has text: Don't worry @JensG - I've been really busy with other stuff. I haven't forgotten you. I'll raise a ticket soon hopefully...
score: 0

http://stackoverflow.com/comment/34516553
comment on: http://stackoverflow.com/q/22660715
has text: [Probably a 1000 duplicates for this problem](https://www.google.co.in/search?q=referenced+from+a+static+context&oq=referenced+from+a+static+context&aqs=chrome..69i57j0l5.248j0j7&sourceid=chrome&espv=2&es_sm=93&ie=UTF-8). Have you searched?
score: 1
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/34589980
type: Comment
type: QuestionComment
has text: Don't forget to mark an answer as the solution if it solved your issue. Also it would probably be good to seek what is flipping the endianness of your data to begin with to avoid future issues.
comment on: http://stackoverflow.com/q/22699372
score: 0

http://stackoverflow.com/comment/34608008
type: Comment
type: QuestionComment
has text: See class StringBuilder
score: 1
comment on: http://stackoverflow.com/q/22711416

http://stackoverflow.com/comment/34573755
score: 0
comment on: http://stackoverflow.com/q/22692610
type: Comment
type: QuestionComment
has text: Can you post an [MCVE](http://stackoverflow.com/help/mcve) that demonstrates the problem? And are you really naming variables the same exact name as some classes? Why?

http://stackoverflow.com/q/22799661
tagged with: java
has title: for loop inside else if statement
has comment: http://stackoverflow.com/comment/34767956
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/22799751
has body: i'm feeling a little stupid about this because the answer HAS to be obvious, but i've been thinking about it for an hour now and i'm clueless. I am filling some LinkedLists with conditions (the order is important), but one of the conditions actually requires a for loop to see if it is true. This is the piece of code i'm talking about, and after the first "else if", i need a second "else if" but to verify is the statement is true, i need a for loop. Of course as it is the code doesn't work, so if someone could tell me what i need to do in order to get the desired result, i would be very grateful! thanks for (Region neut : visibleRegions){ if (neut.ownedByPlayer("neutral") &amp;&amp; getSubRegionsOwnedByPlayerName(neut.getSuperRegion(), opponentName).isEmpty()){ if ( getSubRegionsOwnedByPlayerName(neut.getSuperRegion(),myName).size()==neut.getSuperRegion().getSubRegions().size()-1 ){ priorityNeutralRegions_0.add(neut); } else if ( getSubRegionsOwnedByPlayerName(neut.getSuperRegion(), myName).size()==neut.getSuperRegion().getSubRegions().size()-2 ){ priorityNeutralRegions_1.add(neut); } else{ for (Region neig : neut.getNeighbors()){ if ( neig.getSuperRegion().ownedByPlayer(myName)){ priorityNeutralRegions_2.add(neut); break; } } } else if ( !getSubRegionsOwnedByPlayerName(neut.getSuperRegion(), myName).isEmpty()){ priorityNeutralRegions_3.add(neut); } else{ priorityNeutralRegions_4.add(neut); } } }
type: Question
has comment: http://stackoverflow.com/comment/34767372
has comment: http://stackoverflow.com/comment/34767244
score: 0
has comment: http://stackoverflow.com/comment/34767595
accepted answer: http://stackoverflow.com/a/22799751
has comment: http://stackoverflow.com/comment/34767353
answer count: 1
tagged with: if-statement
has comment: http://stackoverflow.com/comment/34767350

http://stackoverflow.com/q/22765373
has comment: http://stackoverflow.com/comment/34706214
has comment: http://stackoverflow.com/comment/34706521
has answer: http://stackoverflow.com/a/22765449
has comment: http://stackoverflow.com/comment/34705708
tagged with: android
has comment: http://stackoverflow.com/comment/34705597
has comment: http://stackoverflow.com/comment/34706148
has comment: http://stackoverflow.com/comment/34705691
accepted answer: http://stackoverflow.com/a/22765571
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/34706120
linked to: http://stackoverflow.com/q/7213168
has comment: http://stackoverflow.com/comment/34705623
has comment: http://stackoverflow.com/comment/34706328
tagged with: java
has comment: http://stackoverflow.com/comment/34706280
has title: Problems with URL get parameters
has body: I'm writing an Android application that will fetch content from Internet. The URL consists of some query parameters with String values. The problem is when I'm trying to use a string value that contains some spaces it doesn't work. But, others work fine. This is the code below that I use to get content with get method. URL url = new URL("http://www.example.com/fetch.php?title="+someStringValue); BufferedReader br = new BufferedReader(new InputStreamReader(url.openStream())); while((temp=br.readLine())!=null){ data+=temp; } The problem is I cannot use a spaced string for the variable someStringValue. I know that there are some encoding problems, but how can I resolve it? Also, what's the best way to read data data from a URL using GET method?
has comment: http://stackoverflow.com/comment/34706185
has comment: http://stackoverflow.com/comment/34707469
has answer: http://stackoverflow.com/a/22765651
type: Question
has comment: http://stackoverflow.com/comment/34705537
has comment: http://stackoverflow.com/comment/34705881
possible better answer: http://stackoverflow.com/a/22765651
has comment: http://stackoverflow.com/comment/34706346
has comment: http://stackoverflow.com/comment/34705603
score: 0
has comment: http://stackoverflow.com/comment/34706442
answer count: 3
has comment: http://stackoverflow.com/comment/34705959
has comment: http://stackoverflow.com/comment/34705922
has comment: http://stackoverflow.com/comment/34706391
has comment: http://stackoverflow.com/comment/34705722
has comment: http://stackoverflow.com/comment/34705686
has comment: http://stackoverflow.com/comment/34705538
has comment: http://stackoverflow.com/comment/34705911
has answer: http://stackoverflow.com/a/22765571

http://stackoverflow.com/comment/34716275
has text: i only started learning Java so that i could take part in an AI competition for game i like, however i am familiar with the "logic" of programming, since i used Matlab and Mathematica in the past, so i guess i'm not completely new to programming. I have already have a Bot that is currently in a really good position in the competition, but i still lose some games due to my bot crashing because it doesn't return the moves in due time (i think this is why it crashes). I don't know what is a thread in java but i'll do some research since it seems to be the solution to my problem. Anyway, thanks!
comment on: http://stackoverflow.com/q/22765265
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/34561062
comment on: http://stackoverflow.com/a/22685315
has text: using your solution, i am getting only this: 001.jpg
type: AnswerComment
score: 0
type: Comment

http://stackoverflow.com/comment/34764152
comment on: http://stackoverflow.com/q/22797980
score: 0
type: Comment
has text: Please show what you're sending as a name and pass as well. Also, what does conn() do?
type: QuestionComment

http://stackoverflow.com/a/22742069
has body: I got the following code from somewhere that I can't remember right now but it plays the music consequently: public static void play(ArrayList&lt;String&gt; files){ byte[] buffer = new byte[4096]; for (String filePath : files) { File file = new File(filePath); try { AudioInputStream is = AudioSystem.getAudioInputStream(file); AudioFormat format = is.getFormat(); SourceDataLine line = AudioSystem.getSourceDataLine(format); line.open(format); line.start(); while (is.available() &gt; 0) { int len = is.read(buffer); line.write(buffer, 0, len); } line.drain(); line.close(); } catch (Exception ex) { ex.printStackTrace(); } } } The reason this plays the files consequently and not all at the same time is because write blocks until the requested amount of data has been written. This applies even if the requested amount of data to write is greater than the data line's buffer size. Make sure to include drain() from the code above. drain() waits for the buffer to empty before it close()s.
type: AcceptedAnswer
downvote count: 0
type: Answer
accepted answer of: http://stackoverflow.com/q/22741988
score: 1
answers question: http://stackoverflow.com/q/22741988
upvote count: 1

http://stackoverflow.com/comment/34680400
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/22750818
score: 1
has text: Of course. The first step in these linked questions is obviously getting the formula-string pieces into an array. Solving is the easy(er) part.

http://stackoverflow.com/q/22718744
has answer: http://stackoverflow.com/a/22718904
tagged with: java
linked to: http://stackoverflow.com/q/25056607
has body: Before Java 8 when we split on empty string like String[] tokens = "abc".split(""); split mechanism would split in places marked with | |a|b|c| because empty space "" exists before and after each character. So as result it would generate at first this array ["", "a", "b", "c", ""] and later will remove trailing empty strings (because we didn't explicitly provide negative value to limit argument) so it will finally return ["", "a", "b", "c"] In Java 8 split mechanism seems to have changed. Now when we use "abc".split("") we will get ["a", "b", "c"] array instead of ["", "a", "b", "c"]. My first guess was that maybe now leading empty strings are also removed just like trailing empty strings. But this theory fails, since "abc".split("a") returns ["", "bc"], so leading empty string was not removed. Can someone explain what is going on here? How rules of split have changed in Java 8?
tagged with: split
downvote count: 4
upvote count: 120
has comment: http://stackoverflow.com/comment/56876959
has comment: http://stackoverflow.com/comment/49232927
has comment: http://stackoverflow.com/comment/56871381
has comment: http://stackoverflow.com/comment/56932964
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/27477312
tagged with: regex
linked to: http://stackoverflow.com/q/29972406
has comment: http://stackoverflow.com/comment/53684257
favorite count: 0
has comment: http://stackoverflow.com/comment/41612416
type: Question
has comment: http://stackoverflow.com/comment/53684368
score: 116
answer count: 3
has title: Why in Java 8 split sometimes removes empty strings at start of result array?
tagged with: java-8
has answer: http://stackoverflow.com/a/22718899
linked to: http://stackoverflow.com/q/22718096
has comment: http://stackoverflow.com/comment/41608462
has comment: http://stackoverflow.com/comment/43429768
possible better answer: http://stackoverflow.com/a/22718904
accepted answer: http://stackoverflow.com/a/27477312

http://stackoverflow.com/q/22711110
has title: Find shorthest path between 2 nodes no more ideas
has body: I have a graph represented as adjancy matrix and I want to find the shortest path between two nodes. The graph is weighted. I want to use BFS algorithm, I have tried but I ran out of ideas. Here is my code, if you could please help me . public class A { private static int[][] adjacency = new int [4][4]; static int n = 4; public static void main(String[] args) { for (int i=0;i&lt;n;i++) for (int j=0;j&lt;n;j++) adjacency[i][j] = 0; adjacency[0][1] = 2; adjacency[0][3] = 1; adjacency[1][0] = 2; adjacency[1][2] = 5; adjacency[2][1] = 5; adjacency[2][3] = 1; adjacency[2][4] = 2; adjacency[3][0] = 1; adjacency[3][2] = 1; adjacency[4][2] = 2; } public List&lt;Integer&gt; getNeighbors(int node, int[][] a) { List&lt;Integer&gt; list = new ArrayList&lt;Integer&gt;(); for(int i=0;i&lt;n;i++) if (a[node][i] != 0) list.add(i); return list; } public List&lt;Queue&lt;Integer&gt;&gt; findPath(int start, int end, int[][] a) { List&lt;Queue&lt;Integer&gt;&gt; paths = new ArrayList&lt;Queue&lt;Integer&gt;&gt;(); Queue&lt;Integer&gt; toVisit = new LinkedList&lt;Integer&gt;(); Queue&lt;Integer&gt; visited = new LinkedList&lt;Integer&gt;(); toVisit.add(start); while(!toVisit.isEmpty()) { int node = toVisit.remove(); visited.add(node); List&lt;Integer&gt; neighbors = new ArrayList&lt;Integer&gt;(); neighbors = this.getNeighbors(node,a); } return paths; } } So basically what I was thinking was to find all the paths between the 2 given nodes, and store them in a list of queues, and then check which path has the shortest distance. Can you please help me.
tagged with: java
has answer: http://stackoverflow.com/a/22711192
type: Question
answer count: 2
has comment: http://stackoverflow.com/comment/34608155
has comment: http://stackoverflow.com/comment/34607678
has answer: http://stackoverflow.com/a/22711271
has comment: http://stackoverflow.com/comment/34608411
score: 0
has comment: http://stackoverflow.com/comment/34607970
has comment: http://stackoverflow.com/comment/34609339
has comment: http://stackoverflow.com/comment/34607630
has comment: http://stackoverflow.com/comment/34607536
has comment: http://stackoverflow.com/comment/34608519
has comment: http://stackoverflow.com/comment/34607868
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/34607516

http://stackoverflow.com/a/22734193
answers question: http://stackoverflow.com/q/22733570
type: Answer
has comment: http://stackoverflow.com/comment/34663619
score: 0
has body: I think,you should call "adapter.notifyDataSetChanged();" This method can dynamically modify the ListView data. private List&lt;HashMap&lt;String, String&gt;&gt; contactList; private SimpleAdapter adapter; public void onActivityCreated(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { contactList = new ArrayList&lt;HashMap&lt;String, String&gt;&gt;(); adapter = new SimpleAdapter(getActivity(), contactList, R.layout.list_item, new String[] { TAG_ID, TAG_NAME }, new int[] { R.id.pid, R.id.episode }); ListView lv = getListView(); lv.setAdapter(adapter); new GetContacts().execute(); super.onActivityCreated(savedInstanceState); } public class GetContacts extends AsyncTask&lt;Void, Void, Void&gt; { @Override protected void onPreExecute() { } @Override protected Void doInBackground(Void... arg0) { //Your code... return null; } @Override protected void onPostExecute(Void result) { super.onPostExecute(result); adapter.notifyDataSetChanged(); } }

selenium
tags question: http://stackoverflow.com/q/22703159
tags question: http://stackoverflow.com/q/22760828
tags question: http://stackoverflow.com/q/22683166
tags question: http://stackoverflow.com/q/22665939
tags question: http://stackoverflow.com/q/22686178
tags question: http://stackoverflow.com/q/22776355
tags question: http://stackoverflow.com/q/22679454
tags question: http://stackoverflow.com/q/22656615
tags question: http://stackoverflow.com/q/22699259
tags question: http://stackoverflow.com/q/22800382
tags question: http://stackoverflow.com/q/22650409
tags question: http://stackoverflow.com/q/22691402
tags question: http://stackoverflow.com/q/22778004
tags question: http://stackoverflow.com/q/22715593
tags question: http://stackoverflow.com/q/22711441
tags question: http://stackoverflow.com/q/22707284
tag name: selenium
tags question: http://stackoverflow.com/q/22756789
tags question: http://stackoverflow.com/q/22762401
tags question: http://stackoverflow.com/q/22718219
tags question: http://stackoverflow.com/q/22651007
tags question: http://stackoverflow.com/q/22711213
tags question: http://stackoverflow.com/q/22657736
tags question: http://stackoverflow.com/q/22743026
tags question: http://stackoverflow.com/q/22767591
tags question: http://stackoverflow.com/q/22691196
tags question: http://stackoverflow.com/q/22677801
tags question: http://stackoverflow.com/q/22712378
tags question: http://stackoverflow.com/q/22688127
tags question: http://stackoverflow.com/q/22649423
tags question: http://stackoverflow.com/q/22701179
tags question: http://stackoverflow.com/q/22787840
type: Tag
tags question: http://stackoverflow.com/q/22806115
tags question: http://stackoverflow.com/q/22648384
tags question: http://stackoverflow.com/q/22729341
tags question: http://stackoverflow.com/q/22691774
tags question: http://stackoverflow.com/q/22707732

http://stackoverflow.com/a/22692641
downvote count: 1
has body: FragmentNode and Attribs are not a types, its a variables, you can't specify variables as types to HashMap. You could do this instead: private HashMap&lt;String, List&lt;HashMap&lt;String, String&gt;&gt;&gt; FragmentNode; Or you could create a class that has Attribs HashMap just like: public class Attribs { private HashMap&lt;String, String&gt; Attribs; } Then : private HashMap&lt;String, List&lt;Attribs&gt;&gt; FragmentNode;
type: Answer
answers question: http://stackoverflow.com/q/22692610
upvote count: 2
has comment: http://stackoverflow.com/comment/34576609
score: 1

http://stackoverflow.com/a/22675855
has comment: http://stackoverflow.com/comment/34544402
answers question: http://stackoverflow.com/q/22675496
score: 0
type: Answer
has body: There is no "other solution". If you put || then both errors will be added if only one field is empty. If you put &amp;&amp; then both errors will be added when both fields are emtpy, but if only one is empty then nothing's gonna be added (which is also not what you want). Only solution is what peter.petrov suggested

http://stackoverflow.com/q/22801764
tagged with: swing
has body: When I run my program, it only shows a few lines, and then it shows gray under it. Can someone explain to me why this happens? I wanted the grid layout to have 8 rows, which should include the labels and text boxes. I am not sure why only a few of them appear. public class Application extends JFrame { private JPanel panel; private JLabel label1, label2, label3, label4, label5, label6, label7, label8; private JTextField text1, text2, text3, text4, text5, text6, text7, text8; public Application() { JFrame gui = new JFrame(); gui.setLayout(new GridLayout(8, 2)); gui.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); gui.setTitle("Vacation Expenses"); gui.setSize(500, 500); panel = new JPanel(); gui.add(panel); label1 = new JLabel("Number of days on the trip"); label2 = new JLabel("Amount of airfare"); label3 = new JLabel("Amount of car rental fees"); label4 = new JLabel( "Number of miles driven, if a private vehicle was used"); label5 = new JLabel("Amount of parking fees, if any"); label6 = new JLabel("Amount of taxi charges, if any"); label7 = new JLabel("Conference or seminar registration fees, if any"); label8 = new JLabel("Lodging charges, per night"); text1 = new JTextField("0", 10); text2 = new JTextField("0", 10); text3 = new JTextField("0", 10); text4 = new JTextField("0", 10); text5 = new JTextField("0", 10); text6 = new JTextField("0", 10); text7 = new JTextField("0", 10); text8 = new JTextField("0", 10); panel.add(label1); panel.add(text1); panel.add(label2); panel.add(text2); panel.add(label3); panel.add(text3); panel.add(label4); panel.add(text4); panel.add(label5); panel.add(text5); // JButton button = new JButton("Button"); // panel.add(button); gui.setVisible(true); } public static void main(String[] args) { new Application(); } }
type: Question
has title: My GUI is not showing up fully
has answer: http://stackoverflow.com/a/22802134
tagged with: java
score: 0
tagged with: layout
tagged with: user-interface
answer count: 1
accepted answer: http://stackoverflow.com/a/22802134
type: AnsweredQuestion
tagged with: jframe

http://stackoverflow.com/q/22676472
tagged with: tomcat
favorite count: 0
has answer: http://stackoverflow.com/a/22710810
type: UnansweredQuestion
has body: I think my problem is simple, but I'm not really experienced in this domain. I'm trying to build a JSP manually without any environment, using TOMCAT. So I used this structure for my page: my-webapp |-- WEB-INF | |-- lib | | |-- ajar.jar | | |-- bjar.jar | | `-- zjar.jar |-- b.swf `-- index.jsp The libraries in the WEB-INF/lib are copied from BusinessObjects location java/lib, and the code in the JSP page: &lt;%@ page import="com.crystaldecisions.sdk.exception.SDKException" %&gt; &lt;%@ page import="com.crystaldecisions.sdk.framework.CrystalEnterprise" %&gt; &lt;%@ page import="com.crystaldecisions.sdk.framework.IEnterpriseSession" %&gt; &lt;%@ page import="com.crystaldecisions.sdk.framework.ISessionMgr" %&gt; &lt;%@ page import="com.crystaldecisions.sdk.occa.infostore.IInfoStore" %&gt; &lt;%@ page import="com.crystaldecisions.sdk.occa.security.ILogonTokenMgr"%&gt; &lt;%! String defaultToken =null; %&gt; &lt;% try { String systemName = "XXXXX"; String userName = "XXXXX"; String password = "XXXXXX"; String authType = "LDAP"; IEnterpriseSession enterpriseSession=null; ISessionMgr enterpriseSessionMgr = CrystalEnterprise.getSessionMgr(); enterpriseSession = enterpriseSessionMgr.logon(userName, password, systemName, authType); ILogonTokenMgr logonTokenMgr = enterpriseSession.getLogonTokenMgr(); defaultToken = logonTokenMgr.getDefaultToken(); } catch(Exception e) { out.println(e); } %&gt; // THEN THE HTML PAGE WITH defaultToken assigned When running the page, I get this error: org.apache.jasper.JasperException: An exception occurred processing JSP page /index.jsp at line 27 24: 25: IEnterpriseSession enterpriseSession=null; 26: 27: ISessionMgr enterpriseSessionMgr = CrystalEnterprise.getSessionMgr(); 28: 29: enterpriseSession = enterpriseSessionMgr.logon(userName, password, systemName, authType); 30: root cause java.lang.NoClassDefFoundError: com/businessobjects/sdk/aspect/LoggingContextAspect com.crystaldecisions.sdk.framework.CrystalEnterprise.getSessionMgr(CrystalEnte…
downvote count: 0
score: 1
linked to: http://stackoverflow.com/q/1300780
type: Question
tagged with: java
has comment: http://stackoverflow.com/comment/34564626
tagged with: business-objects-sdk
has comment: http://stackoverflow.com/comment/34573721
upvote count: 1
answer count: 1
has title: Building an application using BO SDK
tagged with: jsp

http://stackoverflow.com/comment/34676732
has text: @DavidWallace I live across the street from Stackoverflow's servers.
type: AnswerComment
comment on: http://stackoverflow.com/a/22749557
type: Comment
score: 1

http://stackoverflow.com/comment/34789866
comment on: http://stackoverflow.com/q/22792568
score: 0
type: QuestionComment
type: Comment
has text: @ChuongPham: The issue is that someone is then trying to compile the file outside of Eclipse and running into an "unmappable character" error. Ideally, Eclipse would give us an error so we could fix the problem before shipping the file to someone else.

game-loop
tag name: game-loop
type: Tag
tags question: http://stackoverflow.com/q/22706023

http://stackoverflow.com/a/22654297
score: 0
has body: In the Field documentation, they list a set of Field subclasses that it pays to get to know: Most users should use one of the sugar subclasses: IntField, LongField, FloatField, DoubleField, ByteDocValuesField, ShortDocValuesField, IntDocValuesField, LongDocValuesField, PackedLongDocValuesField, FloatDocValuesField, DoubleDocValuesField, SortedBytesDocValuesField, DerefBytesDocValuesField, StraightBytesDocValuesField, StringField, TextField, StoredField. In particular, you'll find TextField and StringField useful, for the fields you have listed. The Migration Guide has more information on changes in 4.0.
answers question: http://stackoverflow.com/q/22648993
type: Answer

http://stackoverflow.com/comment/34667195
comment on: http://stackoverflow.com/q/22744334
has text: When I run this example I expect that both event handlers are called. Method runDemoPrimaryReaction() and runDemoSecondaryReaction(). But they are not. Only one of them is called. So I exprect that when I click on button "Execute Demo 1" in console I will see in console two rows: 'useless way - primary reaction useless way - secondary reaction' or for second demo: 'not working way - No1 not working way - No2'
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/q/22766621
answer count: 0
tagged with: jackson
has body: I am sending the following JSON data to an RO Server : var basketItem= { x:x1, y:y1 }; var basketItemByStop= { sessionId : { id : "sessionId", memberType : "property", value : '3432345ADC' }, customerId : { id : "customerId", memberType: "property", value : '123456' }, email : { id : "email", memberType : "property", value : "x.y@x.net" }, basketItem : { "id" : "basketItem", "memberType" : "property", "format" : "string", "extensions" : {"x-isis-format" : "string"}, "value" : basketItem } }; In the action class I tried retrieving the basketItem as a string, but I am getting the following error: "invalidReason":"Failed to parse representation as value of type 'String'"},"x-ro-invalidReason":"Basket Item is mandatory"} My action method defintion @Bookmarkable @ActionSemantics(Of.IDEMPOTENT) @MemberOrder(sequence = "1") @Named("View Basket") @PublishedAction public final ShoppingBasket getBasket( @Named("Session ID") final String sessionID, @Named("Customer ID") final String customerID, @Named("Email") final String email, @Named("Basket Item") final String JSONData) { } The main problem is the JSONData parameter is coming across as [object object] in the method and using toString() does not convert it to a normal string. I need it as a normal human readable json and pass it to my Jackson JSON parser for further processing. Any ideas anyone ... Thanks.
tagged with: angularjs
type: Question
has comment: http://stackoverflow.com/comment/34707771
score: 0
has title: AngularJS JSON Isis - Can't retrieved JSON data in Restful Object server as String
has comment: http://stackoverflow.com/comment/34764002
tagged with: isis
tagged with: java
tagged with: http://stackoverflow.com/tag/json
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/34772516

http://stackoverflow.com/comment/34722931
type: Comment
comment on: http://stackoverflow.com/q/22774660
has text: nvm got it new to the site again thanks
score: 0
type: QuestionComment

http://stackoverflow.com/a/22706355
type: Answer
has comment: http://stackoverflow.com/comment/34602798
upvote count: 1
score: 1
downvote count: 0
answers question: http://stackoverflow.com/q/22706136
has body: file.createNewFile(); Remove that. It is redundant. new FileOutputStream() will do that anyway. You're just adding processing here, and disk processing at that. fis = new FileInputStream(drives[i].getAbsolutePath() + files[l].getName()); fos = new FileOutputStream(file); Now add: int count; byte[] buffer = new byte[8192]; // or much more if you can afford the space while ((count = fis.read(buffer)) &gt; 0) { fos.write(buffer, 0, count); } Back to your code: while (true) { fread = fis.read(); if (fread == -1) { break; } fos.write(fread); } Remove all that. Reading a byte at a time is as inefficient as it gets.

http://stackoverflow.com/q/22720867
has answer: http://stackoverflow.com/a/22720951
type: Question
tagged with: java
tagged with: java-web-start
has title: Porting Java classes to the web whilst maintaining all functionality
score: 0
answer count: 1
favorite count: 0
has comment: http://stackoverflow.com/comment/34625744
type: UnansweredQuestion
tagged with: web-applications
upvote count: 1
has body: So I have written a few Java classes that take input via the main method as passed arguments and then print to the screen. Is there any way I can 'port' this to something I can include in the HTML of a web document? There are multiple classes that work together so I would need some way of including all of these and forcing one specific file to run. For example, if I have Class1.java and Class2.java I would want to run Class1.java but somehow the second class must be included as the first relies on it. I understand that this is probably not as simple as I'm making it, for example there may be complications with changing stdout to use the application screen etc, but anything that can get me started would be helpful. Thanks!
downvote count: 1

lombok
type: Tag
tag name: lombok
tags question: http://stackoverflow.com/q/22743765

http://stackoverflow.com/comment/34800533
score: 0
comment on: http://stackoverflow.com/q/22804085
type: Comment
type: QuestionComment
has text: Anybody please help me what should i change in my request dispatcher url so tht it goes to next page.or do i need to upload any extra files,as this is first time i m loading a new web application

http://stackoverflow.com/comment/34688678
comment on: http://stackoverflow.com/q/22755086
has text: Because there is nothing to unbox.
score: 0
type: QuestionComment
type: Comment

http://stackoverflow.com/comment/34584788
comment on: http://stackoverflow.com/a/22698146
has text: My wild guess (since the question hardly provides any hints) is that the interface is supposed to be used like: `MyInterface ref = ...; ref.getAbsoluteFile(); ref.toURL(); ref.myMethod(); ...`. But I may be wrong; anyway, you have my upvote.
type: AnswerComment
type: Comment
score: 0

http://stackoverflow.com/comment/34657813
score: 0
comment on: http://stackoverflow.com/a/22733732
has text: @user3476140, not sure what you are talking about. This question is about highlighting text, not replacing text. I gave you a link to read, I can't explain the concept any better.
type: AnswerComment
type: Comment

http://stackoverflow.com/comment/34500402
has text: Thank you for your help! Program is crashing now when I run it but I get no error message. Please see my new code above! Thank you
comment on: http://stackoverflow.com/a/22649207
score: 0
type: AnswerComment
type: Comment

http://stackoverflow.com/q/22727398
answer count: 1
has title: Logger is not working in SpringMVC
has comment: http://stackoverflow.com/comment/34637343
has comment: http://stackoverflow.com/comment/34637591
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/34637389
tagged with: spring
tagged with: logging
tagged with: java
type: Question
has answer: http://stackoverflow.com/a/22729005
has body: I have declared Logger in my class, but I cann't see its output when I run my code on Tomcat - Eclipse. import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; public class TestClassDao implements TestDao{ protected final Log logger = LogFactory.getLog(getClass()); public void deleteData(){ //Do Operation logger.info("Deleted rows affected: " + result); } Maven: commons-logging commons-logging 1.1.1 When I run the code on Eclipse Kelper using Tomcat Server 7, I am not able to see any output of the logger function. Can you please suggest what I am missing here?
score: 0

http://stackoverflow.com/a/22652054
type: Answer
has comment: http://stackoverflow.com/comment/34502636
has comment: http://stackoverflow.com/comment/34502958
answers question: http://stackoverflow.com/q/22651670
has comment: http://stackoverflow.com/comment/34502456
accepted answer of: http://stackoverflow.com/q/22651670
has comment: http://stackoverflow.com/comment/34502293
has comment: http://stackoverflow.com/comment/34502539
has comment: http://stackoverflow.com/comment/34502797
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/34503035
has comment: http://stackoverflow.com/comment/34502854
score: 0
has body: &lt;% ArrayList&lt;String&gt; list1 = (ArrayList&lt;String&gt;)request.getAttribute("res1"); %&gt; &lt;select name="GName" &gt; &lt;% for(String list:list1) { %&gt; &lt;option&gt;&lt;%=list%&gt;&lt;/option&gt; &lt;% } %&gt; &lt;/select&gt; Use this in your JSP. Servlet Code ArrayList&lt;String&gt; list = new ArrayList&lt;String&gt;(); out.println("HI GROUP MEMBER"); String query="Select GNAME from tbGroup"; ps = con.prepareStatement(query); rs=ps.executeQuery(); while(rs.next()){ list.add(rs.getString("GNAME")); } request.setAttribute("res1",list); RequestDispatcher rd= context.getRequestDispatcher("GroupLoginScreen.jsp"); rd.forward(request, response);
has comment: http://stackoverflow.com/comment/34502623

http://stackoverflow.com/a/42887180
upvote count: 1
has body: Why unwanted assignment is occuring? The keyboard input character(s) is stored in input buffer after ENTER is pressed. ENTER includes line feed '\n' in the input character. Decimal/integer value of line feed '\n' is 10. System.in.read() reads only first one character from the input character(s), the character is casted into integer and return it. And that character will be excluded from the input buffer. The rest of the characters are still pending in the input buffer until it is read by System.in.read() in the same manner stated above. int inputchar1, inputchar2, inputchar3; System.out.print("input: ");// input: 43 // The line feed '\n' is generated when ENTER is pressed. // '4', '3' and '\n' are in the input buffer. inputchar1 = System.in.read(); // '4' is read and returns 52 (corresponding integer value) // '3' and '\n' is in the input buffer. inputchar2 = System.in.read(); // '3' is read and returns 51 // '\n' is pending in the input buffer. inputchar3 = System.in.read(); // '\n' is read and returns 10 // no more input character in the input buffer. System.out.println("inp1 =" + inputchar1); System.out.println("inp1 =" + inputchar2); System.out.println("inp1 =" + inputchar3); /* * Refer to ASCII table for char to decimal conversion. * Although java Char is 16-bit unicode ASCII is still applicable. */ How to avoid unwanted assignment? Keep reading the content of input buffer until it gets depleted. int x, y, avoid; System.out.println("Enter x: "); x = System.in.read(); // Reading all the characters after the first character so that // no character stays pending in the input buffer. do { avoid = System.in.read(); } while(avoid != '\n'); System.out.println("Enter y: "); // New input buffer is created. y = System.in.read(); do { avoid = System.in.read(); } while(avoid != '\n'); Reference: "Java: A beginner's guide 6e" - Herbert Schildt
has comment: http://stackoverflow.com/comment/72880049
downvote count: 0
type: Answer
answers question: http://stackoverflow.com/q/22708071
score: 1

http://stackoverflow.com/comment/39049126
score: 0
comment on: http://stackoverflow.com/q/22715751
has text: @I.K. I was exploring drools and guvnor at that time, thanks for the "decision tables" pointer...later we used the same...Thanks!
type: Comment
type: QuestionComment

http://stackoverflow.com/a/22665998
downvote count: 0
score: 1
answers question: http://stackoverflow.com/q/22653640
accepted answer of: http://stackoverflow.com/q/22653640
upvote count: 1
type: AcceptedAnswer
type: Answer
has body: By default phpseclib uses sha1 as the hash. You probably need to do $rsa-&gt;setHash('md5').

http://stackoverflow.com/q/22669602
type: AnsweredQuestion
possible better answer: http://stackoverflow.com/a/22669837
has answer: http://stackoverflow.com/a/22682646
type: Question
tagged with: java
score: 0
accepted answer: http://stackoverflow.com/a/22682646
answer count: 2
has comment: http://stackoverflow.com/comment/34536975
tagged with: spring-scheduled
has comment: http://stackoverflow.com/comment/34543511
has body: I have created a bean of a class with default (Singleton) scope. Within the class I have a method which is scheduled to be run every hour. public class TaskService implements InitializingBean { @Scheduled(cron="0 0 */1 * * ?") public void hourlyReportTask() { ... code here ... } public void performAllTasks() { hourlyReportTask(); ... ... } } My application config looks something like this, &lt;bean id="reportService" class="com.tasks.TaskService" /&gt; I am assuming the Thread running the scheduled task will be using the same TaskService bean since its created in singleton scope. What shall happen if the application is currently running hourlyReportTask() and the Spring container kicks off a background scheduled thread to run hourlyReportTask() at the same time. Will it wait for the to get access of the TaskService instance?
has comment: http://stackoverflow.com/comment/34543573
tagged with: spring-annotations
has answer: http://stackoverflow.com/a/22669837
tagged with: spring
has title: Spring @Scheduled annotation and Singleton class

http://stackoverflow.com/comment/34700376
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/22752555
has text: Because when I played with it, gray and rgb usage was very trivial so I would recommend to use them.

http://stackoverflow.com/a/22699476
type: AcceptedAnswer
downvote count: 0
has body: With new double[4][5][6] what you have is 20 arrays of length 6. They are addressable as: x[0][0] // array of length 6 x[0][1] // another array of length 6 here x[0][2] // etc... x[0][3] x[0][4] x[1][0] x[1][1] x[1][2] x[1][3] x[1][4] x[2][0] x[2][1] x[2][2] x[2][3] x[2][4] x[3][0] x[3][1] x[3][2] x[3][3] x[3][4]
accepted answer of: http://stackoverflow.com/q/22699399
type: Answer
answers question: http://stackoverflow.com/q/22699399
upvote count: 1
score: 1

http://stackoverflow.com/comment/34653280
has text: Please, mark my answer as correct so that we can close this question. Thanks
score: 0
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/22736414

http://stackoverflow.com/comment/34712010
type: QuestionComment
has text: Please see the reviewed code. I'll be honest, I have no idea what I am doing with it - it was something I looked up online.
score: 0
comment on: http://stackoverflow.com/q/22769023
type: Comment

http://stackoverflow.com/comment/34780177
type: Comment
has text: See my edits. None of the errors are because of Java running out of heap space.
comment on: http://stackoverflow.com/a/22805787
type: AnswerComment
score: 0

http://stackoverflow.com/q/22786575
has answer: http://stackoverflow.com/a/22788385
tagged with: android
has body: I want to change my avatar when I click on my imageView. Code : ivAvatar.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { final CharSequence[] items = {"Prendre une photo", "Choisir une image", "Annuler"}; AlertDialog.Builder alertDialogBuilder = new AlertDialog.Builder( getActivity()); // set title alertDialogBuilder.setTitle("Avatar :"); // set dialog message alertDialogBuilder.setCancelable(false).setItems(items, new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialog, int item) { if (item == 0) { ContentValues values = new ContentValues(); values.put(MediaStore.Images.Media.TITLE, ""); mCapturedImageURI = getActivity() .getContentResolver() .insert(MediaStore.Images.Media.EXTERNAL_CONTENT_URI, values); Intent intent = new Intent( MediaStore.ACTION_IMAGE_CAPTURE); intent.putExtra(MediaStore.EXTRA_OUTPUT, mCapturedImageURI); intent.putExtra("crop", "true"); intent.putExtra("aspectX", 170); intent.putExtra("aspectY", 170); intent.putExtra("outputX", 5000); intent.putExtra("outputY", 5000); startActivityForResult(Intent .createChooser(intent, "Appareil photo"), CAPTURE_PICTURE); } if (item == 1) { Intent intent = new Intent( Intent.ACTION_PICK, android.provider.MediaStore.Images.Media.INTERNAL_CONTENT_URI); intent.setType("image/*"); intent.putExtra("crop", "true"); intent.putExtra("aspectX", 170); intent.putExtra("aspectY", 170); intent.putExtra("outputX", 5000); intent.putExtra("outputY", 5000); startActivityForResult(Intent .createChooser(intent, "Choisir une application"), SELECT_PICTURE); } if (item == 2) { dialog.cancel(); } } }); // create alert dialog AlertDialog alertDialog = alertDialogBuilder.create(); // afficher alertDialogBuilder.show(); } }); public void onActivityResult(int requestCode, int resultCode, Intent data) { Log.i("TAG", data + " : data"); Log.i("TAG", data.getData() + " : data.getData()"); Log.i("TAG", getActivity().getApplicationContext() + " : context"); if (resultCode…
type: AnsweredQuestion
tagged with: java
accepted answer: http://stackoverflow.com/a/22788385
type: Question
has title: intent.getData() is null when I want change an imageView
score: 0
answer count: 1

http://stackoverflow.com/q/22700748
tagged with: string
has body: I have a string representing a 32 character long barcode made up of "|" and ":". I want to check the validity of any given string to make sure it is a barcode. One of the tests is to check that the only symbols it contains are the two mentioned above. How can I check that? I first I was using a delimiter, but I don't think that is the right way to go about this. public boolean isValidBarCode (String barCode) { barCode.useDelimiter ("[|:]"); if (barCode.length() == 32) { return true; } else { return false; } I know there are other things I need to check in order to validate it as a barcode, but I'm asking only for the purposes of checking the symbols within the given string. I'm a beginner programmer, so the help is greatly appreciated!
has title: Checking if a string only contains certain characters
has comment: http://stackoverflow.com/comment/34589291
has answer: http://stackoverflow.com/a/22700827
type: Question
tagged with: symbols
tagged with: delimiter
score: 0
answer count: 3
has answer: http://stackoverflow.com/a/22700883
tagged with: java
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/22700829

http://stackoverflow.com/comment/34604733
has text: The WrapLayout did not seem to work, but thank you for the suggestion
comment on: http://stackoverflow.com/a/22695033
type: AnswerComment
score: 0
type: Comment

http://stackoverflow.com/q/22650465
favorite count: 0
has title: Is it possible to call a non-synchronized method as synchronized?
has comment: http://stackoverflow.com/comment/34499272
type: UnansweredQuestion
tagged with: multithreading
has comment: http://stackoverflow.com/comment/34499985
has comment: http://stackoverflow.com/comment/34499216
has comment: http://stackoverflow.com/comment/34528936
has comment: http://stackoverflow.com/comment/34499579
has comment: http://stackoverflow.com/comment/34499300
has comment: http://stackoverflow.com/comment/34500811
has comment: http://stackoverflow.com/comment/34499776
tagged with: java
has body: I have a class ClassA that has a public void doSomething() method. This ClassA is widely used in different applications; some require synchronized and others do not. It is also the case that I do not want the (tiny, but non-zero) performance hit associated with calling a synchronized method when I do not need this. Suppose that ClassB will call doSomething() and requires that this is synchronized, yet ClassC does not require this. What are the ways that I can achieve this in the design of my program? Is it sufficient to have the method in ClassB: private synchronized void doSomething() { this.classAInstance.doSomething(); } thus avoiding the need to specify ClassC's doSomething() as synchronized?
has comment: http://stackoverflow.com/comment/34500392
type: Question
has comment: http://stackoverflow.com/comment/34499941
has comment: http://stackoverflow.com/comment/34501533
has comment: http://stackoverflow.com/comment/34499261
has comment: http://stackoverflow.com/comment/34499915
has comment: http://stackoverflow.com/comment/34499326
has answer: http://stackoverflow.com/a/22650589
has comment: http://stackoverflow.com/comment/34501757
tagged with: synchronized
upvote count: 2
has comment: http://stackoverflow.com/comment/34499392
score: 0
has comment: http://stackoverflow.com/comment/34499973
has comment: http://stackoverflow.com/comment/34499286
answer count: 2
downvote count: 2
has comment: http://stackoverflow.com/comment/34502321
tagged with: runnable
has answer: http://stackoverflow.com/a/22650733
has comment: http://stackoverflow.com/comment/34499953
linked to: http://stackoverflow.com/q/355089

http://stackoverflow.com/comment/34605491
has text: Would that be like this? (Edited OP) I have tried that as well, and nothing happens again
comment on: http://stackoverflow.com/a/22709914
score: 0
type: AnswerComment
type: Comment

http://stackoverflow.com/q/22686123
has title: MultiThreaded INSERTs performance
has comment: http://stackoverflow.com/comment/34561713
downvote count: 0
favorite count: 0
tagged with: querydsl
score: 2
answer count: 0
upvote count: 2
type: UnansweredQuestion
has body: Is there any advantage in doing parallel multithreaded INSERTs (Java + QueryDSL) on n different tables (Oracle 11g) over using the sequential approach? (INSERT into table1, .. , INSERT into tableN) (My case is an ETL process executing multiple bulk inserts in different tables)
type: Question
tagged with: java
tagged with: database

http://stackoverflow.com/a/73351649
score: 2
downvote count: 0
upvote count: 2
answers question: http://stackoverflow.com/q/22768037
type: Answer
has body: My solution was cleaning all dependency and reinstall it again using this line mvn clean install then try to deploy the app again

http://stackoverflow.com/comment/76825373
comment on: http://stackoverflow.com/a/22732625
score: 0
has text: Correct, do not use 'synchronized(this)', this will put lock on main object and will block main thread as well. Try to put lock on dummy object and i'll work as fine.
type: AnswerComment
type: Comment

http://stackoverflow.com/q/22662566
has title: Using full words as variables for login system
accepted answer: http://stackoverflow.com/a/22662709
favorite count: 0
has comment: http://stackoverflow.com/comment/34520029
has comment: http://stackoverflow.com/comment/34520128
tagged with: integer
type: AnsweredQuestion
downvote count: 2
has body: I'm creating a login system that currently uses hard coded integers for a UserID, password and Student number which means they are all numbers. What would I use to be able to make the integers (the UserID and password) words instead of numbers? This is how it currently looks; public static void main(String[] args) { final int UserID = 5555; final int Password = 1234; final int StudentNumber = 22334455;
possible better answer: http://stackoverflow.com/a/22662628
has answer: http://stackoverflow.com/a/22662709
has answer: http://stackoverflow.com/a/22662628
type: Question
score: -2
tagged with: java
has comment: http://stackoverflow.com/comment/34520048
has comment: http://stackoverflow.com/comment/34520198
answer count: 2
has comment: http://stackoverflow.com/comment/34520037
has comment: http://stackoverflow.com/comment/34520113
upvote count: 0

http://stackoverflow.com/q/22730316
tagged with: java
answer count: 3
tagged with: substring
has comment: http://stackoverflow.com/comment/34642479
has answer: http://stackoverflow.com/a/22730421
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/34642458
tagged with: string
score: 7
has body: This is a Java string problem. I use the substring(beginindex) to obtain a substring. Considering String s="hello", the length of this string is 5. However when I use s.substring(5) or s.substring(5,5) the compiler didn't give me an error. The index of the string should be from 0 to length-1. Why it doesn't apply to my case? I think that s.substring(5) should give me an error but it doesn't.
favorite count: 0
has title: String substring index could be the length of string
upvote count: 8
type: Question
has answer: http://stackoverflow.com/a/22730336
has answer: http://stackoverflow.com/a/22730376
downvote count: 1

http://stackoverflow.com/a/22698893
score: 0
has comment: http://stackoverflow.com/comment/34633596
type: Answer
has body: If you are using a decend IDE, it could resolve your dependencies for you. If it can't import a class, you can ask it to look up the class in the Maven repository. Then you can choose which dependency to add to your pom.xml.
answers question: http://stackoverflow.com/q/22698789

http://stackoverflow.com/comment/34553862
score: 0
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/22681474
has text: in your case no because your class cannot be extended

http://stackoverflow.com/comment/34606551
has text: maybe it's about permission issue.. try to write at your Document folder, it should have no problem..
type: QuestionComment
score: 3
comment on: http://stackoverflow.com/q/22710518
type: Comment

http://stackoverflow.com/a/22762048
downvote count: 0
type: Answer
has comment: http://stackoverflow.com/comment/34699500
has comment: http://stackoverflow.com/comment/34700067
accepted answer of: http://stackoverflow.com/q/22761936
has body: You have declared your result String array but did not initialize it. Try this: @SuppressWarnings("null") public String[] request(String requesturl, String user, String password) { String result[] = new String[ &lt;Insert value&gt; ]; // Code... } Let me explain further to avoid downvotes. This is why I think this: You first initialize the array to null, so it can't be used yet. Further down the line you have this statement String results = "" but your array is still null. Then you do this result[0] = "", oh dear. That is where the nullPointerException comes from, I think. You have to initialize your array and you are right if you say that you need to know the size of your array up front. Use the maximum value you expect for the size or, better yet, use a list and not an array. Here is a nice source for the list datastructure: List in Android Development. There is also a nice discussion about list versus arrays here, it is for C# but the principles remain more or less the same.
has comment: http://stackoverflow.com/comment/34699941
has comment: http://stackoverflow.com/comment/34700044
score: 4
upvote count: 4
answers question: http://stackoverflow.com/q/22761936
has comment: http://stackoverflow.com/comment/34699521
has comment: http://stackoverflow.com/comment/34700033
type: AcceptedAnswer

http://stackoverflow.com/q/22708339
has body: I am creating a custom XML document. But I do not want the XML to be available as a file but I want it to be available in the system clipboard as a string so that I can paste manually to an already existing file. I am using the transformer to write the XML as : TransformerFactory transformerFactory = TransformerFactory.newInstance(); Transformer transformer = transformerFactory.newTransformer(); DOMSource source = new DOMSource(doc); StringWriter writer = new StringWriter(); transformer.transform(source, new StreamResult(writer)); String output = writer.toString(); but I am getting a null pointer exception here. transformer.transform(source, new StreamResult(writer)); Can you please help me out.
score: 0
answer count: 1
has comment: http://stackoverflow.com/comment/34602747
has comment: http://stackoverflow.com/comment/34602738
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/34602727
tagged with: http://stackoverflow.com/tag/xml
tagged with: java
type: Question
has answer: http://stackoverflow.com/a/22708424
linked to: http://stackoverflow.com/q/5456680
has title: How to write the XML contents onto a string in Java?

http://stackoverflow.com/q/22670461
favorite count: 0
has title: How to get the date from JFormattedTextField with a Mask
tagged with: jformattedtextfield
linked to: http://stackoverflow.com/q/428918
type: UnansweredQuestion
upvote count: 1
tagged with: swing
score: 1
has answer: http://stackoverflow.com/a/22671656
tagged with: java
has body: I've spent a lot of time reading Java docs and related questions but am still unable to understand exactly what I need to do to accomplish what I want. I know that I will be using a MaskFormatter (because I want / / always displayed), SimpleDateFormater and DocumentListeners so I spent most of my time studying those but can't figure out how to use everything together. I have a JFormattedTextField that uses a MaskFormatter("##/##/####") which I want to end up being stored as a Date in the format of MM/dd/yyyy. private JFormattedTextField weekEndingData = new JFormattedTextField(createFormatter("##/##/####")); private String dateString = weekEndingData.toString(); private SimpleDateFormat dateFormatter = new SimpleDateFormat("MM/dd/yyyy"); private MaskFormatter createFormatter(String s) { MaskFormatter formatter = null; try { formatter = new MaskFormatter(s); } catch (java.text.ParseException exc) { System.err.println("formatter is bad: " + exc.getMessage()); System.exit(-1); } return formatter; } This date reflects the "week ending date" which is Sunday in my case. This date will be sent to a database and will also be used to automatically display the dates of the rest of the days in the week. So for example: If the week ending date entered by the user is 3/30/2014, then a JLabel on the form will fill in as 3/30 under the text "Sunday", and 3/29 under Saturday, and so on till monday. Which brings me to my next issue, subtracting dates. I've done research and just about everywhere points towards JodaTime, but I also saw someone mention that the new Java8 JDK addresses much of the previous weak points for Java in terms of Dates. I am looking for guidance in terms of mapping/listing out my requirements for what I want to accomplish because I feel very muddled and can't seem to find strong enough direction. I am also hoping for any feedback on the way JDK8 uses dates and if it is a better choice than Joda. (I know subjectiveness is frowned upon here but I don't know wher…
tagged with: date
has comment: http://stackoverflow.com/comment/34535200
type: Question
downvote count: 0
answer count: 1

http://stackoverflow.com/q/22741341
favorite count: 0
tagged with: constructor
score: -1
type: AnsweredQuestion
tagged with: java
has body: prob 1 : What is this code its a constructor or a method or else? prob 2 : How is this return statement working (both)? Can anyone please explain... public class RandomIntGenerator { private final int min; private final int max; private RandomIntGenerator(int min, int max) { this.min = min; this.max = max; } public static RandomIntGenerator between(int max, int min) //Prob 1 { return new RandomIntGenerator(min, max); //Prob 2 } public static RandomIntGenerator biggerThan(int min) { return new RandomIntGenerator(min, Integer.MAX_VALUE); //Prob 2 } public static RandomIntGenerator smallerThan(int max) { return new RandomIntGenerator(Integer.MIN_VALUE, max); } public int next() {...} //its just a method }
downvote count: 1
has answer: http://stackoverflow.com/a/22741360
has title: Static Factory Method query
type: Question
upvote count: 0
answer count: 1
accepted answer: http://stackoverflow.com/a/22741360

rpc
tag name: rpc
tags question: http://stackoverflow.com/q/22713137
type: Tag

http://stackoverflow.com/comment/34695134
score: 0
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/22759067
has text: @RohitJain `G getPlayer()` where `G extends GamePlayer` erases to `GamePlayer getPlayer()` so it works for him mostly by chance. Not so with `Collection<G> getPlayers()`, which erases to `Collection getPlayers()`.

http://stackoverflow.com/comment/34550035
comment on: http://stackoverflow.com/q/22678833
score: 0
has text: Sorry my filter string is like below: String filter ="phoneNumber eq 763436 and carrier eq 'AT and T Mobility' and site startswith 256" only 'AT and T Mobility' will be inside quotes.
type: QuestionComment
type: Comment

http://stackoverflow.com/q/22716421
tagged with: android
has comment: http://stackoverflow.com/comment/34617205
tagged with: integer
type: AnsweredQuestion
tagged with: android-edittext
has answer: http://stackoverflow.com/a/22717313
upvote count: 1
type: Question
tagged with: java
has body: I am an enthusiastic newbie when it comes to coding so would really appreciate any help with my problem. I am designing a little math game where it generates a random number less than 11 and the user then puts a number in the edit text field presses the button. The idea is if the random number and the user input number equal 10 the user gets a point and if they get it marked wrong, then another randomly generated number appears for the user to continue the process. My problem is that it seems to work the first time, then when the user enters a number for the second time and presses the button it crashes. Please excuse what must seem like messy coding to you professionals but a lot of tutorials and trial and error to get this far. package com.example.mathtesttwo; public class MainActivity extends Activity { @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); final TextView textOne = (TextView) findViewById(R.id.textView3); textOne.setText("4"); final TextView guessText = (TextView) findViewById(R.id.textView2); final EditText userGuess = (EditText) findViewById(R.id.editText1); final TextView correctScore = (TextView) findViewById(R.id.textView1); final TextView wrongScore = (TextView) findViewById(R.id.textView4); wrongScore.setText("0"); //////////////////////// String randText = ""; Random randGen = new Random(); int rando = randGen.nextInt(11); randText = Integer.toString(rando); textOne.setText(randText); ///////////////// Button pushMe = (Button) findViewById(R.id.button1); pushMe.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { int userNumber = Integer.parseInt(userGuess.getText().toString()); int textNumber = Integer.parseInt(textOne.getText().toString()); int highScore = Integer.parseInt(correctScore.getText().toString()); int lowScore = Integer.parseInt(wrongScore.getText().toString()); if ( userNumber== 10 - textNumber) { guessText.…
tagged with: random
has title: My button works first time to work out the equation but not the 2nd time after a new number has been put in the edit text field
has comment: http://stackoverflow.com/comment/34618590
accepted answer: http://stackoverflow.com/a/22717313
answer count: 1
downvote count: 0
score: 1
favorite count: 0
has comment: http://stackoverflow.com/comment/34618182

http://stackoverflow.com/q/22738570
downvote count: 1
type: Question
has comment: http://stackoverflow.com/comment/34657210
has comment: http://stackoverflow.com/comment/34656938
tagged with: swingworker
has comment: http://stackoverflow.com/comment/34657292
tagged with: arraylist
score: 0
has comment: http://stackoverflow.com/comment/34656998
upvote count: 1
tagged with: user-interface
favorite count: 0
has comment: http://stackoverflow.com/comment/34657023
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/34657416
has comment: http://stackoverflow.com/comment/34658585
has comment: http://stackoverflow.com/comment/34657281
has title: Java ArrayList.add causes freezes
has comment: http://stackoverflow.com/comment/34657431
answer count: 0
has body: I'm using a SwingWorker in my Java application to prevent the GUI from freezing. The application uses 10% CPU and responds normally, but as soon as I add ArrayList.add() in a loop the GUI freezes and the application uses 100% CPU. class TestWorker extends SwingWorker&lt;Integer, Integer&gt; { @Override protected Integer doInBackground() throws Exception { ArrayList arr_1 = new ArrayList&lt;&gt;(); ArrayList arr_2 = new ArrayList&lt;&gt;(); for(int i = 0; i &lt; 999999999; i++) { arr_1.add(2); arr_2.add(4); } return null; } } new TestWorker().execute(); Why does this happen? If I just do many calculations or create objects in a loop the GUI doesn't freeze, this only seems to happen using ArrayList.add().
tagged with: java
tagged with: multithreading

http://stackoverflow.com/comment/34603598
type: QuestionComment
type: Comment
score: 1
has text: That all looks like it would work. Wouldn't it be simpler to create an expression handler, add your `RoleHierarchy`, and then inject it into the chain through `http.authorizeRequests().expressionHandler(...)`? I don't think there's such a thing as a global default (could be wrong).
comment on: http://stackoverflow.com/q/22696401

http://stackoverflow.com/q/22742436
has title: When to use enumerations?
tagged with: java
type: Question
tagged with: enums
possible better answer: http://stackoverflow.com/a/22742472
has comment: http://stackoverflow.com/comment/34663625
has body: I have this example (in Java) where there are models, each with the same set of types. I defined the types as enumerations. When I went to present this program to the advisor (it's a project), he stated it wasn't wise to use enumerations as it makes the program inflexible for changes because enumerations are not extendable. So if I want to add another type at some point, I cannot do this without recompiling. Is there ever a situation where you'd prefer enumeration over creating objects instead? It seems to me that if you can choose between a flexible class with objects and a non flexible class with enums, you might as well use objects every time, even when you're '99%' sure the types will never change.
linked to: http://stackoverflow.com/q/3363120
score: 0
answer count: 3
accepted answer: http://stackoverflow.com/a/22742494
has comment: http://stackoverflow.com/comment/34663705
has answer: http://stackoverflow.com/a/22742472
has answer: http://stackoverflow.com/a/22742509
has comment: http://stackoverflow.com/comment/34663773
has answer: http://stackoverflow.com/a/22742494
type: AnsweredQuestion

http://stackoverflow.com/comment/34586272
type: Comment
type: QuestionComment
has text: Specifically, you might want to look into [String.split()](http://docs.oracle.com/javase/6/docs/api/java/lang/String.html#split(java.lang.String))
score: 1
comment on: http://stackoverflow.com/q/22699122

http://stackoverflow.com/comment/34510237
has text: r u asking any sample for executor service ?
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/22656737
score: 0

http://stackoverflow.com/comment/34785724
comment on: http://stackoverflow.com/q/22805257
has text: I tried it and it worked, but I still wanted to understand if this was just an incorrect but working trick or the real good way of programming.
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/q/22714451
has comment: http://stackoverflow.com/comment/34613627
has body: When &amp; Why parenthesis are used in declaring a variable.For example : Graphics2D g2 = (Graphics2D)g; Here why Graphics2D are put in Parenthesis and what is the use of these ().
has comment: http://stackoverflow.com/comment/34614128
linked to: http://stackoverflow.com/q/5306835
has answer: http://stackoverflow.com/a/22714500
has comment: http://stackoverflow.com/comment/34613550
favorite count: 0
score: -3
has comment: http://stackoverflow.com/comment/34613962
has comment: http://stackoverflow.com/comment/34614279
type: AnsweredQuestion
has title: using parenthesis in declaration of variable
accepted answer: http://stackoverflow.com/a/22714500
tagged with: java
downvote count: 3
has comment: http://stackoverflow.com/comment/34613645
possible better answer: http://stackoverflow.com/a/22714758
type: Question
has answer: http://stackoverflow.com/a/22714758
answer count: 2
has comment: http://stackoverflow.com/comment/34613603
upvote count: 0

http://stackoverflow.com/a/63535326
answers question: http://stackoverflow.com/q/22808757
has body: Certainly not for API level 8, but for API level 19+, you could get the surface from the surface view, and pass it to ImageReader. The ImageReader class allows direct application access to image data rendered into a Surface You can set a listener on the ImageReader using setOnImageAvailableListener. This will get you all the frames, including the last one.
score: 0
type: Answer

http://stackoverflow.com/q/22651622
has title: Deleting remote files is better with file.delete() or making ProcessBuilder call with rm -rf?
answer count: 1
downvote count: 0
favorite count: 0
has comment: http://stackoverflow.com/comment/34502235
tagged with: processbuilder
tagged with: delete-file
accepted answer: http://stackoverflow.com/a/22651839
type: AnsweredQuestion
score: 1
tagged with: java
tagged with: file
upvote count: 1
type: Question
has body: If file.delete() is better, how is it? What are the problems of using ProcessBuilder? Also I have to loop through a list to delete the different files. In such a scenario, what is the best approach?
tagged with: rm
has answer: http://stackoverflow.com/a/22651839

http://stackoverflow.com/comment/34774726
score: 0
type: QuestionComment
comment on: http://stackoverflow.com/q/22804076
type: Comment
has text: these are sort of metadatas i need to adjust the data with these metadata and need to insert into a table

http://stackoverflow.com/q/22757169
favorite count: 0
has title: Is it possible to write 2 Android Activities (UIs) in single .java file ? if not Why?
has answer: http://stackoverflow.com/a/22757512
type: UnansweredQuestion
has body: i am new to android development. Up to now i was creating each activity in separate .java file say i have 2 activities First_Activity and Second_Activity, so two separate files viz.First_Activity.java and Second_Activity.java. But now i am curious to know that is it possible to write both first and second activity in single .java file? If yes How? If not Why not ? thanking you in advance. . when i write two activites in a single file then it showing me first activity successfully, but when i move to second activity by clicking on a button created to move to second activity, my app is crashing and showing "unfortunately appName stopped" . . i think, problem is that my second activity is not public when i write both activities in a single file.
tagged with: android
tagged with: java
upvote count: 1
type: Question
has comment: http://stackoverflow.com/comment/34691134
answer count: 1
downvote count: 0
score: 1
has comment: http://stackoverflow.com/comment/34690503

http://stackoverflow.com/comment/34729290
score: 0
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/22778480
has text: :) Actually I did. Just didn't paste the code here. Okey just let me push the code to a public git repository, and I'll provide the link here. Please wait. Thanks to show your interest.

http://stackoverflow.com/comment/34513076
has text: @JeroenVannevel overriding equals method is not a solution ?
score: 0
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/22658412

http://stackoverflow.com/q/22754319
type: Question
has comment: http://stackoverflow.com/comment/34685620
has body: I really need help out here. I am a beginner to android programming and i wanted to make a simple sudoku game. But i cant proceed further without this problem being resolved.My R.java file is not being generated.Here is the code - package org.example.sudoku; import android.os.Bundle; import android.app.Activity; import android.view.Menu; public class Sudokugame extends Activity { @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_sudokugame); } @Override public boolean onCreateOptionsMenu(Menu menu) { // Inflate the menu; this adds items to the action bar if it is present. getMenuInflater().inflate(R.menu.sudokugame, menu); return true; } } it says R cannot be resolved into a variable. And R.java file is missing in the gen folder. P.S - none of my files start with a capital letter in the res folder so thats not the error. here is my xml code: <?xml version="1.0" encoding="utf-8"?> <TextView android:layout_width="fill_parent" android:layout_height="wrap_content" android:text="@string/main_title"/> and here is my strings.xml code : <?xml version="1.0" encoding="utf-8"?> Sudoku Android Sudoku Continue New Game About Exit And here is my androidmanifest.xml code : <?xml version="1.0" encoding="utf-8"?> <uses-sdk android:minSdkVersion="1" android:targetSdkVersion="8" /> <action android:name="android.intent.action.MAIN" /> <category android:name="android.intent.category.LAUNCHER" />
has answer: http://stackoverflow.com/a/22754437
has comment: http://stackoverflow.com/comment/34685649
has comment: http://stackoverflow.com/comment/34686854
has comment: http://stackoverflow.com/comment/34685364
has comment: http://stackoverflow.com/comment/34686954
answer count: 3
tagged with: android
has comment: http://stackoverflow.com/comment/34685353
has comment: http://stackoverflow.com/comment/34685303
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/34686831
has comment: http://stackoverflow.com/comment/34685298
has answer: http://stackoverflow.com/a/22754490
has comment: http://stackoverflow.com/comment/34685407
has comment: http://stackoverflow.com/comment/34685426
linked to: http://stackoverflow.com/q/11869307
has comment: http://stackoverflow.com/comment/34685429
has answer: http://stackoverflow.com/a/22777525
score: 0
tagged with: java
has title: R.java file not being generated automatically
has comment: http://stackoverflow.com/comment/34686836

http://stackoverflow.com/a/22676917
upvote count: 17
answers question: http://stackoverflow.com/q/22676667
score: 17
has comment: http://stackoverflow.com/comment/53096842
type: AcceptedAnswer
downvote count: 0
has body: Try check folder is exists. ex) File listnames = new File(this.getFilesDir() + File.separator + "Lists"); if( !listnames.exists() ) listnames.mkdirs(); else if( !listnames.isDirectory() &amp;&amp; listnames.canWrite() ){ listnames.delete(); listnames.mkdirs(); } else{ //you can't access there with write permission. //Try other way. }
type: Answer
accepted answer of: http://stackoverflow.com/q/22676667

http://stackoverflow.com/a/22751592
upvote count: 3
has comment: http://stackoverflow.com/comment/34680519
has comment: http://stackoverflow.com/comment/34680580
has body: In java, you need to escape the escapes. Essentially, you must use double backslashes for string literals: String[] tokens = infix.split("[0-9]*([.][0-9]+)? | sin | cos | tan | log | \\^ | sqrt | \\( | \\) | \\+ | \\- | \\* | /"); Note that you don't escape forward slashes in java (regex or not). As an aside, you regex may be simplified to: String[] tokens = infix.split("[0-9]*([.][0-9]+)? | sin | cos | tan | log | sqrt | [()+*-] | /");
has comment: http://stackoverflow.com/comment/34680597
has comment: http://stackoverflow.com/comment/34680560
has comment: http://stackoverflow.com/comment/34680569
downvote count: 0
has comment: http://stackoverflow.com/comment/34681145
answers question: http://stackoverflow.com/q/22751564
type: Answer
score: 3

http://stackoverflow.com/q/22786847
has answer: http://stackoverflow.com/a/22829422
accepted answer: http://stackoverflow.com/a/22829422
has comment: http://stackoverflow.com/comment/34752303
has comment: http://stackoverflow.com/comment/34750708
tagged with: windows
favorite count: 0
upvote count: 2
has title: Run a command via Runtime.exec from java code inside Web Archive (WAR deployed in Jetty)
type: AnsweredQuestion
tagged with: 32bit-64bit
tagged with: servlet-container
score: 1
tagged with: java
has comment: http://stackoverflow.com/comment/34751094
downvote count: 1
type: Question
has body: My PC in running under Windows7 64 bit, and I have an utility (.exe, very legacy [~WinXP age], no sources available) that I'd like to invoke from java code deployed into Jetty. If I launch utility from console I get no errors. If I launch utility via simple java wrapper: import java.util.*; import java.io.*; public class Wrapper { public static void main(String[] args) throws IOException { System.out.println(System.getProperty("java.version")); Runtime.getRuntime().exec("util.exe -opt1 -opt2"); } } I get no errors as well. But in case I invoke this code (a bit more complex than Runtime.getRuntime().exec("util.exe") because I need to calculate absolute path to the binary file) from inside WAR I get IOException with following message: CreateProcess error=216, This version of %1 is not compatible with the version of Windows you're running. Check your computer's system information to see whether you need a x86 (32-bit) or x64 (64-bit) version of the program, and then contact the software publisher I've tried to launch jetty with -d32 option, tried to put different versions of java (both JRE/JDK, both 6/7, both 32/64 bit) into JAVA_HOME and PATH — and haven't succeed. Did anyone face similar issues? Is it possible to resolve them? [UPDATED] I've attached some server-code. CommandLine &amp; FileUtils are part of Apache Commons. ApplicationContext relates to Spring Framework. public class ImageLoader implements ApplicationContextAware { private final static String UTIL_EXECUTABLE = "util.exe"; private final static String TEMP_FILE_PREFIX = "tmpFilePrefix"; private ApplicationContext applicationContext; private File binaryPath; @PostConstruct public void init() throws Exception { if (applicationContext instanceof WebApplicationContext) { Resource binaryRoot = applicationContext.getResource( "WEB-INF/classes/executable"); this.binaryPath = binaryRoot.getFile(); } } @Override public void setApplicationContext(ApplicationContext applicationContext) throws BeansException { this…
has comment: http://stackoverflow.com/comment/34746326
answer count: 1

http://stackoverflow.com/comment/34681206
comment on: http://stackoverflow.com/a/22751114
has text: You have to provide a context. The error you get is because you are initializing it with a null context. If Route is your activity then that would be a valid context
type: AnswerComment
score: 0
type: Comment

http://stackoverflow.com/comment/34774713
has text: @user3363563 It is not-recommended to use a KeyListener of text components as the events could be consumed before they reach your listener or cause mutation errors if you try and modify the field during the key event notification, it also does not take into account when text is lasted into the field. DocumentListener is the recommended ethos for monitoring changes to fields/documents content and DocumentFilter for filtering content before its committed to the document/field
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/22803733
score: 1

http://stackoverflow.com/a/22685356
type: Answer
score: 0
answers question: http://stackoverflow.com/q/22685245
has body: I think you should check "i" variable always after "i++" operation - checking it in most outside while isn't enough, you can go out the array size

http://stackoverflow.com/comment/34681180
type: Comment
has text: Agreed. I also keep my shared code 100% GWT-compatible.
type: AnswerComment
comment on: http://stackoverflow.com/a/22750260
score: 0

http://stackoverflow.com/comment/34514026
has text: Are you sure this is JavaScript? Sure it isn't Java or ASP?
comment on: http://stackoverflow.com/q/22659114
score: 4
type: QuestionComment
type: Comment

http://stackoverflow.com/q/22679554
possible better answer: http://stackoverflow.com/a/22679885
answer count: 4
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/22680188
tagged with: java
tagged with: http://stackoverflow.com/tag/json
has answer: http://stackoverflow.com/a/22686187
has title: How to get the value from this json string in java?
type: Question
accepted answer: http://stackoverflow.com/a/22679658
score: 0
has comment: http://stackoverflow.com/comment/34550630
has answer: http://stackoverflow.com/a/22679885
tagged with: parsing
has answer: http://stackoverflow.com/a/22679658
has body: I have the below json string as output, {"message":"Error while updating","success":false} And i am trying to get the json object out of it by using, String resp = "{"message":"Error while updating", "success":false}"; JSONObject jObject = new JSONObject(resp); log.info("jObject-success: "+ jObject.getString("success").toString()); The above line throws "success" is not found in the response error. What am i missing here?

maven
tags question: http://stackoverflow.com/q/22706173
tags question: http://stackoverflow.com/q/22707510
tags question: http://stackoverflow.com/q/22788464
tags question: http://stackoverflow.com/q/22721115
tags question: http://stackoverflow.com/q/22699781
tags question: http://stackoverflow.com/q/22771931
type: Tag
tags question: http://stackoverflow.com/q/22765189
tags question: http://stackoverflow.com/q/22757455
tags question: http://stackoverflow.com/q/22789196
tags question: http://stackoverflow.com/q/22753866
tags question: http://stackoverflow.com/q/22706679
tags question: http://stackoverflow.com/q/22722971
tags question: http://stackoverflow.com/q/22711974
tags question: http://stackoverflow.com/q/22663876
tags question: http://stackoverflow.com/q/22767115
tags question: http://stackoverflow.com/q/22667063
tags question: http://stackoverflow.com/q/22717744
tags question: http://stackoverflow.com/q/22712290
tags question: http://stackoverflow.com/q/22796176
tags question: http://stackoverflow.com/q/22791474
tags question: http://stackoverflow.com/q/22756531
tags question: http://stackoverflow.com/q/22804909
tags question: http://stackoverflow.com/q/22805906
tags question: http://stackoverflow.com/q/22652176
tags question: http://stackoverflow.com/q/22778605
tags question: http://stackoverflow.com/q/22756153
tags question: http://stackoverflow.com/q/22656446
tags question: http://stackoverflow.com/q/22754164
tags question: http://stackoverflow.com/q/22689608
tags question: http://stackoverflow.com/q/22737553
tags question: http://stackoverflow.com/q/22684945
tags question: http://stackoverflow.com/q/22757261
tags question: http://stackoverflow.com/q/22712937
tags question: http://stackoverflow.com/q/22710049
tags question: http://stackoverflow.com/q/22651066
tags question: http://stackoverflow.com/q/22720163
tags question: http://stackoverflow.com/q/22777386
tags question: http://stackoverflow.com/q/22772486
tags question: http://stackoverflow.com/q/22684482
tags question: http://stackoverflow.com/q/22718219
tags question: http://stackoverflow.com/q/22778450
tags question: http://stackoverflow.com/q/22662769
tags question: http://stackoverflow.com/q/22702637
tags question: http://stackoverflow.com/q/22770170
tags question: http://stackoverflow.com/q/22662169
tags question: http://stackoverflow.com/q/22693884
tags question: http://stackoverflow.com/q/22697324
tags question: http://stackoverflow.com/q/22705924
tags question: http://stackoverflow.com/q/22719717
tags question: http://stackoverflow.com/q/22669770
tags question: http://stackoverflow.com/q/22768625
tags question: http://stackoverflow.com/q/22781275
tags question: http://stackoverflow.com/q/22676861
tags question: http://stackoverflow.com/q/22698789
tags question: http://stackoverflow.com/q/22657510
tags question: http://stackoverflow.com/q/22756548
tags question: http://stackoverflow.com/q/22713431
tags question: http://stackoverflow.com/q/22758327
tags question: http://stackoverflow.com/q/22665493
tags question: http://stackoverflow.com/q/22695901
tags question: http://stackoverflow.com/q/22768492
tags question: http://stackoverflow.com/q/22801834
tags question: http://stackoverflow.com/q/22657184
tags question: http://stackoverflow.com/q/22776430
tags question: http://stackoverflow.com/q/22658147
tags question: http://stackoverflow.com/q/22707188
tags question: http://stackoverflow.com/q/22767873
tags question: http://stackoverflow.com/q/22738497
tags question: http://stackoverflow.com/q/22762597
tags question: http://stackoverflow.com/q/22738150
tags question: http://stackoverflow.com/q/22732977
tags question: http://stackoverflow.com/q/22800894
tags question: http://stackoverflow.com/q/22717053
tags question: http://stackoverflow.com/q/22769789
tags question: http://stackoverflow.com/q/22790693
tags question: http://stackoverflow.com/q/22794813
tags question: http://stackoverflow.com/q/22781399
tags question: http://stackoverflow.com/q/22741072
tags question: http://stackoverflow.com/q/22701905

http://stackoverflow.com/q/22649050
tagged with: list
tagged with: java
tagged with: collections
type: Question
has comment: http://stackoverflow.com/comment/34496911
tagged with: algorithm
accepted answer: http://stackoverflow.com/a/22649245
has comment: http://stackoverflow.com/comment/34500564
has body: I just want to move one property between two different lists: I have one list of Dogs List&lt;Dog&gt; public class Dog{ private int id; private String name; private String newValue; } In this first list I don´t have values for newValue property. The second list is List&lt;DogProp&gt; public class DogProp{ private int id; private String newValue; } In this second list I have the values for newValue property. What I want is to move newValue property from List&lt;DogProp&gt; to List&lt;Dog&gt;. In this case the list can have different numbers of elements and different elements, it means the size of list can be different and elements also. The operation I want is something like: If id property in List&lt;DogProp&gt; match the id property in List&lt;Dog&gt;, I want to move the newValue property from List&lt;DogProp&gt; to List&lt;Dog&gt; I know I can create some kind of algorithm to do this but I was wondering if there is an existing solution in some google project or apache commons project just to avoid reinvented the wheel. UPDATE: As this seems to be off topic as I'm asking for a library to do this, now I want to know the best way to achieve this using a tool or an algorithm. Thanks.
has title: Move properties between different lists
answer count: 1
downvote count: 0
has comment: http://stackoverflow.com/comment/34496995
favorite count: 0
upvote count: 2
has answer: http://stackoverflow.com/a/22649245
score: 2
type: AnsweredQuestion

http://stackoverflow.com/comment/34541368
comment on: http://stackoverflow.com/q/22674163
score: 0
type: Comment
type: QuestionComment
has text: For examples, please see this near duplicate question: [Creating a GUI with multiple panels and one frame](http://stackoverflow.com/questions/8275728/creating-a-gui-with-multiple-panels-and-one-frame)

http://stackoverflow.com/comment/86327698
has text: Queue implementations generally do not allow insertion of null elements, although some implementations, such as LinkedList, do not prohibit insertion of null. Even in the implementations that permit it, null should not be inserted into a Queue, as null is also used as a special return value by the poll method to indicate that the queue contains no elements. https://docs.oracle.com/javase/7/docs/api/java/util/Queue.html
type: Comment
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/22662100

http://stackoverflow.com/q/22708070
has title: How to fix minimum and maximum value in double value for Edit Text in android?
type: AnsweredQuestion
score: 1
tagged with: java
upvote count: 1
possible better answer: http://stackoverflow.com/a/24631869
type: Question
has answer: http://stackoverflow.com/a/24631869
has answer: http://stackoverflow.com/a/22708869
has body: I have refered this link to set minimum and maximum value for edit text to allow to enter. But i want to fix minimum and maximum value as double value. Minimum value should allow to enter starting from 0.25 and maximum value should allow 1000.0. How to fix it?
has answer: http://stackoverflow.com/a/22708357
downvote count: 0
favorite count: 0
has answer: http://stackoverflow.com/a/36789543
accepted answer: http://stackoverflow.com/a/22708357
linked to: http://stackoverflow.com/q/14212518
tagged with: android
has comment: http://stackoverflow.com/comment/34602323
answer count: 4

http://stackoverflow.com/q/22719952
tagged with: multimap
has body: Let's assume i have something like this: Multimap&lt;Integer, Integer&gt; data = TreeMultimap.create(); How can i use .headMap() on my data? I suppose, that TreeMultimap.asMap() is the way to go. The documentation (link) says, that TreeMap.asMap() returns NavigableMap&lt;K,Collection&lt;V&gt;&gt;, but i'm not able to get that to work. NavigableMap&lt;Integer, ArrayList&lt;Integer&gt;&gt; test = data.asMap(); // type mismatch SortedMap&lt;Integer, ArrayList&lt;Integer&gt;&gt; test = data.asMap(); // type mismatch What am i doing wrong? Thanks! PS: I'm using guava 16
type: AnsweredQuestion
tagged with: guava
score: 0
tagged with: java
tagged with: collections
has title: How to use NavigableMap features with Guava's Multimap (with asMap())?
type: Question
has answer: http://stackoverflow.com/a/22720014
accepted answer: http://stackoverflow.com/a/22720014
answer count: 1

http://stackoverflow.com/comment/34666913
score: 0
type: Comment
type: AnswerComment
comment on: http://stackoverflow.com/a/22743998
has text: You have to structure your code that execution does not happen when the Session is invalid and only the redirect occurs.

http://stackoverflow.com/q/22756531
type: Question
has comment: http://stackoverflow.com/comment/34689485
accepted answer: http://stackoverflow.com/a/22756695
has body: I am making a maven project which is trying to run command prompt commands. I tried Exec Maven Plugin but couldn't do it. I think i'm at wrong way for this. Here is my work for making a file with "Exec Maven Plugin". Can someone make an explanation why this is not working or make a suggestion about new plugin or solution which is working at pom.xml (not Ant). ` org.codehaus.mojo exec-maven-plugin 1.2.1 exec mkdir C:\Users\USERNAME\Desktop\FILENAME ` Thank You..
score: 0
answer count: 1
tagged with: pom.xml
has title: How can i windows command prompt commands from maven pom.xml file?
tagged with: maven
tagged with: exec-maven-plugin
has comment: http://stackoverflow.com/comment/34689387
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/22756695
tagged with: java

http://stackoverflow.com/comment/34672247
comment on: http://stackoverflow.com/q/22747069
type: Comment
type: QuestionComment
has text: One approach is shown [here](http://stackoverflow.com/a/7706684/230513).
score: 1

http://stackoverflow.com/q/22806840
score: 0
tagged with: java
tagged with: quartz-scheduler
has title: Dynamic cron job using quartz+spring
type: Question
has answer: http://stackoverflow.com/a/22806996
has answer: http://stackoverflow.com/a/22807041
answer count: 2
has body: I want to schedule a cron-job using quartz+spring. &lt;context:component-scan base-package="com.hotelscrapper" /&gt; &lt;!--hotelServiceImpl--&gt; &lt;bean id="ScheduleScrapJob" class="com.hotelscrapper.util.ScheduleScrapJob"&gt; &lt;property name="hotelService" ref="hotelServiceImpl"&gt; &lt;/property&gt; &lt;/bean&gt; public class ScheduleScrapJob extends QuartzJobBean { private HotelService hotelService; public void setHotelService(HotelService hotelService){ this.hotelService = hotelService; } @Override protected void executeInternal(JobExecutionContext arg0) throws JobExecutionException { hotelService.reScrapWorker(); } } hotelService is null. I do not understand how i can link hotelService to service hotelServiceImpl. Solution: hotelService is to be static. It works fine.
tagged with: cron
type: UnansweredQuestion
tagged with: spring

http://stackoverflow.com/comment/34600375
has text: Hi user2684301, I need to use tomcat, as that is the server of choice where I work. I can't use Jetty/Grizzly. Cheers.
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/22692858

http://stackoverflow.com/comment/34958749
type: QuestionComment
has text: How does your SPN look like? Maybe you are supplying the wrong format.
comment on: http://stackoverflow.com/q/22776533
score: 0
type: Comment

http://stackoverflow.com/a/22731433
score: 0
has comment: http://stackoverflow.com/comment/34644593
has comment: http://stackoverflow.com/comment/34646157
answers question: http://stackoverflow.com/q/22731157
has comment: http://stackoverflow.com/comment/34646147
has body: Your query is: SELECT tbl1.name, tbl2.id_tbl2, tbl1.salary FROM tbl1 INNER JOIN tbl2 ON tbl1.id=tbl2.id_tbl1 There are only 3 fields in the select statements. But you are trying to read the 4th field which does not exist. out.write(rs.getString(1)); out.write(rs.getString(2)); out.write("&lt;/br&gt;"); out.write(rs.getString(3)); out.write("&lt;/br&gt;"); out.write(rs.getString(4)); // this will result a runtime exception out.write("&lt;/br&gt;"); Remove the 4th, i.e. getString(4), statement, and it should be working.
type: Answer
has comment: http://stackoverflow.com/comment/34652386
has comment: http://stackoverflow.com/comment/34646194
has comment: http://stackoverflow.com/comment/34644839
has comment: http://stackoverflow.com/comment/34652415
has comment: http://stackoverflow.com/comment/34646506
has comment: http://stackoverflow.com/comment/34646197
has comment: http://stackoverflow.com/comment/34646220
has comment: http://stackoverflow.com/comment/34652624

http://stackoverflow.com/a/22741739
has body: Do you get the same? public class InternalFrameTest extends JFrame { public InternalFrameTest() { JDesktopPane desktop = new JDesktopPane(); JInternalFrame frame = new JInternalFrame("AHHHH!!!!", true); frame.setSize(300, 300); frame.setVisible(true); frame.setOpaque(false); desktop.add(frame); setContentPane(desktop); setSize(600, 600); setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); setVisible(true); } public static void main(String[] args) { try { UIManager.setLookAndFeel(NimbusLookAndFeel.class.getName()); } catch (ClassNotFoundException|InstantiationException |IllegalAccessException|UnsupportedLookAndFeelException e) { e.printStackTrace(); } UIManager.put("InternalFrame:InternalFrameTitlePane[Enabled].textForeground", Color.RED); new InternalFrameTest(); } } When I run (without setting anything to it) System.out.println(UIManager.getColor("InternalFrame:InternalFrameTitlePane[Enabled].textForeground")); I get "DerivedColor(color=142,143,145 parent=nimbusDisabledText offsets=0.0,0.0,0.0,0 pColor=142,143,145" Do you get the same?
has comment: http://stackoverflow.com/comment/34679809
has comment: http://stackoverflow.com/comment/34679083
has comment: http://stackoverflow.com/comment/34705059
has comment: http://stackoverflow.com/comment/34703910
answers question: http://stackoverflow.com/q/22740501
score: 0
has comment: http://stackoverflow.com/comment/34679725
has comment: http://stackoverflow.com/comment/34710288
has comment: http://stackoverflow.com/comment/34680227
has comment: http://stackoverflow.com/comment/34679608
type: Answer

jcombobox
tags question: http://stackoverflow.com/q/22808507
tags question: http://stackoverflow.com/q/22794236
tags question: http://stackoverflow.com/q/22747299
tags question: http://stackoverflow.com/q/22668701
tags question: http://stackoverflow.com/q/22802532
type: Tag
tags question: http://stackoverflow.com/q/22795604
tag name: jcombobox
tags question: http://stackoverflow.com/q/22696402
tags question: http://stackoverflow.com/q/22709730

http://stackoverflow.com/comment/34748456
type: Comment
type: QuestionComment
has text: It seems that there has been **no** accepted Java solution for this problem until now. Just saying, who knows how they are testing it...
comment on: http://stackoverflow.com/q/22772078
score: 0

http://stackoverflow.com/q/22803175
upvote count: 1
answer count: 1
accepted answer: http://stackoverflow.com/a/22803674
type: AnsweredQuestion
downvote count: 0
score: 1
tagged with: generics
has title: generics paraemeterised definition in inteface and implementation class rationale
favorite count: 0
tagged with: subtyping
has answer: http://stackoverflow.com/a/22803674
has body: I'm unable to understand the concept behind the subtyping / interface implementation in relation to generics. Please explain. I had the below structure: `ICommand -&gt; ProducerConsumerCommand` IProducerConsumer -&gt; SimpleProducerConsumer My understanding is that any concrete class implementing IProducerConsumer must hold objects of type T which is the subclass of Number and ICommand interface. IProducerConsumer&lt;T extends Number,ICommand&gt; Now I want to write a implementation class SimpleProducerConsumer, Now my intent is that I want to tell that SimpleProducerConsumer can hold any type parameters as defined in IProducerConsumer type parameters as below: public class SimpleProducerConsumer&lt;T,ICommand&gt; implements Runnable, IProducerConsumer&lt;T,ICommand&gt; { It dosen't work, it says as below: SimpleProducerConsumer&lt;T,ICommand&gt; - ICommand complains (warning) that it is getting hidden. IProducerConsumer&lt;T,ICommand&gt; - compiler errors in T saying as below *Bound mismatch: The type T is not a valid substitute for the bounded parameter of the type IProducerConsumer&lt;T,ICommand&gt;* So, My first question is why can't I define the same way as interface in concrete class. what is happening under the hoods. if I can define public class test&lt;ICommand&gt; {} why can't I do the same while implementing, confusing. Now I define as below public class SimpleProducerConsumer&lt;T,ProducerConsumerCommand&gt; implements Runnable, IProducerConsumer&lt;T,ICommand&gt; { Still T in IProducerConsumer complains. If I change as below: public class SimpleProducerConsumer&lt;T,ProducerConsumerCommand&gt; implements Runnable, IProducerConsumer&lt;T extends Number,ICommand&gt; { extends complains saying to remove the token. Now i do like this as below: public class SimpleProducerConsumer&lt;T extends Number,ProducerConsumerCommand&gt; implements Runnable, IProducerConsumer&lt;T extends Number,ICommand&gt; { Still extends in IProducerConsumer dosen't work. Now public…
type: Question
tagged with: java

http://stackoverflow.com/comment/34530753
type: AnswerComment
has text: Thanks for the response @DigCamara. I realized that I tried to change some variable names when copying the code over but didn't change them all. My intent was to initialize the value of iv in the `initialize()` method by using the following code: `iv = (ImageView) findViewById(R.id.motorolaLogo);` Is that sufficient as an initialization, or does the constructor for the ImageView class also have to be called?
type: Comment
comment on: http://stackoverflow.com/a/22648870
score: 0

http://stackoverflow.com/comment/34522012
type: AnswerComment
comment on: http://stackoverflow.com/a/22661448
type: Comment
has text: Just put your subList line inside an if block which checks if the start variable value is less than the list size.
score: 0

http://stackoverflow.com/q/22780375
has body: I have basic knowledge about C and java. I have to make a java project to read an html files in this form The file is in HTML and I want same info inside the &lt;pre&gt; tag. The file content is like this: &lt;html&gt; &lt;pre&gt; Extraction of Roots by Repeated Subtractions for Digital Computers&lt;-- i wand to take this line the title CACM December, 1958 Sugai, I. &lt;--- and this line CA581202 JB March 22, 1978 8:29 PM 2 5 2 2 5 2 2 5 2 &lt;/pre&gt; &lt;/html&gt; I want to take only the title and the writers if the file has them. I wrote this code but I could not take the writers. I got useless information StringBuilder builder = new StringBuilder(); Element link; String text,str,name,title,name2=null; Document doc; File in = new File("path"); doc = Jsoup.parse(in, null); link = doc.select("pre").first(); text = doc.body().text(); String []lines = text.split("[\r\n]+"); for (String string : lines) { if (builder.length() &gt; 0) { builder.append(" "); } builder.append(string); } str = builder.toString(); String[] strings = str.split(","); title=strings[0]; name=strings[2];
accepted answer: http://stackoverflow.com/a/22781013
score: 0
type: AnsweredQuestion
tagged with: java
has comment: http://stackoverflow.com/comment/34733181
type: Question
has comment: http://stackoverflow.com/comment/34732495
has comment: http://stackoverflow.com/comment/34733905
has answer: http://stackoverflow.com/a/22781013
answer count: 1
has title: I can't take only a part of string

http://stackoverflow.com/comment/34513029
type: QuestionComment
has text: I'm afraid your going to need to provide some example code for the kind of thing you've tried and be a little more specific with what you need and why. For example, what do you mean by a 'system' file? That way it will be easier for people to help you and your question will be more useful for other people looking for an answer to a similar question.
comment on: http://stackoverflow.com/q/22658523
score: 0
type: Comment

http://stackoverflow.com/comment/35025301
comment on: http://stackoverflow.com/a/22790683
score: 0
type: Comment
has text: It is a bit difficult to say without seeing the code. Sorry I couldn't be more help. =/
type: AnswerComment

http://stackoverflow.com/q/22680630
favorite count: 0
type: UnansweredQuestion
has body: I would like to convert the following string/ JSONObject to POJO, {"list":["\r\n{\r\n\"id\":\"1\",\r\n\"protocol\":\"udp\",\r\n\"srcPorts= \":\"3000-4000 \",\r\n\"destPorts\":\"1790-2000\"\r\n}","\r\n{\r\n\"id\":\"2\",\r\n \"protocol\":\"tcp\",\r\n\"srcPorts\":\"3000-4000\",\r\n\"destPorts\":\"1790-2000 \"\r\n}"],"user":"\r\n{\r\n\"name\":\"John\",\r\n\"address\":\"x.x.x.x\",\r\n\"email \":\"john@p.com\"\r\n}"} How do I convert to Pojo using Jackson ObjectMapper. The 2 Pojo classes are as follows. The user part in the string above should map to the java file - User.java public class User { private String name; private String address; private String email; public String getName() { return name; } public void setName(String name) { this.name = name; } public String getAddress() { return address; } public void setaddress(String Address) { this.address = address; } public String getEmail() { return email; } public void setEmail(String email) { this.email = email; } } The List part in the string above should map to the java file - TestCase.java public class TestCase { private String id; private String protocol; private String srcPorts; private String destPorts; public String getProtocol() { return protocol; } public void setProtocol(String protocol) { this.protocol = protocol; } public String getSrcPorts() { return srcPorts; } public void setSrcPorts(String srcPorts) { this.srcPorts = srcPorts; } public String getDestPorts() { return destPorts; } public void setDestPorts(String destPorts) { this.destPorts = destPorts; } public String getID() { return id; } public void setID(String id) { this.id = id; } }
downvote count: 0
score: 1
linked to: http://stackoverflow.com/q/6553051
tagged with: java
tagged with: http://stackoverflow.com/tag/json
has answer: http://stackoverflow.com/a/22680819
type: Question
answer count: 2
tagged with: jersey
has answer: http://stackoverflow.com/a/22680940
tagged with: jackson
upvote count: 1
has title: How to use Jackson ObjectMapper to convert to Pojo for multiple data

http://stackoverflow.com/comment/34560719
type: Comment
has text: So to make an object of B, I need to actually make an A, first?
type: AnswerComment
comment on: http://stackoverflow.com/a/22685613
score: 0

http://stackoverflow.com/q/22675744
has body: I am using Weka to do classification of my dataset. First I did this using the GUI giving me some results (Accurracy, ROC, ...). Now that I'm using the API to implement a small framework around WEKA, I run the exact same configuration yet getting different results. Let me give you an example: Config of .ARFF file in GUI: @relation 'QueryResult-weka.filters.unsupervised.attribute.NominalToString-Clast -weka.filters.unsupervised.attribute.StringToWordVector-R2-W1000-prune-rate-1.0-N0 -stemmerweka.core.stemmers.NullStemmer-M1-O-tokenizerweka.core.tokenizers.WordTokenizer -delimiters \", -weka.filters.unsupervised.attribute.StringToNominal-R2-last -weka.filters.unsupervised.attribute.NumericToBinary-unset-class-temporarily -weka.filters.unsupervised.attribute.NominalToString-Cfirst -weka.filters.unsupervised.attribute.StringToWordVector-R1-W1000000-prune-rate-1.0-C-T-I-N0-L-S -stemmerweka.core.stemmers.NullStemmer-M1-stopwords/Users/stopwds.txt-tokenizerweka.core.tokenizers.WordTokenizer -delimiters \" \\r \\t.,;:\\\'\\\"()?!-/&lt;&gt;[]\\t\\r\\n\"-weka.filters.unsupervised.attribute.Remove-R120-1964 -weka.filters.unsupervised.attribute.Remove-R121-123' As I said, using the API I use same config: @relation 'QueryResult-weka.filters.unsupervised.attribute.NominalToString-Clast -weka.filters.unsupervised.attribute.StringToWordVector-R2-W1000-prune-rate-1.0-N0 -stemmerweka.core.stemmers.NullStemmer-M1-O-tokenizerweka.core.tokenizers.WordTokenizer -delimiters \", -weka.filters.unsupervised.attribute.StringToNominal-R2-last -weka.filters.unsupervised.attribute.NumericToBinary-unset-class-temporarily -weka.filters.unsupervised.attribute.NominalToString-Cfirst -weka.filters.unsupervised.attribute.StringToWordVector-R1-W1000000-prune-rate-1.0-C-T-I-N0-L-S -stemmerweka.core.stemmers.NullStemmer-M1-stopwords/Users/stopwds.txt-tokenizerweka.core.tokenizers.WordTokenizer -delimiters \" \\r \\t.,;:\\\'\\\"()?!-/&lt;&gt;[]\\t\\r\\n\"-weka.filters.unsupervised.attribute.Remove-R120-19…
downvote count: 0
linked to: http://stackoverflow.com/q/11872974
favorite count: 0
has title: Using Weka gives different results between GUI and API implementation
type: UnansweredQuestion
tagged with: nlp
score: 3
answer count: 0
upvote count: 3
tagged with: classification
tagged with: java
tagged with: machine-learning
type: Question
tagged with: weka

eigenvector
tags question: http://stackoverflow.com/q/22672172
tag name: eigenvector
type: Tag

http://stackoverflow.com/q/22678032
possible better answer: http://stackoverflow.com/a/22683398
has answer: http://stackoverflow.com/a/22683398
score: 0
answer count: 2
has answer: http://stackoverflow.com/a/22679358
accepted answer: http://stackoverflow.com/a/22679358
tagged with: encryption
has title: Encryption in Java I need a 16 byte initial vector
has body: Hi I am trying to encrypt a string using AES encryption with initalvector and key. The problem is I am not able to generate a IV which is 16 bytes long. what ever I do its showing IV is not 16 bytes so an exception is raised. public static String encryptString(String str){ char[] CHARSET_AZ_09 = "ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789".toCharArray(); String initialVectorString = Helper.randomString(CHARSET_AZ_09, 16); byte[] vectorbytes = (new org.apache.commons.codec.binary.Base64()).encode(initialVectorString.getBytes()); String encryptedString = Helper.encrypt(str, initialVectorString, "mykey"); return encryptedString; } public static String randomString(char[] characterSet, int length) { Random random = new SecureRandom(); char[] result = new char[length]; for (int i = 0; i &lt; result.length; i++) { // picks a random index out of character set &gt; random character int randomCharIndex = random.nextInt(characterSet.length); result[i] = characterSet[randomCharIndex]; } String str = new String(result); try{ str = new String(str.getBytes(),"UTF8"); } catch(Exception e){ } Log.d("check",str.getBytes().length+""); return str; } public static String encrypt(String data,String initialVectorString,String secretKey){ String encryptedString = null; try{ SecretKeySpec skeySpec = new SecretKeySpec(md5(secretKey).getBytes(), "AES"); IvParameterSpec initialVector = new IvParameterSpec((new org.apache.commons.codec.binary.Base64()).decode(initialVectorString.getBytes())); Cipher cipher = Cipher.getInstance("AES/CFB8/NoPadding"); cipher.init(Cipher.ENCRYPT_MODE, skeySpec, initialVector); byte[] plainTextByteArray = (new org.apache.commons.codec.binary.Base64()).decode(data.getBytes()); byte[] encryptedByteArray = cipher.doFinal(plainTextByteArray); encryptedString = new String(encryptedByteArray, "UTF8"); } catch (Exception e) { Log.d("Problem decrypting the data", e.getLocalizedMessage()); } return encryptedString; } Does anybody knows how to generate a 16 byte long IV?
tagged with: aes
type: AnsweredQuestion
tagged with: java
type: Question

http://stackoverflow.com/q/22655230
tagged with: jsf
downvote count: 0
score: 6
has title: Netbeans warns blacklisted repository declarations for "http://download.java.net/maven/2" in pom.xml. How to deal?
tagged with: maven
type: Question
tagged with: java
accepted answer: http://stackoverflow.com/a/22656393
upvote count: 6
has body: In my maven based JSF project, I have these repositories added in my pom.xml java.net2 Repository hosting the jee6 artifacts http://download.java.net/maven/2 http://download.java.net/maven/2/ jsf20 default Repository for library Library[jsf20] But Netbeans shows warnings that these reference blacklisted repositories. Should I remove these repository declarations ? Or do I need to replace them with some others ?
has answer: http://stackoverflow.com/a/22656393
answer count: 1
favorite count: 0
type: AnsweredQuestion
tagged with: netbeans

http://stackoverflow.com/q/22698789
has title: Implementing Maven for an existing project
has answer: http://stackoverflow.com/a/22698893
score: 0
tagged with: maven
tagged with: dependency-management
type: Question
has body: I have a project implemented in ADF. I need to build it using Maven now. I wrote the POM but now stuck at adding dependancies. There are way too many JAR files, specifically about ADF, Toplink etc which I believe I will need to put in my POM. Now, only way till now i could figure out is to go to each JAR, open manifest file, get version etc, and then get the dependancy block from maven online repository. Is there a diff and easier and faster way of doing it. Please help!! Note: Chances are high that my question may sound illogical or stupid cause I have been using maven only for a week now. -Santosh
tagged with: project
tagged with: java
answer count: 1
type: UnansweredQuestion

http://stackoverflow.com/a/22789851
has comment: http://stackoverflow.com/comment/34749314
has comment: http://stackoverflow.com/comment/34749980
has comment: http://stackoverflow.com/comment/34749433
type: Answer
has comment: http://stackoverflow.com/comment/34749150
downvote count: 0
has comment: http://stackoverflow.com/comment/34749171
score: 6
has comment: http://stackoverflow.com/comment/34749774
has comment: http://stackoverflow.com/comment/34756991
has comment: http://stackoverflow.com/comment/34749892
answers question: http://stackoverflow.com/q/22789757
has comment: http://stackoverflow.com/comment/34749798
upvote count: 6
has comment: http://stackoverflow.com/comment/34758314
accepted answer of: http://stackoverflow.com/q/22789757
has comment: http://stackoverflow.com/comment/34749207
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/34750265
has body: Even better idea -- instead of trying to call a main method, instead create a method in your other class called testMain() which does the same thing as main except it returns the exit code instead of exiting. System.exit() called in that main method will shut down your entire program. You want to run the other main in another thread and find the exit code for that thread. Build the other program (name the jar AnotherClass.jar), add the jar to your path and try this: int exitCode; try { Process process = Runtime.getRuntime().exec("java AnotherClass.jar",new String[]{"arg1","arg2"}); exitCode = process.waitFor(); System.out.println(exitCode); } catch (IOException e) { System.out.println("IO Error: " + e); } catch (InterruptedException e) { System.out.println("Inturrupted: " + e); } EDIT: The following will not work at all; System.exit() kills all threads. This code will run another main method in a new thread, and when it exits it will not harm your current program. Thread anotherProgram = new Thread(new Runnable() { @Override public void run() { AnotherClass.main(new String[]{"foo","bar"}); } }); anotherProgram.start();

http://stackoverflow.com/q/22715424
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/34615984
has body: as you can see I have OneToMany collection using additional join table. The CustomerAccountTransaction is a owner and Invoice is a child.. In other words transaction can contain a lot of invoices. @Entity @Table(name = "customeraccounttransactions") public class CustomerAccountTransaction { @OneToMany(fetch = FetchType.LAZY, cascade = CascadeType.ALL, orphanRemoval = true, mappedBy = "transaction") private List&lt;Invoice&gt; invoices = new ArrayList&lt;Invoice&gt;(0); } @Entity @Table(name = "invoices") public class Invoice { @ManyToOne(fetch = FetchType.LAZY) @JoinTable(name = "customeraccounttransaction2invoices", joinColumns = { @JoinColumn(name = "InvoiceId") }, inverseJoinColumns = { @JoinColumn(name = "AccountTransactionId") }) private CustomerAccountTransaction transaction; } The issue is the following: when I try to retrieve a list of invoices (without "touching" transaction field) the hibernate always puts LEFT OUTER JOIN to customeraccounttransaction2invoices. It just ignores the FetchType.LAZY! Code: public List&lt;Invoice&gt; getList(final String filter, final Long customerId, final Invoices queryType, final Sort sort, final Integer page, final Integer perPage) { Session session = SessionFactoryUtils.getSession(sessionFactory, false); List&lt;Invoice&gt; result = null; Criteria query = session.createCriteria(Invoice.class) .addOrder(sort.getType() == SortType.Asc ? Order.asc(sort.getField()) : Order.desc(sort.getField())); if (!StringUtils.isBlank(filter)) { String f = String.format("%%%s%%", filter.trim()); query.createAlias("request", "request") .createAlias("request.person", "person") .add(Restrictions.disjunction() .add(Restrictions.ilike("request.number", f)) .add(Restrictions.ilike("person.firstName", f)) .add(Restrictions.ilike("person.lastName", f)) .add(Restrictions.ilike("number", f)) ); } if (customerId != null) { query.createAlias("customer", "customer") .add(Restrictions.eq("customer.id", customerId)); } switch (queryType) { case Active: qu…
has comment: http://stackoverflow.com/comment/34617847
has comment: http://stackoverflow.com/comment/34616911
has comment: http://stackoverflow.com/comment/34617769
tagged with: java
tagged with: hibernate
tagged with: orm
has comment: http://stackoverflow.com/comment/34615503
has comment: http://stackoverflow.com/comment/34617598
has title: Hibernate JoinTable uses OUTER JOIN in case of lazy collection
type: Question
has comment: http://stackoverflow.com/comment/34617999
has comment: http://stackoverflow.com/comment/34617731
has comment: http://stackoverflow.com/comment/34618121
has answer: http://stackoverflow.com/a/22715820
score: 0
answer count: 1

http://stackoverflow.com/q/22707115
has comment: http://stackoverflow.com/comment/43021377
answer count: 1
tagged with: multiple-inheritance
score: 0
linked to: http://stackoverflow.com/q/23678513
accepted answer: http://stackoverflow.com/a/23179347
tagged with: android
has title: Android Fragment for Slider Menu which has Fragments inside for Tabs
type: AnsweredQuestion
has body: I am trying to create a fragment, for an activity which I already created, that contains tabs. The tabs have been implemented using fragments, and the class has been extended for fragment activity. I have searched online and so far, what I have found is that this might not be possible, and that there exists no android app [Well, that I know of] that implements this. package com.example.userinterface; import com.example.userinterface.adapter.TabPagerAdapter; import android.app.ActionBar; import android.app.FragmentTransaction; import android.os.Bundle; import android.support.v4.app.FragmentActivity; import android.support.v4.view.ViewPager; public class MapActivity extends FragmentActivity { //Declaration of resources to be used ViewPager Tab; TabPagerAdapter TabAdapter; ActionBar actionBar; // Tab titles private String[] tabs = { "All", "Zone A", "Zone B" }; protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.map_section); // Initialisation Tab = (ViewPager) findViewById(R.id.pager); TabAdapter = new TabPagerAdapter(getSupportFragmentManager()); Tab.setOnPageChangeListener( new ViewPager.SimpleOnPageChangeListener(){ @Override public void onPageSelected(int position) { actionBar = getActionBar(); actionBar.setSelectedNavigationItem(position); } } ); Tab.setAdapter(TabAdapter); //Set the action bar actionBar = getActionBar(); //Enable tabs on action Bar and add a listener actionBar.setNavigationMode(ActionBar.NAVIGATION_MODE_TABS); ActionBar.TabListener tabListener = new ActionBar.TabListener() { @Override public void onTabUnselected(android.app.ActionBar.Tab tab, FragmentTransaction ft) { // TODO Auto-generated method stub } @Override public void onTabSelected(ActionBar.Tab tab, FragmentTransaction ft) { // TODO Auto-generated method stub //Return the current position of the tab in the action bar Tab.setCurrentItem(tab.getPosition()); } @Override public void onTabReselected(android.app.ActionBar.Tab tab, F…
tagged with: android-fragments
tagged with: java
has answer: http://stackoverflow.com/a/23179347
tagged with: android-fragmentactivity
type: Question

http://stackoverflow.com/a/22733044
type: Answer
has comment: http://stackoverflow.com/comment/34647224
accepted answer of: http://stackoverflow.com/q/22732933
answers question: http://stackoverflow.com/q/22732933
has comment: http://stackoverflow.com/comment/34647625
has body: (1) I don't think either one will run noticeably faster than the other. The loop will have more overhead (e.g. see comments below about needing an iterator) but should take about the same amount of time to complete as if you just wrote out all the steps individually. Bottom line - you're not going to notice a difference. I'd use the loop because it probably makes your code easier to read. (2) When something is garbage collected is hard to say. Generally, an object will be eligible for garbage collection when there are no more references pointing to it. How and when that actually occurs depends on the rest of your code and garbage collection your individual device's JVM is running. Different versions of android os have different kinds of garbage collectors. Some more about garbage collectors can be found here and also here
score: 2
type: AcceptedAnswer
downvote count: 0
upvote count: 2
has comment: http://stackoverflow.com/comment/34647871

http://stackoverflow.com/comment/55931544
comment on: http://stackoverflow.com/a/22743541
score: 3
type: AnswerComment
has text: In an attempt to improve this answer: This is the 'Dictionary Lookup' (aonaware.com) API service index page - http://services.aonaware.com/DictService/DictService.asmx. The API for querying a specific word through all affiliated dictionaries can be inspected in this page: http://services.aonaware.com/DictService/DictService.asmx?op=Define. Also, a specific dictionary can be specified, here: http://services.aonaware.com/DictService/DictService.asmx?op=DefineInDict (the list of dictionaries is available here: http://services.aonaware.com/DictService/DictService.asmx/DictionaryList).
type: Comment

http://stackoverflow.com/q/22749221
has comment: http://stackoverflow.com/comment/34697377
answer count: 1
has comment: http://stackoverflow.com/comment/34717476
favorite count: 0
has answer: http://stackoverflow.com/a/22775813
tagged with: apache-felix
tagged with: osgi
type: UnansweredQuestion
has title: How can I generate multiple OSGi bundles from a single Maven project?
tagged with: maven
score: 2
downvote count: 0
has body: The basic problem is as such: I've got a project that already uses multiple Maven modules for various sub-projects. However, one of the modules (the core module) could itself be split into multiple OSGi bundles when created. This is due to the core module containing several optional dependencies, each of which have isolated Java packages where they're required. For instance, support for JSON input files are optional as they require the optional dependencies from Jackson. The classes that rely on the Jackson dependencies are all isolated to certain json packages within the module. Thus, in theory, I could create a minimal bundle from core that doesn't include the packages that rely on optional dependencies. Normally, I'd simply split up this module into more Maven modules to make life easier for creating bundles via Felix's maven-bundle-plugin. The problem here is that I still want to create a core JAR for non-OSGi users who don't want to have to include several extra JARs just to use optional functionality (which requires they provide the optional dependencies on the class path as it is). Not only that, but I don't wish to have to split up this module into more modules as it makes development on the project more tedious for the developers as well, especially when we're already splitting up code into proper package-based modules as it is. The way we were trying to use OSGi already was to make the API module a fragment host (in order to allow it to load a provider bundle without requiring OSGi support), then make the other bundles use said fragment host. This seemed to work well for the smaller modules outside of core, but for core, we wanted to be able to provide multiple bundles from a single module so that optional dependencies wouldn't be required in the bundle itself. As it stands, for plugins, we already have a mechanism for scanning them and ignoring plugins that don't have all the required classes to load them (e.g., if a plugin requires a JPA provider but the…
tagged with: java
type: Question
upvote count: 2

http://stackoverflow.com/comment/34691392
score: 0
type: Comment
type: QuestionComment
has text: @Marko Topolnik Is my test valid for synchronized?
comment on: http://stackoverflow.com/q/22756940

http://stackoverflow.com/comment/34585863
comment on: http://stackoverflow.com/a/22687853
type: AnswerComment
type: Comment
has text: Just had time to try it out and very pleased to say your first post with the int renderedCount works perfectly. Can't thank you enough i am really chuffed.
score: 0

http://stackoverflow.com/a/22678364
has body: firs create a child layout in that you can create your dynamic view.You can refer this link for adding dynamic views.
type: Answer
answers question: http://stackoverflow.com/q/22678056
score: 0

http://stackoverflow.com/a/22692935
has body: There are at least three problems: you modify the keys of the map, the hashCode of an array is reference-based, and there is a race condition here: check = wordCountMap.putIfAbsent(charArray, 1); if (check != null) { wordCountMap.put(charArray, wordCountMap.get(charArray) + 1); } Other answers address the hashing, so I'll tackle the race condition. putIfAbsent is atomic, but put(increment(get())) is not. You can fix this by using an AtomicInteger instead of a normal Integer: AtomicInteger check = wordCountMap.putIfAbsent(key.copy(), new AtomicInteger(1)); if (check != null) { check.incrementAndGet(); } There are allocations for the key and value here, but they will be easily garbage collected if the key is already present. If you wanted to avoid them, you could incur the overhead of an additional get(), or you could use one of the other suggestions in @Chip's answer.
answers question: http://stackoverflow.com/q/22674497
type: Answer
score: 0

http://stackoverflow.com/q/22785838
has comment: http://stackoverflow.com/comment/34742041
has comment: http://stackoverflow.com/comment/34742918
accepted answer: http://stackoverflow.com/a/22789180
score: 0
has answer: http://stackoverflow.com/a/22786053
tagged with: sql
has title: SQL-Database and Java
has answer: http://stackoverflow.com/a/22789180
has body: I read quite a few articles here about how to connect from java to a mysql database. Somehow, this does not work for me, and I cannot find out what I do wrong. First, here is my code: import java.sql.PreparedStatement; import java.sql.ResultSet; import java.sql.SQLException; import java.sql.Statement; import java.sql.Connection; import java.sql.DriverManager; class sqltest{ private static int uid = -1; protected static Connection dbConn = null; public static void main (String args[]){ try { Class.forName("org.gjt.mm.mysql.Driver").newInstance(); } catch (ClassNotFoundException e1) { // TODO Auto-generated catch block e1.printStackTrace(); } catch (InstantiationException e) { // TODO Auto-generated catch block e.printStackTrace(); } catch (IllegalAccessException e) { // TODO Auto-generated catch block e.printStackTrace(); } ResultSet rs = null; try{ dbConn = DriverManager.getConnection("jdbc:mysql://XXX.XXX.XX.XX:XXXX/peXXXXX","XXXXXX","XXXXXX"); PreparedStatement ps = dbConn.prepareStatement("select id from supervisor where username = philipp"); rs = ps.executeQuery(); uid = rs.getInt("id"); }catch(SQLException e){ e.printStackTrace(); } System.out.println(uid); } } The connection details (user, password, adress) are correct. There is only one thing I don't understand: There is already a java-web-applet which is establishing such a connection, and it uses no port (is this possible?). Now these are my errors that I get: When I use no port or the default 3306 port, i get this error: com.mysql.jdbc.CommunicationsException: Communications link failure due to underlying exception: ** BEGIN NESTED EXCEPTION ** java.net.ConnectException MESSAGE: Connection timed out: connect STACKTRACE: java.net.ConnectException: Connection timed out: connect at java.net.DualStackPlainSocketImpl.connect0(Native Method) at java.net.DualStackPlainSocketImpl.socketConnect(Unknown Source) at java.net.AbstractPlainSocketImpl.doConnect(Unknown Source) at java.net.AbstractPlainSocketImpl.connectT…
answer count: 5
has answer: http://stackoverflow.com/a/22786176
has answer: http://stackoverflow.com/a/22785985
tagged with: jdbc
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/34747590
has comment: http://stackoverflow.com/comment/34742092
possible better answer: http://stackoverflow.com/a/22785985
tagged with: java
has comment: http://stackoverflow.com/comment/34745613
tagged with: mysql
has answer: http://stackoverflow.com/a/22785987
type: Question

http://stackoverflow.com/comment/34595130
comment on: http://stackoverflow.com/q/22703643
score: 0
type: Comment
type: QuestionComment
has text: you can create `Handler` in UI thread and use `Handler.post( Runnable r )` inside your thread. But the best way is using AsyncTask

http://stackoverflow.com/comment/119968948
score: 0
has text: As with other similar answers - this absolutely works for me. But we are delivering a client application to customers and have no control over their hardware - how would you want to force these settings on customer machines?
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/27768329

http://stackoverflow.com/comment/34724947
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/22776172
has text: `as soon as one field's input is changed the other changes with it ` - A PropertyChangeListener is only fired when the change is committed on a formatted text field. Therefore, the DocumentListener would be the better choice so the changes occur as you type. Multiple events is not an issue

http://stackoverflow.com/a/22785992
has comment: http://stackoverflow.com/comment/34742268
score: 3
downvote count: 0
has body: The only code that can go outside a method is variable declarations and initializations. If you want to call a method you have to do it inside a method or constructor. public class MainActivity extends ListActivity { String item; DownloadXML a = new DownloadXML(); a.data(); //This won't work. Put it inside a method @Override protected void onCreate(Bundle savedInstanceState) { //... } Please try something like this: public class MainActivity extends ListActivity { String item; @Override protected void onCreate(Bundle savedInstanceState) { //... DownloadXML a = new DownloadXML(); a.data(); } }
accepted answer of: http://stackoverflow.com/q/22785910
answers question: http://stackoverflow.com/q/22785910
upvote count: 3
has comment: http://stackoverflow.com/comment/34742398
type: AcceptedAnswer
type: Answer

http://stackoverflow.com/a/22722728
has body: If you mean the whole equation to the power of, then: double years = 15; Math.pow(maturity, years); If you mean just the bracketed portion, then: double years = 15; double maturity = amountDeposited * (Math.pow((1 + interestRate / 100), years));
downvote count: 0
type: Answer
score: 3
upvote count: 3
answers question: http://stackoverflow.com/q/22722681

http://stackoverflow.com/comment/34613461
has text: it just give me an error telling me that it can't be done and no details
type: AnswerComment
comment on: http://stackoverflow.com/a/22714349
score: 0
type: Comment

http://stackoverflow.com/comment/34687949
type: QuestionComment
score: 1
has text: _"By Hashcode contract if hashcode is same then through equals method objects should be same."_ This is wrong! The opposite is true: If two objects are equal, then they must have the same hash code. The hash code method should make some effort to produce different hash codes for unequal objects, but they could be the same.
comment on: http://stackoverflow.com/q/22754299
type: Comment

http://stackoverflow.com/comment/34652382
type: Comment
has text: I don't get what you do you want to do. You want to calculate x pow n ? (what is count)
type: QuestionComment
comment on: http://stackoverflow.com/q/22735975
score: 0

http://stackoverflow.com/q/22731049
linked to: http://stackoverflow.com/q/541749
has comment: http://stackoverflow.com/comment/34659732
score: -3
has comment: http://stackoverflow.com/comment/34643816
tagged with: java
has body: I have a configuration file from where some values are coming ,in the file the data are present along with their types.I have to check the data which are coming from the configuration file is a String type or not.How can i do that..Here is my code for (String tagName : record.getAllTags().keySet()) { com.etl.core.model.fmtg.Tag t = record.getAllTags().get(tagName); md.put(t.getName().trim(), ""); } t.getName() is the name of the variables which are coming though the file and if i do t.getType() i will get the name of the type ... so how i can check the t.getName() is a String type or not
downvote count: 3
has title: How to check a varible is String type or not in java
type: Question
has answer: http://stackoverflow.com/a/22731092
has comment: http://stackoverflow.com/comment/34659333
has comment: http://stackoverflow.com/comment/34643677
has comment: http://stackoverflow.com/comment/34643750
has comment: http://stackoverflow.com/comment/34644152
upvote count: 0
answer count: 1
has comment: http://stackoverflow.com/comment/34644194
favorite count: 0
has comment: http://stackoverflow.com/comment/34659298
has comment: http://stackoverflow.com/comment/34643708
has comment: http://stackoverflow.com/comment/34643670
type: UnansweredQuestion

http://stackoverflow.com/comment/34535390
has text: Is leaving it (`super();`) is in bad taste?
score: 0
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/22670956

http://stackoverflow.com/comment/34673699
comment on: http://stackoverflow.com/q/22747855
score: 0
type: Comment
type: QuestionComment
has text: @Thomas if you express that as an answer, I will upvote it.

http://stackoverflow.com/comment/34579693
type: QuestionComment
comment on: http://stackoverflow.com/q/22695718
score: 0
has text: @Darwind So I'm looking for something like public class PetGuardLivingEntity extends CraftLivingEntity implements LivingEntity ?
type: Comment

http://stackoverflow.com/a/22742447
has body: Don't try to add an AdView as an element in a ListView. It is a recipe for pain as it will be entirely different to your other items with different needs. Add it as it's own element either above or below your ListView. Instead create a LinearLayout either above or below your ListView &lt;LinearLayout android:id="@+id/adViewContainer android:layout_width="match_parent" android:layout_height="wrap_content" /&gt; and then change this part of your onCreate to // Add the AdView to the view hierarchy. The view will have no size // until the ad is loaded. final ViewGroup adViewContainer = (ViewGroup) findViewById(R.id.adViewContainer); adViewContainer.addView(adView);
downvote count: 0
score: 1
accepted answer of: http://stackoverflow.com/q/22734742
answers question: http://stackoverflow.com/q/22734742
upvote count: 1
type: AcceptedAnswer
type: Answer

http://stackoverflow.com/a/22693030
answers question: http://stackoverflow.com/q/22687322
upvote count: 1
type: AcceptedAnswer
type: Answer
has comment: http://stackoverflow.com/comment/34699806
downvote count: 0
score: 1
has body: I would just join the association using createAlias et do a simple compare: session.createCriteria(Product.class) .createAlias("tags", "tag") .add( Restrictions.eq("tag", tag)) .list()
has comment: http://stackoverflow.com/comment/132381055
accepted answer of: http://stackoverflow.com/q/22687322

http://stackoverflow.com/a/22731478
has comment: http://stackoverflow.com/comment/34644471
upvote count: 3
answers question: http://stackoverflow.com/q/22731293
accepted answer of: http://stackoverflow.com/q/22731293
has body: The JVM specification is perhaps clearer on this. So for ifne (and ifeq etc) the restriction is: An ifeq instruction is type safe iff one can validly pop a type matching int off the incoming operand stack yielding the outgoing type state NextStackFrame, and the operand of the instruction, Target, is a valid branch target assuming an incoming type state of NextStackFrame. Whereas for ifnonnull the restriction is: An ifnonnull instruction is type safe iff one can validly pop a type matching reference off the incoming operand stack yielding the outgoing type state NextStackFrame, and the operand of the instruction, Target, is a valid branch target assuming an incoming type state of NextStackFrame. Basically ifeq and ifne are for integer values, whereas ifnonnull is for a reference value. To compare two references for equality, you use if_acmpeq instead. ifnonnull is effectively a special case of that where there's only one operand, because it's always just compared with null. In terms of how the null reference is represented in data, the JVM specification explicitly allows this to be implementation-specific: A reference value may also be the special null reference, a reference to no object, which will be denoted here by null. The null reference initially has no run-time type, but may be cast to any type. The default value of a reference type is null. The Java Virtual Machine specification does not mandate a concrete value encoding null.
score: 3
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/34644561
type: Answer

http://stackoverflow.com/q/22749350
has comment: http://stackoverflow.com/comment/34676392
linked to: http://stackoverflow.com/q/1432245
type: UnansweredQuestion
tagged with: postfix-notation
has answer: http://stackoverflow.com/a/22750378
has comment: http://stackoverflow.com/comment/72092301
tagged with: swing
has answer: http://stackoverflow.com/a/22749650
tagged with: java
has body: Stack&lt;String&gt; s = new Stack&lt;String&gt;(); String[] tokens = infix.split(" "); Right now I am making a calculator that accepts infix strings to calculate it, but they have to be separated by spaces, how do i make it where the postfix evaluator can accept no spaces. I.E. I have to do this 5 + 5 * sin ( 32 ) But I want it to accept that or 5+5*sin(32)
tagged with: jtextfield
type: Question
answer count: 2
has title: How do I make JTextField to accept no spaces from postfix string
tagged with: infix-notation
score: 0
has comment: http://stackoverflow.com/comment/34685384

http://stackoverflow.com/comment/34735496
type: Comment
comment on: http://stackoverflow.com/a/22781315
score: 0
type: AnswerComment
has text: I feel that this line View rootView = getWindow().getDecorView().getRootView(); is creating a problem.

http://stackoverflow.com/a/22691683
downvote count: 0
upvote count: 8
has body: They changed the sort algorithm of Arrays.sort for Java 7. For sorting objects, Arrays.sort now uses algorithm called Timsort and dual-pivot quicksort for primitives. More info in this answer. If you really want to use the old one, apparently you can set a system property java.util.Arrays.useLegacyMergeSort. See Java 7 compatibility documentation.
answers question: http://stackoverflow.com/q/22691435
has comment: http://stackoverflow.com/comment/34572730
type: Answer
has comment: http://stackoverflow.com/comment/34572222
score: 8

http://stackoverflow.com/q/22695718
type: Question
has comment: http://stackoverflow.com/comment/34580161
score: 0
answer count: 2
tagged with: minecraft
has body: This is probably basic java, but I'm new to the language, so please forgive me I would like to extend the SetCustomName method of LivingEntity so that, in addition to it's normal steps, it will also throw a custom event/exception. My attempts to do this result in errors regarding abstract, and can't have body. In addition, I can't tell if this is a class or an interface, which means I'm not sure if I should use extends or implements. Finally, I'm looking to add this functionality, rather then create a new object. Can you please tell me if this is possible / steer me in the correct direction? Thank you very much for the help.
has comment: http://stackoverflow.com/comment/34579693
has answer: http://stackoverflow.com/a/22695865
has comment: http://stackoverflow.com/comment/34580115
has comment: http://stackoverflow.com/comment/34579619
has comment: http://stackoverflow.com/comment/34579939
has title: Extending a method on an interface
accepted answer: http://stackoverflow.com/a/22695865
has comment: http://stackoverflow.com/comment/34579865
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/34579973
possible better answer: http://stackoverflow.com/a/22697304
tagged with: java
tagged with: bukkit
has answer: http://stackoverflow.com/a/22697304
has comment: http://stackoverflow.com/comment/34579812

http://stackoverflow.com/a/22815418
has body: I've worked around this by grabbing the two packages needed: http://ftp.uk.debian.org/debian/pool/main/t/tzdata/tzdata_2013i-0wheezy1_all.deb and http://ftp.uk.debian.org/debian/pool/main/t/tzdata/tzdata-java_2013i-0wheezy1_all.deb Then installing them with dpkg -i *deb which fixes the deps so I can then re-run my apt-get install openjdk-6-jre-headless and it'll complete. This has allowed me to install Jetty, which had tzdata-java as a nested dependency. Hope it works for you. Edit: just seen ckonig's post, perfect! Thanks for sharing that.
score: 1
downvote count: 0
type: Answer
answers question: http://stackoverflow.com/q/22695459
upvote count: 1

http://stackoverflow.com/q/22684795
accepted answer: http://stackoverflow.com/a/22685169
has answer: http://stackoverflow.com/a/22685953
tagged with: maven
upvote count: 1
possible better answer: http://stackoverflow.com/a/22685953
type: AnsweredQuestion
score: 1
tagged with: java
type: Question
has title: Add JAR-File to web-inf/lib folder without including it in pom.xml
answer count: 2
has answer: http://stackoverflow.com/a/22685169
downvote count: 0
tagged with: jar
favorite count: 0
has body: I am writing an application server using JBoss. The application gets compiled by Maven and packaged as WAR. Now I want to externalize some classes. I create another maven project, which is packaged as JAR. The JAR has the correct directory tree, I believe. It contains a META-INF directory and the package structure as directories, in which the class files reside. I read on the web that I can add this JAR into the app server by placing it into src\main\webapp\WEB-INF\lib without further mentioning it in the pom.xml of the appserver (at some point these JARs shall be plugins, so adding a dependency in the pom.xml is not an option). When I compile the server, the JAR gets correctly copied into the WAR under WEB-INF\lib, along with other external dependencies. However, when I try to use the class in the appserver, (writing an import statement of such a class is enough), maven will complain that it can't find the class. I tried to find information on the web, but all I could find was that this is the way it's to be done. Does anyone know where I could further look for clues what's going wrong?

http://stackoverflow.com/a/22730421
type: Answer
upvote count: 1
has body: In first case (s.substring(5)), Oracle docs says ... IndexOutOfBoundsException - if beginIndex is negative or larger than the length of this String object. ... In second case (s.substring(5,5)), it says that ... IndexOutOfBoundsException - if the beginIndex is negative, or endIndex is larger than the length of this String object, or beginIndex is larger than endIndex ...
downvote count: 0
score: 1
answers question: http://stackoverflow.com/q/22730316

http://stackoverflow.com/comment/34572024
comment on: http://stackoverflow.com/q/22691718
has text: Substring, change, concat.
type: Comment
type: QuestionComment
score: 0

http://stackoverflow.com/q/22776866
accepted answer: http://stackoverflow.com/a/22776876
score: -2
has comment: http://stackoverflow.com/comment/34726804
possible better answer: http://stackoverflow.com/a/22776888
has answer: http://stackoverflow.com/a/22776888
has body: Well hello guys, i'm starting the programmer life now, i'm really new into it, but i'm trying really, really hard and i'm making some easy programs to run on eclipse console, it's very simples 'cause i'm just getting started... well, everything went out ok, except for this one program, i can't make it work in no way... i'm gonna put it all here so if there's anything really, really wrong tell me, and i'm also going to expecific the problem that eclipse found... Here it is: public class Pagamento { public static void main(String[] args) { int vvalor; int vpagto; int vtroco; String voperador; vvalor = 200; vpagto = 250; voperador = -; if (vpagto &gt; vvalor){ System.out.println ("Troco:" + vpagto - vvalor); }if (vpagto = vvalor ){ System.out.println ("Troco:" + 0); }if (vpagto &lt; vvalor){ System.out.println ("Transação inconcluída!"); } } } I had to define the " - " 'cause it asked to (when i did it, it said in the first System.out.println, that 'the operator - is undefined for the argument type(s) String, int and in the line' "}if (vpagto = vvalor ){" it appeared the error "can't convert from int to boolean), and when i did defined, it just gave this error on the line "voperador = -;": Syntax error on token "-", Expression expected after this token. What does that mean ? Is everything so wrong ? What should i do to fix it ? Please help me, i try to search but i found nothing like this here, nothing that could solve my problem... thanks and please help !
has answer: http://stackoverflow.com/a/22776899
has answer: http://stackoverflow.com/a/22776901
favorite count: 0
has comment: http://stackoverflow.com/comment/34726245
has answer: http://stackoverflow.com/a/22776876
answer count: 4
has comment: http://stackoverflow.com/comment/34726718
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/34726959
tagged with: java
has title: Java: Syntax error on token "-", Expression expected after this token
downvote count: 3
upvote count: 1
type: Question

http://stackoverflow.com/q/22686210
type: UnansweredQuestion
tagged with: java
tagged with: http://stackoverflow.com/tag/json
tagged with: gson
type: Question
has comment: http://stackoverflow.com/comment/34562011
has title: Using Json And Gson In java web Applications
score: 0
answer count: 2
has answer: http://stackoverflow.com/a/22686371
tagged with: jsp
has answer: http://stackoverflow.com/a/22686431
has body: Hi could anyone please explain me,When we need to use JSon or Gson. What would be the scenario?Could it possible to use Gson or Json in request scope attribute or only during ajax response in the application.

http://stackoverflow.com/a/25502946
type: Answer
has body: Well, for some reason Jama is incorrect (columns don't have norm of 1). The reordering and change of sign is normal (you're just getting orthogonal vectors that map to eigenval * themselves). You could try normalizing the columns or using jlapack.
answers question: http://stackoverflow.com/q/22672172
score: 0

http://stackoverflow.com/a/57917393
answers question: http://stackoverflow.com/q/22729774
downvote count: 0
has body: In my case, standalone.xml was corrupted (probably cause Idea froze and had to do hard shutdown). So I went to standalone_xml_history and copied standalone.xml from the day before. And it started to work normally again.
type: Answer
score: 2
upvote count: 2

http://stackoverflow.com/comment/34628139
type: Comment
score: 0
comment on: http://stackoverflow.com/a/22722101
has text: Okay thanks for helping me, but when I changed that it is says that it "cannot find the symbol for the variable get"
type: AnswerComment

playframework
tags question: http://stackoverflow.com/q/22792043
tags question: http://stackoverflow.com/q/22807711
tags question: http://stackoverflow.com/q/22796049
tags question: http://stackoverflow.com/q/22666762
tags question: http://stackoverflow.com/q/22765364
tags question: http://stackoverflow.com/q/22674084
tags question: http://stackoverflow.com/q/22656909
tags question: http://stackoverflow.com/q/22791538
tags question: http://stackoverflow.com/q/22653130
tags question: http://stackoverflow.com/q/22662824
tags question: http://stackoverflow.com/q/22672819
tags question: http://stackoverflow.com/q/22653475
tags question: http://stackoverflow.com/q/22766493
tags question: http://stackoverflow.com/q/22682599
type: Tag
tags question: http://stackoverflow.com/q/22785415
tag name: playframework

http://stackoverflow.com/q/22786149
has body: As We all know, modulo operation finds the remainder of division of one number by another. I'm strruggling to figure out the correct way to get value of modulo. a mod b = c It's easy to find c if a >= 0. But, if a &lt; 0, it's confusing me. One day, I read in my lecturer notes if -75 mod 26 = 3. Then, I create a simple program in java to find the result of -75 mod 26. The program compiles and prints result: -23. So, what is the right way to find c if a &lt; 0? Belows is code I've tried: public class modulo { public static void main(String [] args){ int divide = -75; int val = divide % 26; System.out.println(divide+" % 26 = "+ val); } }
tagged with: java
has comment: http://stackoverflow.com/comment/34742644
has answer: http://stackoverflow.com/a/22786474
answer count: 1
tagged with: number-theory
tagged with: modulo
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/34742670
score: 2
has comment: http://stackoverflow.com/comment/34742591
downvote count: 0
favorite count: 0
linked to: http://stackoverflow.com/q/4403542
type: Question
upvote count: 2
has title: correct way to find the result of modulo
duplicate of: http://stackoverflow.com/q/4403542

http://stackoverflow.com/comment/34516214
type: Comment
type: QuestionComment
has text: i have already checked them but nothing solving my problem...
comment on: http://stackoverflow.com/q/22660096
score: 0

apache
tags question: http://stackoverflow.com/q/22709774
tag name: apache
tags question: http://stackoverflow.com/q/22720084
tags question: http://stackoverflow.com/q/22656889
tags question: http://stackoverflow.com/q/22690260
tags question: http://stackoverflow.com/q/22805854
tags question: http://stackoverflow.com/q/22709240
tags question: http://stackoverflow.com/q/22743724
tags question: http://stackoverflow.com/q/22730854
tags question: http://stackoverflow.com/q/22714650
tags question: http://stackoverflow.com/q/22660096
tags question: http://stackoverflow.com/q/22791006
tags question: http://stackoverflow.com/q/22768037
tags question: http://stackoverflow.com/q/22652478
tags question: http://stackoverflow.com/q/22722085
tags question: http://stackoverflow.com/q/22683492
tags question: http://stackoverflow.com/q/22768398
type: Tag
tags question: http://stackoverflow.com/q/22719659
tags question: http://stackoverflow.com/q/22800983

http://stackoverflow.com/comment/34498324
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/22648682
has text: The only way to automatically convert matlab to c is [this](http://www.mathworks.com/products/matlab-coder/) product, as far as I'm aware. I haven't used it, but maybe you can try out a free trial.

http://stackoverflow.com/comment/34986619
comment on: http://stackoverflow.com/a/22920719
has text: On the links. First Link: I've tried that, but to no avail as with that option eclipse tries to initialize Java Tools however never actually accomplishes it. It stays at 1% for over an hour. Second Link: I've tried that option, but first of all I have two versions of eclipse on my computer. First one is the regular eclipse and the second one is the Android Developer Package(I think that is what it is called.)
type: AnswerComment
type: Comment
score: 0

http://stackoverflow.com/comment/34556158
score: 0
type: Comment
type: QuestionComment
has text: Thanx, using `File.pathSeparator` saves 5 lines of code :-)
comment on: http://stackoverflow.com/q/22681544

http://stackoverflow.com/q/22685574
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/22685650
has answer: http://stackoverflow.com/a/22685613
has title: Why can't I create a parameterless subclass constructor when the baseclass has a constructor with a parameter?
tagged with: java
has answer: http://stackoverflow.com/a/44304853
downvote count: 1
has answer: http://stackoverflow.com/a/22685673
type: Question
upvote count: 5
has answer: http://stackoverflow.com/a/22685666
tagged with: inheritance
has answer: http://stackoverflow.com/a/22685690
score: 4
has body: I know the following doesn't work, but can you help me understand why? class A { A(int x) { System.out.println("apel constructor A"); } } class B extends A { B() { System.out.println("apel constructor B"); } } public class C { public static void main(String args[]) { B b = new B(); } }
possible better answer: http://stackoverflow.com/a/22685666
has answer: http://stackoverflow.com/a/22685598
has answer: http://stackoverflow.com/a/22685650
has answer: http://stackoverflow.com/a/22685686
favorite count: 0
tagged with: constructor
answer count: 9
has comment: http://stackoverflow.com/comment/34561035
has answer: http://stackoverflow.com/a/22685727

http://stackoverflow.com/q/22677146
tagged with: java
has comment: http://stackoverflow.com/comment/34549951
type: Question
has comment: http://stackoverflow.com/comment/34548210
has answer: http://stackoverflow.com/a/22679217
score: 0
has title: Action bar to launch side menu doesn't work
has comment: http://stackoverflow.com/comment/34547580
answer count: 1
tagged with: menu
has comment: http://stackoverflow.com/comment/34548027
has comment: http://stackoverflow.com/comment/34547190
tagged with: android
tagged with: android-actionbar
has comment: http://stackoverflow.com/comment/34547557
has comment: http://stackoverflow.com/comment/34549747
has comment: http://stackoverflow.com/comment/34548961
accepted answer: http://stackoverflow.com/a/22679217
has comment: http://stackoverflow.com/comment/34548089
has body: Hello all I have a side menu within my fragment that should be launched with a click of the action bar. It was working ever since I set it until now and even if I undo all the changes I made it still doesn't work. The menu slides out from the left with the gesture but clinking the icon on the action bar doesn't launch it or even highlight anymore. any help is appreciated main activity that contains the side menu public class MainActivity extends FragmentActivity { private DrawerLayout mDrawerLayout; private ListView mDrawerList; private ActionBarDrawerToggle mDrawerToggle; // nav drawer title private CharSequence mDrawerTitle; // used to store app title private CharSequence mTitle; // slide menu items private String[] navMenuTitles; private TypedArray navMenuIcons; private ArrayList&lt;NavDrawerItem&gt; navDrawerItems; private NavDrawerListAdapter adapter; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); mTitle = mDrawerTitle = getTitle(); // load slide menu items navMenuTitles = getResources().getStringArray(R.array.nav_drawer_items); // nav drawer icons from resources navMenuIcons = getResources() .obtainTypedArray(R.array.nav_drawer_icons); mDrawerLayout = (DrawerLayout) findViewById(R.id.drawer_layout); mDrawerList = (ListView) findViewById(R.id.list_slidermenu); navDrawerItems = new ArrayList&lt;NavDrawerItem&gt;(); // adding nav drawer items to array // Home navDrawerItems.add(new NavDrawerItem(navMenuTitles[0], navMenuIcons.getResourceId(0, -1))); // Find People navDrawerItems.add(new NavDrawerItem(navMenuTitles[1], navMenuIcons.getResourceId(1, -1))); // Photos navDrawerItems.add(new NavDrawerItem(navMenuTitles[2], navMenuIcons.getResourceId(2, -1), true, "22")); // Communities, Will add a counter here navDrawerItems.add(new NavDrawerItem(navMenuTitles[3], navMenuIcons.getResourceId(3, -1))); // Pages navDrawerItems.add(new NavDrawerItem(navMenuTitles[4], navMenuIcons.g…
type: AnsweredQuestion

http://stackoverflow.com/a/22720708
accepted answer of: http://stackoverflow.com/q/22719547
score: 5
answers question: http://stackoverflow.com/q/22719547
type: AcceptedAnswer
upvote count: 5
type: Answer
downvote count: 0
has body: Found a solution. I've split the String and used BooleanQuery. Thanks to @thomas. Here is my code: Splitting: String[] arrKeywords = keywords.split(" "); this.search(Arrays.asList(arrKeywords)); And then, searching: public List&lt;Person&gt; search(String keywordsList) throws DAOException { try { FullTextEntityManager fullTextEm = Search.getFullTextEntityManager(this.entityManager); QueryBuilder qb = fullTextEm.getSearchFactory().buildQueryBuilder().forEntity(Person.class).get(); List&lt;Query&gt; queryList = new LinkedList&lt;Query&gt;(); Query query = null; for (String keyword : keywordsList) { query = qb.keyword().onFields("name", "email", "username", "phone").matching(keyword).createQuery(); queryList.add(query); } BooleanQuery finalQuery = new BooleanQuery(); for (Query q : queryList) { finalQuery.add(q, Occur.MUST); } FullTextQuery fullTextQuery = fullTextEm.createFullTextQuery(query); fullTextQuery.setProjection("name", "email", "username", "phone"); Sort sortField = new Sort(new SortField("name_order", SortField.STRING)); fullTextQuery.setSort(sortField); return fullTextQuery.getResultList(); } catch (Exception e) { logger.error("Error searching index: " + keywords, e); throw new DAOException(e); } }

http://stackoverflow.com/comment/34614460
type: AnswerComment
has text: @Completely_new_to_java then you can write it line by line, as my newest update
type: Comment
comment on: http://stackoverflow.com/a/22714584
score: 0

http://stackoverflow.com/comment/34719404
score: 0
type: Comment
comment on: http://stackoverflow.com/a/22772704
has text: Ok that opens up a new problem now though. The process request loads all of the things to the option list. I cant have it in the doGet now because there is an error thrown. I want to start at the index.jsp click add customer and it go to that form and the lists load.
type: AnswerComment

http://stackoverflow.com/q/22650310
tagged with: adjacency-list
has comment: http://stackoverflow.com/comment/34499006
upvote count: 2
tagged with: nullpointerexception
answer count: 1
has body: I just started working with graphs and I am trying to build a adjacency list using cities. The two cities are sent into the addRelation method. I am trying say that if there already isn't a vertex that matches the first or last string, create a new vertex with the string that doesn't already exist. Right now all I get is a null pointer exception at the line with the *. Does anyone have any ideas on what I am doing wrong or what I should be doing? public class AdjList { public class Node{ int num; Node next; Node(int num, Node next){ this.num=num; this.next=next; } } public class Vertex{ String city; Node list; Vertex(String city, Node next){ this.city=city; this.list=next; } } Vertex [] aList= new Vertex [50]; void addRelation(String from, String to) { for(int i=0; i&lt;aList.length; i++){ ****if(!aList[i].city.equals(from)){**** aList[i]=new Vertex(from, null); } if(aList[i].city.equals(from)){ aList[i]=new Vertex(from, null); } } } Main: public static void main(String args[]) { AdjList g = new AdjList (); g.addRelation("Atlanta", "Chattanooga"); g.addRelation("Chattanooga", "Nashville"); g.addRelation("Chattanooga", "Knoxville"); g.addRelation("Atlanta", "Birmingham"); g.addRelation("Greenville", "Knoxville"); }
favorite count: 0
has comment: http://stackoverflow.com/comment/34499023
has title: Adjacency List add relations
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/34498990
has comment: http://stackoverflow.com/comment/34499092
score: 2
has comment: http://stackoverflow.com/comment/34499083
downvote count: 0
tagged with: java
type: Question
has comment: http://stackoverflow.com/comment/34498961
tagged with: graph
has answer: http://stackoverflow.com/a/22650471

http://stackoverflow.com/comment/34781908
comment on: http://stackoverflow.com/a/22807590
score: 0
type: Comment
has text: how can i change in chrome
type: AnswerComment

http://stackoverflow.com/q/22666935
tagged with: objectify
answer count: 3
has body: It turns out that retrieving low level datastore entities that are stored memcache is painfully slow. Since objectify caches entities as the low level datastore Entity type, this results in poor performance when fetching many entities from memcache using objectify. The real question is why is it slow to deserialize the Entity type from memcache? I put together a sample project to demonstrate the disparity in retrieving Entities from memcache vs plain strings or a simple Map. Here's the code: https://github.com/aleemstreak/perftest or the relevant file: https://github.com/aleemstreak/perftest/blob/master/src/com/rewardly/perftest/PerftestServlet.java Also, I deployed it so you can see how big a difference this is in production: aleemsandbox.appspot.com/perftest . Its a naive profiler but it does show a huge disparity in performance. Refresh the page a few times to see the difference. Here is some sample output: Storing String Data Test ------------------------- generateData: 0ms storeData: 10ms fetchData: 9ms Storing Map Data Test ------------------------- generateData: 0ms storeData: 21ms fetchData: 92ms Storing Entity Data Test ------------------------- generateData: 69ms storeData: 24ms fetchData: 792ms The first section shows the time it takes to store 1000 strings in memcache and then fetch it right back. The next example does the same for 1000 Map objects and finally the last example stores and retrieves 1000 low level Entity types. You can see the huge time increase to retrieve Entity types. Any ideas why entities could be slow to deserialize from memcache? UPDATE 1 Following a suggestion in one of the answers, I also logged the cumulative size of the objects being stored in memcache and the results no print them out. I also added one other test case - instead of storing an Entity directly, instead, I serialize the Entity to a byte[] myself first, then store it in memcache. Here are the results: StringBenchmark ---------------- Average Fetch Time: 40.16ms Fetc…
tagged with: google-app-engine
has comment: http://stackoverflow.com/comment/34551916
linked to: http://stackoverflow.com/q/15147407
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/22668266
has comment: http://stackoverflow.com/comment/34551978
has answer: http://stackoverflow.com/a/22700016
has answer: http://stackoverflow.com/a/24438695
upvote count: 5
tagged with: java
has comment: http://stackoverflow.com/comment/34528039
type: Question
score: 5
has title: Slow deserialization when fetching low level datastore Entity objects from Memcache
has comment: http://stackoverflow.com/comment/34542143
downvote count: 0
tagged with: deserialization
favorite count: 0
tagged with: entity

http://stackoverflow.com/q/22719126
answer count: 6
score: 0
tagged with: nullpointerexception
has answer: http://stackoverflow.com/a/22719205
has answer: http://stackoverflow.com/a/22719184
tagged with: initialization
has comment: http://stackoverflow.com/comment/34622666
favorite count: 0
has comment: http://stackoverflow.com/comment/34626366
has comment: http://stackoverflow.com/comment/34625662
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/34625297
upvote count: 1
has comment: http://stackoverflow.com/comment/34622345
has comment: http://stackoverflow.com/comment/34623351
has body: I understand that trying to compare the value of an Object that's null with something will result in a NullPointerException, e.g., String bob; if(bob.equals("blahblahblah")){do_something();} and that it's a good idea to use nested checks like so: if(!bob.equals(null)){ if bob.equals("blah blah blah"){ do_something(); } } But if I haven't given bob any value yet, I get an error when I run the above saying bob hasn't been initialized - since I'm comparing bob to null, I should be able to run this without a problem, shouldn't I? Thanks.
has answer: http://stackoverflow.com/a/22719447
has answer: http://stackoverflow.com/a/22719182
has answer: http://stackoverflow.com/a/22719230
has comment: http://stackoverflow.com/comment/34634627
tagged with: java
has answer: http://stackoverflow.com/a/22719239
downvote count: 1
type: Question
has comment: http://stackoverflow.com/comment/34622206
linked to: http://stackoverflow.com/q/218384
has comment: http://stackoverflow.com/comment/34622800
has comment: http://stackoverflow.com/comment/34622417
has comment: http://stackoverflow.com/comment/34622443
tagged with: null
has title: Null Pointer Exceptions in Java

http://stackoverflow.com/comment/34672875
type: AnswerComment
score: 0
comment on: http://stackoverflow.com/a/22747416
has text: I don't know what you mean by double array, but you can't stick an entire array of `House`s in a single `House`, which is what that code is trying to do.
type: Comment

http://stackoverflow.com/comment/34509445
type: QuestionComment
type: Comment
has text: I was intrigued by the `Servlet web service endpoint '' failure.` that you had a servlet, But I could be wrong of course. Maybe the code you posted is not the one giving you problems, but its hard to know because the string which could help identify the faulty code is empty. `@WebService` has a few properties: http://docs.oracle.com/javaee/6/api/javax/jws/WebService.html Try setting them like `name="a", serviceName="b", ...`, then if a letter appears in the log, you know the annotation was the culprit and which property was missing.
score: 0
comment on: http://stackoverflow.com/q/22655826

http://stackoverflow.com/q/22666419
has comment: http://stackoverflow.com/comment/34564759
type: Question
has comment: http://stackoverflow.com/comment/34557066
tagged with: callback
has comment: http://stackoverflow.com/comment/34570038
tagged with: ajax
has title: Wicket Ajax Callback URL invalid after navigating back
score: 0
answer count: 0
type: UnansweredQuestion
tagged with: wicket
has body: I'm using Wicket 6.xx. The problem: Given Panel with an AbstractAjaxBehavior: public class Foo extends Panel { private AbstractAjaxBehavior cbUrl; public Foo(String id) { super(id); cbUrl = new AbstractAjaxBehavior() { //... onRequest Override with JSON body } add(cbUrl); } @Override public void renderHead(IHeaderResponse response) { super.renderHead(response); response.render(OnDomReadyHeaderItem.forScript("executeSomeCode('" + cbUrl.getCallbackUrl().toString() + "');")); } } On initial pageload, everything works fine as intended. But when navigated to another page using a Link and coming back using the browsers back button, the callback url becomes invalid and returns the pages html code instead of the JSON. Am i missing some important step in the Ajax configuration?
has comment: http://stackoverflow.com/comment/34598438
tagged with: java

http://stackoverflow.com/comment/34782501
comment on: http://stackoverflow.com/a/22807363
type: Comment
score: 0
type: AnswerComment
has text: True that. Don't really know which answer is correct.

http://stackoverflow.com/a/22793516
score: 4
type: AcceptedAnswer
answers question: http://stackoverflow.com/q/22793191
accepted answer of: http://stackoverflow.com/q/22793191
type: Answer
upvote count: 4
downvote count: 0
has body: Hope this will clear it out. public void map(LongWritable key, Text value, Context context) throws IOException, InterruptedException { // We use this to get the String representation of the Text data type which is // more suitable for distributed processing. String line = value.toString(); // A tokenizer tokenizes (or divides) a sentence into individual words. It is // deprecated though (not used anymore), so we should use line.split() // String[] tokens = line.split(); StringTokenizer tokenizer = new StringTokenizer(line); // The tokenizer gives out a boolean (true or false) based on whether it has // more tokens (words) or not. If split() is used, we can use a for loop. // for (String token : tokens) { // word.set(token); while (tokenizer.hasMoreTokens()) { // I am guessing word is of Text type. Since like I previously said, Text // data type is more suitable for distributed computing, we are converting // the String token we have into text type. We have to define the word // variable somewhere though. // If split() is used, we can write word.set(token); word.set(tokenizer.nextToken()); } // Context is something which lets you pass key-value pairs forward. Once you // write them using a Context object, the shuffle is performed and after the // shuffle, they are grouped by key and each key along with its values is // passed to the reducer. context.write(word, one); }

http://stackoverflow.com/comment/34725144
has text: I did this: public static BufferedImage loadImage(String fileName) { InputStream is = ImageLoader.class.getResourceAsStream("/resource/images/alphabet.png"); Image image; try { image = ImageIO.read(is); JLabel label = new JLabel(new ImageIcon(image)); JOptionPane.showMessageDialog(null, label); } catch (IOException e1) { // TODO Auto-generated catch block e1.printStackTrace(); }} Still have a null pointer on the line ImageIO.read(is);
type: AnswerComment
score: 0
type: Comment
comment on: http://stackoverflow.com/a/22776231

http://stackoverflow.com/a/22699338
score: 2
has body: If you use the Reflections java library, you can do this: SubTypesScanner sts = new SubTypesScanner(false); /* false means include direct Object subtypes in results.*/ Reflections reflections = new Reflections("Your.package.name", sts); Set&lt;Class&lt;? extends Object&gt;&gt; classes = reflections.getSubTypesOf(Object.class); for (Class&lt;? extends Object&gt; clazz : classes) { System.out.println(clazz); }
has comment: http://stackoverflow.com/comment/34587654
upvote count: 2
type: AcceptedAnswer
downvote count: 0
accepted answer of: http://stackoverflow.com/q/22699250
answers question: http://stackoverflow.com/q/22699250
type: Answer

http://stackoverflow.com/q/22800593
favorite count: 0
has body: We're using App Game Kit for one of our apps and trying to remove AdMob so we can go with Chartboost. AGK uses an interpreter for their language that passes through NDK to java. They have a class called AGKHelper which is the entry point for the commands that currently call Facebook, AdMob, an alert dialogue and some other activities. Each of the methods in AGKHelper run events through Runnable classes. Here's an example of their procedure to make an alert dialogue: public class AGKHelper { //just a sample of what's in there many other methods exist public static void ShowMessage( Activity act, String msg ) { RunnableMessage run = new RunnableMessage(); run.act = act; run.msg = msg; act.runOnUiThread( run ); } } Now the RunnableMessage class that creates the alert dialogue. class RunnableMessage implements Runnable { public Activity act; public String msg; public void run() { AlertDialog alertDialog; alertDialog = new AlertDialog.Builder(act).create(); alertDialog.setTitle("Message"); alertDialog.setMessage(msg); alertDialog.setButton( DialogInterface.BUTTON_POSITIVE, "OK", new DialogInterface.OnClickListener(){public void onClick(DialogInterface dialog, int which) {}}); alertDialog.show(); } } There also exists a CreateAd() method that makes ads for AdMob using runOnUiThread(), but with a WindowManager to show the ads. As far as we can tell we MUST use Runnable to get the activity going for Chartboost. We followed Chartboost's SDK integration and we get stuck at creating our Runnable for it. All of the Runnables that AGKHelper uses also refer back to the NativeActivity by, we believe, passing it as a parameter to the method like ShowMessage() and then doing something with it in the Runnable class for each of these methods. Such as AlertDialog.Builder(act) //for the message ad = new AdView(act, AdSize.BANNER, pubID); //for AdMob - RunnableAd feed.dialog(act, "feed", parameters,new DialogListener() {} // for RunnableFacebook Unfortunately there doesn't appear to be a…
type: Question
has title: Android runOnUIThread for Chartboost SDK integration for AGK AppGameKit NDK
tagged with: android
tagged with: chartboost
tagged with: java
tagged with: multithreading
has answer: http://stackoverflow.com/a/22882971
upvote count: 1
answer count: 1
tagged with: android-ndk
accepted answer: http://stackoverflow.com/a/22882971
type: AnsweredQuestion
downvote count: 0
score: 1

http://stackoverflow.com/a/22707395
score: 0
type: Answer
has body: For the first part of the question: I want the expandable listview to expand one of its groups and select one of its child by default when the activity opens up mExpandableListView.setSelectedChild(groupPosition, childPosition, shouldExpandGroup); where : groupPosition is the position of the group that should be expanded first position of the child that should be selected by default *More info below shouldExpandGroup is a boolean that should be set to true to expand the group Info for 2 above. Maintain a hashmap containing the group postion and the child position selected by the user like: HashMap&lt;Integer, Integer&gt; map = new HashMap&lt;Integer, Integer&gt;(); map.put(groupPosition, childPosition); For every child selection simply put it into the hashmap, it would overwrite the value if present Store this hashmap either in a file or somewhere where you can access it again (may be shared preference but it does not allow storage of objects) When the activity starts get the value from the hashmap, and set the selection, you could set the selection for all the groups but with shouldExpand to false for all except the first. If the map is empty set default selection to 0.
has comment: http://stackoverflow.com/comment/34608263
has comment: http://stackoverflow.com/comment/34637633
has comment: http://stackoverflow.com/comment/34637470
has comment: http://stackoverflow.com/comment/34604615
has comment: http://stackoverflow.com/comment/34637334
has comment: http://stackoverflow.com/comment/34606981
has comment: http://stackoverflow.com/comment/34604798
has comment: http://stackoverflow.com/comment/34612122
has comment: http://stackoverflow.com/comment/34608102
has comment: http://stackoverflow.com/comment/34637403
has comment: http://stackoverflow.com/comment/34605104
has comment: http://stackoverflow.com/comment/34604719
has comment: http://stackoverflow.com/comment/34611950
accepted answer of: http://stackoverflow.com/q/22705903
type: AcceptedAnswer
answers question: http://stackoverflow.com/q/22705903

http://stackoverflow.com/comment/34719677
score: 0
type: Comment
comment on: http://stackoverflow.com/a/22768903
type: AnswerComment
has text: Thanks! im testing it, now how i print to string the new array? I've tried with String s = newArray.toString(); TextView text = (TextView) findViewById(R.id.texto); text.setText(s); But it gives me an error from ADT.

http://stackoverflow.com/comment/34683918
comment on: http://stackoverflow.com/a/22753303
type: Comment
type: AnswerComment
has text: @DavidWallace pre-decrement?
score: 0

serial-port
tags question: http://stackoverflow.com/q/22775483
type: Tag
tags question: http://stackoverflow.com/q/22757792
tags question: http://stackoverflow.com/q/22781613
tag name: serial-port
tags question: http://stackoverflow.com/q/22756578

http://stackoverflow.com/a/22784397
type: Answer
score: 1
has body: You made too many .get calls. Probably the last one is not needed. Can you just create class CompoundKey with arbitrary number of String fields and use it as a key? It would simplify your design. To use it properly in Java you need to override hashCode and equals methods.
upvote count: 1
has comment: http://stackoverflow.com/comment/34739252
downvote count: 0
answers question: http://stackoverflow.com/q/22784231

http://stackoverflow.com/a/22763889
score: 1
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/22763769
answers question: http://stackoverflow.com/q/22763769
upvote count: 1
type: Answer
has body: Auto redirection works automatically when original and redirected protocols are same. So, try to load images from https instead of http : "https://graph.facebook.com/USER_ID/picture"; since actual image's url is "https://fbcdn-profile-a.akamaihd.net/...."
downvote count: 0

http://stackoverflow.com/comment/34501419
score: 0
type: Comment
comment on: http://stackoverflow.com/q/22651670
has text: easier to learn how to use a MVC framework such as struts, stripes or Spring MVC
type: QuestionComment

http://stackoverflow.com/comment/34498075
type: Comment
type: QuestionComment
score: 1
comment on: http://stackoverflow.com/q/22649774
has text: `while` loop block cannot have a `else` block following it. Only `if` block can!

http://stackoverflow.com/q/22766606
has answer: http://stackoverflow.com/a/22771813
tagged with: time
has body: Im trying to display series of photos on one page with time interval. In countinuos while loop i got: while(true){ if (zmienna == fa.length) zmienna = 0; Image obrazek = new Image("",pliki[zmienna]); layout.replaceComponent(staryObrazek, obrazek); obrazek.requestRepaint(); staryObrazek = obrazek; zmienna++; try { Thread.sleep(2000) ; } catch (InterruptedException e) { // TODO Auto-generated catch block e.printStackTrace(); } } It showing only waiting icon, dispaying mwthod works fine without loop. Do anyone has an idea how I should fic this issue?
type: UnansweredQuestion
tagged with: java
tagged with: vaadin
type: Question
has title: How to wait in loop in Vaadin?
tagged with: image
tagged with: sleep
score: 0
answer count: 1

http://stackoverflow.com/comment/34754870
type: Comment
has text: check the class file are include in activity
comment on: http://stackoverflow.com/q/22792333
score: 0
type: QuestionComment

http://stackoverflow.com/a/22756133
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/22755915
has body: Try this to count the word in a string, private static int countingWord(String value, String findWord) { int counter = 0; while (value.contains(findWord)) { int index = value.indexOf(findWord); value = value.substring(index + findWord.length(), value.length()); counter++; } return counter; }
score: 0
type: Answer
answers question: http://stackoverflow.com/q/22755915

opencv
type: Tag
tags question: http://stackoverflow.com/q/22769023
tags question: http://stackoverflow.com/q/22663876
tags question: http://stackoverflow.com/q/22787030
tags question: http://stackoverflow.com/q/22769747
tags question: http://stackoverflow.com/q/22752555
tag name: opencv
tags question: http://stackoverflow.com/q/22743940
tags question: http://stackoverflow.com/q/22757852
tags question: http://stackoverflow.com/q/22807039
tags question: http://stackoverflow.com/q/22701969
tags question: http://stackoverflow.com/q/22730669
tags question: http://stackoverflow.com/q/22762227

http://stackoverflow.com/q/22704935
score: 0
has answer: http://stackoverflow.com/a/31067105
tagged with: java
answer count: 3
has answer: http://stackoverflow.com/a/25937707
has body: Can any one help me to get the code to find the inverse of a matrix using EJML.jar
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/22705005
tagged with: ejml
type: Question
has title: FInd the inverse of a matrix using EJML.jar

http://stackoverflow.com/q/22775839
tagged with: rational-numbers
tagged with: numbers
downvote count: 0
score: 1
tagged with: java
has answer: http://stackoverflow.com/a/22776266
has title: Rational to double and GCF
type: Question
tagged with: type-conversion
upvote count: 1
answer count: 1
has body: This question is towards the last method. Whenever I return d in the method "public static Rational convert(double d)" it says that it can not convert from double to Rational. How would I make it so that I would be able to return a Rational number from the method without switching "Rational" to double or the parameter? And is that how I would implement a loop to find the GCF in the method as well, without creating another method? public class Rational { // The state of a rational number is just the numerator and denominator. private static int numerator; private static int denominator; // When created, a Rational's numerator and denominator are set. public Rational( int num, int den ) { numerator = num; denominator = den; } // Accessor method for the numerator public int getNumerator( ) { return numerator; } // Accessor method for the denominator public int getDenominator( ) { return denominator; } // A mutator method which doubles the given rational number by doubling the // numerator. public void doubleNumber( ) { numerator *= 2; } // A method which returns the common denominator between the current and // given rational. Specifically, returns the denominator multiplied by the // denominator of the given rational number. public int findCommonDenominator( Rational r ) { return denominator * r.getDenominator( ); } //Method returning the decimal value of the fraction. public static double convert(Rational r) { return (double) numerator / (double) denominator; } //Method returning the smallest fraction possible from a decimal given. public static Rational convert(double d) { d = (Math.floor(d * 100)/100); while ( denominator != 0) { d = (double) (numerator % denominator); numerator = denominator; d = (double) (denominator); } return d; }
favorite count: 0
type: UnansweredQuestion

http://stackoverflow.com/a/22805635
score: 0
has body: What you are doing with "while"-loop is called POLLING. http://en.wikipedia.org/wiki/Polling_%28computer_science%29 I suggest you to implement solutions which should be implemented simultaneously. 1 - Thread.currentThread().sleep( millis ) - at the end of the loop 2 - start the loop in seperate thread, remember of safe-thread boolean variable, like java.util.concurrent.atomic.AtomicBoolean
type: Answer
has comment: http://stackoverflow.com/comment/34777788
answers question: http://stackoverflow.com/q/22805415
has comment: http://stackoverflow.com/comment/34777611

http://stackoverflow.com/comment/34634385
has text: FYI, Java defines the evaluation order, so that this is not JVM dependent. But don't try this C or C++, where the results could be compiler-dependent. (Not sure about JavaScript, PHP, C#.)
score: 0
comment on: http://stackoverflow.com/q/22725593
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/35291261
score: 3
has text: I asked about this question in JavaFX bug report RT-36285, and heard: "... please check the threading in your code. The sample that you provide on stackoverflow calls Swing APIs on JavaFX User Thread. This is bad for both Swing and FX. Swing APIs should only be invoked on the EDT, and FX APIs - on the JavaFX User Thread correspondingly. Please fix threading first and see how it changes things. Then file new bugs if any issues are still remaining.".
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/22808223

http://stackoverflow.com/comment/34734990
score: 0
type: AnswerComment
has text: Thanks for answering, but i know in case of JVM exist , it wont call finally, but i am looking for Thread interrupt in try catch block
type: Comment
comment on: http://stackoverflow.com/a/22782029

http://stackoverflow.com/q/22664255
has body: I really wonder if there is an efficient way to get the index of an Enum constant. I could think of two methods: iterationg over the MyEnum.values() or giving every constant an integer that identifies it like so: public enum MyEnum { CONSTANT_ONE(0), CONSTANT_TWO(1), CONSTANT_THREE(2), CONSTANT_FOUR(3); private int index; private MyEnum(int index){ this.index = index; } public int getIndex(){ return index; } } But both of these methods seem a bit... circuitous to me. Is there a better, or even a official way to achieve this?
tagged with: integer
type: AnsweredQuestion
tagged with: java
has title: Java: No method to get the index of an Enum constant?
type: Question
tagged with: enums
has answer: http://stackoverflow.com/a/22664293
accepted answer: http://stackoverflow.com/a/22664293
score: 0
answer count: 1

http://stackoverflow.com/comment/50557932
score: 0
type: QuestionComment
type: Comment
has text: If you are learning about cloning, here's the #1 thing you should know about cloning: It is inherently broken. So, DON'T DO IT, unless you ABSOLUTELY have to. You may ask, what is an alternative to cloning then? Use immutable objects. You should spend some time reading on how to create immutable classes in Java.
comment on: http://stackoverflow.com/q/22740001

http://stackoverflow.com/comment/34655591
score: 0
type: Comment
comment on: http://stackoverflow.com/a/22733264
has text: Just do the same thing for each TextArea. I'll add some comments in the code, but you can just check the [javadocs](http://docs.oracle.com/javase/8/javafx/api/) for the methods that I call.
type: AnswerComment

http://stackoverflow.com/a/22769626
score: 0
type: Answer
has body: public static String bubbleSortDesc(String[] names) should be public static String[] bubbleSortDesc(String[] names) and also declare descSort as String array. Also you are just printing the array objects. This will not print the list for you. You have iterate over the array. Include this in you code: for (String name:names) { System.out.println(name); } Do the same for descSort too....
answers question: http://stackoverflow.com/q/22769480

http://stackoverflow.com/comment/34770308
comment on: http://stackoverflow.com/a/22801494
type: Comment
has text: these rows are displayed in a table in mainactivity, however I can not get an intent to work from my button which is dynamically created
score: 0
type: AnswerComment

http://stackoverflow.com/a/22767009
accepted answer of: http://stackoverflow.com/q/22766644
answers question: http://stackoverflow.com/q/22766644
has comment: http://stackoverflow.com/comment/34709468
type: Answer
score: 2
downvote count: 0
has body: Probably what's happening is that you are drawing your image from (0, 0) which are the top-left corner. Then you set the preferred size to 10 pixels larger which makes the panel larger, but the image is still at (0, 0) Instead use the same size witoout adding 10, and just use an EmptyBorder for the panel. Also as a recommendation, override getPreferredSize() instead of using setPreferredSize() public class ImagePanel extends JPanel { public ImagePanel() { setBorder(new EmptyBorder(10, 10, 10, 10)); } @Override public Dimension getPreferredSize() { return new Dimension(IMG_SIZE, IMG_SIZE); } } Also you may want to consider using a GridBagLayout for the container panel, for a sure center, if the container is to be larger than the the child panel. Few things you could do. Even consider using a ImageIcon and JLabel instead of painting (if the image doesn't need to be resized (as Camickr(+1) pointed out). A JLabel could easily be made a background by just setting the layout of the label and set it as the content pane of the frame. ImageIcon icon = new ImageIcon(...) JLabel frameBackground = new JLabel(icon); frameBackground.setLayout(new BorderLayout()); frame.setContentPane(frameBackground);
upvote count: 2
type: AcceptedAnswer

http://stackoverflow.com/comment/124887140
comment on: http://stackoverflow.com/a/34740998
type: Comment
score: 1
has text: it does the work
type: AnswerComment

http://stackoverflow.com/comment/34697989
type: Comment
type: QuestionComment
has text: Try `String delims = "[ ]+(?=([^"]*"[^"]*")*[^"]*$)"`
comment on: http://stackoverflow.com/q/22760517
score: 0

http://stackoverflow.com/comment/34542061
score: 0
comment on: http://stackoverflow.com/q/22674055
type: QuestionComment
type: Comment
has text: `builder.redirectErrorStream(true)` is the line that is allowing it to capture the output. The output gets directed to the error stream. If I comment it out, then only the byte code stuff is printed out.

http://stackoverflow.com/comment/34780108
score: 1
comment on: http://stackoverflow.com/q/22793143
type: Comment
type: QuestionComment
has text: What about all my other comments? Also, think of Sherlock Holmes and Watson: elementary logic can help you. If you add text first and then an image, isn't it normal that the image covers the text? Why don't you switch adding text and image so that the text covers the image. I really hope you consider throwing away your code and starting anew writing decent code. The `setTextMatrix()` method shouldn't be used by people who don't understand what the parameters mean. Use `ColumnText.showAligned()` and the people who have to read your code will thank you!

http://stackoverflow.com/q/22698967
tagged with: struts
has title: Prevent Struts from escaping labels
has answer: http://stackoverflow.com/a/22700287
has answer: http://stackoverflow.com/a/23016296
favorite count: 0
type: UnansweredQuestion
tagged with: internationalization
has body: In my resources file I have form labels like so: global.background.first_name.label=Pr&amp;eacute;nom: And inserting them in the JSP: &lt;s:label for="firstName" key="global.background.first_name.label" /&gt; How do I get it to come up as Prénom:, not Pr&amp;eacute;nom:?
score: 1
tagged with: java
upvote count: 1
type: Question
answer count: 2
downvote count: 0

http://stackoverflow.com/q/22796112
accepted answer: http://stackoverflow.com/a/22796433
type: Question
has body: I use the GWT ScriptInjector to inject an external JavaScript file like this: ScriptInjector.fromUrl("http://example.com/foo.js").setCallback( new Callback() { public void onFailure(Exception reason) { Window.alert("Script load failed."); } public void onSuccess(Void result) { Window.alert("Script load success."); } }).inject(); This works fine but not expires header is set, i.e., the browser does not cache this script. Is it possible to set a header for the ScriptInjector to cache the external js file?
tagged with: gwt
tagged with: javascript
tagged with: caching
answer count: 1
has answer: http://stackoverflow.com/a/22796433
has title: How to set CacheHeaders when Script is loaded with GWT ScriptInjector?
type: AnsweredQuestion
score: 0
tagged with: java

http://stackoverflow.com/comment/34535473
comment on: http://stackoverflow.com/a/22670956
has text: @Yoda you can leave it for classes that you explicitly let inherit a superclass, to indicate (to fellow developers) that no arguments need to be passed to the superclass's constructor.
type: AnswerComment
score: 0
type: Comment

http://stackoverflow.com/comment/34572085
has text: sounds like you are beginner to programming, too `:)`
comment on: http://stackoverflow.com/q/22691774
type: Comment
type: QuestionComment
score: 2

http://stackoverflow.com/comment/34706812
has text: The fact is that PKCS#5 padding is only defined for 64-bit block ciphers. AES is a 128-bit block cipher. It's not possible to use PKCS#5 padding together with AES. When you tell JCE to use PKCS#5, it's actually using PKCS#7.
score: 0
comment on: http://stackoverflow.com/q/22757681
type: Comment
type: QuestionComment

http://stackoverflow.com/a/22798974
answers question: http://stackoverflow.com/q/22798873
has comment: http://stackoverflow.com/comment/34766348
score: 2
has comment: http://stackoverflow.com/comment/34766312
downvote count: 0
has comment: http://stackoverflow.com/comment/34766396
has body: You can use std::atomic&lt;T&gt; as type of the member. This guarantees a set of atomic operations, like fetch and increment. This is general much better than adding a mutex, as these operations are implemented with special atomic instructions of the CPU
upvote count: 2
has comment: http://stackoverflow.com/comment/34766299
has comment: http://stackoverflow.com/comment/34766244
type: Answer

http://stackoverflow.com/comment/34505324
type: Comment
comment on: http://stackoverflow.com/a/22653117
type: AnswerComment
score: 0
has text: In order for the exception to be thrown to the console, you also need to extract the `in = new Scanner(json);` out of the try...catch clause.

http://stackoverflow.com/tag/json
tags question: http://stackoverflow.com/q/22702788
tags question: http://stackoverflow.com/q/22704800
tags question: http://stackoverflow.com/q/22672755
tags question: http://stackoverflow.com/q/22734486
tags question: http://stackoverflow.com/q/22691765
tags question: http://stackoverflow.com/q/22789172
tags question: http://stackoverflow.com/q/22748928
tags question: http://stackoverflow.com/q/22807711
tags question: http://stackoverflow.com/q/22759111
tags question: http://stackoverflow.com/q/22770337
tags question: http://stackoverflow.com/q/22720966
tags question: http://stackoverflow.com/q/22790807
tags question: http://stackoverflow.com/q/22761851
tags question: http://stackoverflow.com/q/22789608
tags question: http://stackoverflow.com/q/22680630
tags question: http://stackoverflow.com/q/22796063
tags question: http://stackoverflow.com/q/22686210
tags question: http://stackoverflow.com/q/22706213
tags question: http://stackoverflow.com/q/22668374
tags question: http://stackoverflow.com/q/22667964
tags question: http://stackoverflow.com/q/22728460
tags question: http://stackoverflow.com/q/22740472
tags question: http://stackoverflow.com/q/22803732
tags question: http://stackoverflow.com/q/22729740
tags question: http://stackoverflow.com/q/22687771
tags question: http://stackoverflow.com/q/22657409
tags question: http://stackoverflow.com/q/22790222
tags question: http://stackoverflow.com/q/22800519
tags question: http://stackoverflow.com/q/22746442
type: Tag
tags question: http://stackoverflow.com/q/22693714
tags question: http://stackoverflow.com/q/22661849
tags question: http://stackoverflow.com/q/22725992
tags question: http://stackoverflow.com/q/22781631
tags question: http://stackoverflow.com/q/22679554
tags question: http://stackoverflow.com/q/22761919
tags question: http://stackoverflow.com/q/22698231
tags question: http://stackoverflow.com/q/22687402
tags question: http://stackoverflow.com/q/22784502
tags question: http://stackoverflow.com/q/22784617
tags question: http://stackoverflow.com/q/22766621
tags question: http://stackoverflow.com/q/22753580
tags question: http://stackoverflow.com/q/22753358
tags question: http://stackoverflow.com/q/22783712
tags question: http://stackoverflow.com/q/22755177
tags question: http://stackoverflow.com/q/22767270
tags question: http://stackoverflow.com/q/22736918
tags question: http://stackoverflow.com/q/22701053
tags question: http://stackoverflow.com/q/22711626
tags question: http://stackoverflow.com/q/22655022
tags question: http://stackoverflow.com/q/22735677
tags question: http://stackoverflow.com/q/22709240
tags question: http://stackoverflow.com/q/22789993
tags question: http://stackoverflow.com/q/22715325
tags question: http://stackoverflow.com/q/22754564
tags question: http://stackoverflow.com/q/22684695
tags question: http://stackoverflow.com/q/22802572
tags question: http://stackoverflow.com/q/22761936
tags question: http://stackoverflow.com/q/22705018
tags question: http://stackoverflow.com/q/22729099
tags question: http://stackoverflow.com/q/22720125
tag name: json
tags question: http://stackoverflow.com/q/22710557
tags question: http://stackoverflow.com/q/22762572
tags question: http://stackoverflow.com/q/22803970
tags question: http://stackoverflow.com/q/22724961
tags question: http://stackoverflow.com/q/22653016
tags question: http://stackoverflow.com/q/22766006
tags question: http://stackoverflow.com/q/22782392
tags question: http://stackoverflow.com/q/22735911
tags question: http://stackoverflow.com/q/22691406
tags question: http://stackoverflow.com/q/22649309
tags question: http://stackoverflow.com/q/22782619
tags question: http://stackoverflow.com/q/22709891
tags question: http://stackoverflow.com/q/22795614
tags question: http://stackoverflow.com/q/22685281
tags question: http://stackoverflow.com/q/22753719
tags question: http://stackoverflow.com/q/22763441
tags question: http://stackoverflow.com/q/22735090
tags question: http://stackoverflow.com/q/22737265

http://stackoverflow.com/comment/34596291
type: QuestionComment
has text: *'I see a lot of scores in google for ".fon java"'* Google ignores characters like `.` so that search should pick up everything with both font & Java! Point to some pages that actually include the string `.fon` along with Java.
comment on: http://stackoverflow.com/q/22681771
score: 0
type: Comment

http://stackoverflow.com/q/22694628
tagged with: list
has body: Got a little question. I got a List String in my IRC bot: public List&lt;String&gt; Moderatoren = "name1, name2"; and i know i can add new names to it by i.e Moderatoren.add(stringContainsAname); so is there actually a way to delete it by the same String contains a name on the list? i.e: String stringTest = "name1"; how can i tell the list to remove only stringTest (name3) from the list?
tagged with: java
has comment: http://stackoverflow.com/comment/34577633
has comment: http://stackoverflow.com/comment/34577671
type: Question
has answer: http://stackoverflow.com/a/22694693
upvote count: 0
has title: List<String> : Add and delete?
score: -2
tagged with: arrays
has comment: http://stackoverflow.com/comment/34577717
answer count: 1
has comment: http://stackoverflow.com/comment/34578494
favorite count: 0
has comment: http://stackoverflow.com/comment/34577674
has comment: http://stackoverflow.com/comment/34577684
type: UnansweredQuestion
downvote count: 2
has comment: http://stackoverflow.com/comment/34577693

http://stackoverflow.com/comment/34603098
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/22708547
score: 1
has text: This may be due to threading issue. Are you doing it in a thread-safe code?

http://stackoverflow.com/q/22746560
downvote count: 0
score: 1
has title: Classes from different packages with identical names
favorite count: 0
type: UnansweredQuestion
tagged with: package
has body: I have to deal with both HTML and XML data. It's not really something that'd break my neck, but there are name ambiguities between JDOM and JSoup (for example, the Document and Element classes) and writing the full qualified names over and over again (which would be the way to go according to the Java Tutorials) simply means a lot of writing. Do you have any idea how to avoid the full qualified names in this case without moving the JDomClass and JSoupClass classes to their own files? import java.io.IOException; public class Imports { // ... } class JDomClass { JDomClass() throws org.jdom2.JDOMException, IOException { org.jdom2.Document doc = ew org.jdom2.input.SAXBuilder().build("http://www.example.com/"); // ... } } class JSoupClass { JSoupClass() throws IOException { org.jsoup.nodes.Document doc = org.jsoup.Jsoup.connect("http://www.example.com/").get(); // ... } }
has comment: http://stackoverflow.com/comment/34671048
answer count: 0
tagged with: java
upvote count: 1
type: Question
has comment: http://stackoverflow.com/comment/34672675
has comment: http://stackoverflow.com/comment/34671004

http://stackoverflow.com/q/22673714
linked to: http://stackoverflow.com/q/12727989
tagged with: java
tagged with: endpoint
score: 0
answer count: 1
has title: How to get the client's host IP inside a JavaSE JAX-WS generated webservice Endpoint?
has body: I am starting a WebService inside a JavaSE application and I want to get the client's caller IP. Is that possible? I have written a small test case: import java.net.InetSocketAddress; import java.util.concurrent.*; import javax.jws.*; import javax.xml.ws.Endpoint; import com.sun.net.httpserver.*; @WebService public class TestWs { @WebMethod public String testMethod(String param) { String clientHostIp = ""; // how to obtain client's host ? return "hello "+ clientHostIp; } public static void main(String[] args) throws Exception { ExecutorService executorService = Executors.newFixedThreadPool(2); HttpServer thttpserver = HttpServer.create(new InetSocketAddress("0.0.0.0", 2000),8); final HttpServer httpserver = thttpserver; httpserver.setExecutor(executorService); httpserver.start(); HttpContext ctx = httpserver.createContext("/TestWs"); final Endpoint wsendpoint = Endpoint.create(new TestWs()); wsendpoint.publish(ctx); } }
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/34540957
has answer: http://stackoverflow.com/a/22673974
tagged with: jax-ws
tagged with: web-services
type: Question

http://stackoverflow.com/comment/34564897
comment on: http://stackoverflow.com/q/22687963
type: Comment
type: QuestionComment
score: 2
has text: `T extends A` <- Right there

http://stackoverflow.com/q/22764293
upvote count: 1
type: Question
tagged with: primefaces
has body: according to BalusC's homepage I implemented the function downloadPDF(), which reads a PDF-file from the filesystem and displays it in the browser. this function works as intended. moreover I have a class EncryptionService, which lets me encrypt and/or decrypt a given file. this also works as intended. unfortunately it doesn't seem possible to read a PDF-file, decrypt it and display it in the browser. it ends with the browser trying to load the file over and over without showing anything at all. the code below shows my simple modifications of BalusC's PDF handler. public void showDocument(String path, boolean decrypt) throws IOException, InvalidKeyException { FacesContext facesContext = FacesContext.getCurrentInstance(); ExternalContext externalContext = facesContext.getExternalContext(); HttpServletResponse response = (HttpServletResponse) externalContext.getResponse(); File file = new File(path); BufferedInputStream input = null; BufferedOutputStream output = null; try { if(!decrypt) input = new BufferedInputStream(new FileInputStream(file), DEFAULT_BUFFER_SIZE); else { // update MessageDigets, return Key cipher.init(Cipher.DECRYPT_MODE, genKey(passphrase)); input = new BufferedInputStream(new CipherInputStream(new FileInputStream(file), cipher), DEFAULT_BUFFER_SIZE); } response.reset(); response.setHeader("Content-Type", "application/pdf"); response.setHeader("Content-Length", String.valueOf(file.length())); response.setHeader("Content-Disposition", "inline; filename=\"" + path + "\""); output = new BufferedOutputStream(response.getOutputStream(), DEFAULT_BUFFER_SIZE); byte[] buffer = new byte[DEFAULT_BUFFER_SIZE]; int length; while ((length = input.read(buffer)) &gt; 0) { output.write(buffer, 0, length); } output.flush(); } finally { try { input.close(); output.close(); } catch (IOException e) { e.printStackTrace(); } } facesContext.responseComplete(); }
has title: Reading and displaying encrypted PDF-file in JSF
has comment: http://stackoverflow.com/comment/34748063
has answer: http://stackoverflow.com/a/22797610
tagged with: http://stackoverflow.com/tag/pdf
answer count: 1
downvote count: 0
favorite count: 0
has comment: http://stackoverflow.com/comment/34756939
tagged with: encryption
accepted answer: http://stackoverflow.com/a/22797610
has comment: http://stackoverflow.com/comment/34726886
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/34743658
has comment: http://stackoverflow.com/comment/34757752
tagged with: jsf
score: 1
tagged with: java
has comment: http://stackoverflow.com/comment/34760599

http://stackoverflow.com/a/23161835
upvote count: 3
score: 3
answers question: http://stackoverflow.com/q/22768416
has comment: http://stackoverflow.com/comment/42869763
has body: This is a known issue with allocateIdRange(). A better error message would be "You can't call allocateIdRange() on scattered ids". Scattered ids are the default since 1.8.1 and have values >= 2^52. Unfortunately we don't currently expose an API to reserve these ids.
downvote count: 0
type: Answer

http://stackoverflow.com/comment/34734060
type: QuestionComment
comment on: http://stackoverflow.com/q/22781273
has text: What is your system language? It is possible that `EditText` is detecting that you are typing a language (such as Arabic) from right-to-left and hence insert at beginning (left) is inserting it at the end (right).
type: Comment
score: 1

google-maps
tags question: http://stackoverflow.com/q/22683325
tag name: google-maps
tags question: http://stackoverflow.com/q/22734508
tags question: http://stackoverflow.com/q/22673084
tags question: http://stackoverflow.com/q/22752726
tags question: http://stackoverflow.com/q/22712518
tags question: http://stackoverflow.com/q/22677989
tags question: http://stackoverflow.com/q/22750373
tags question: http://stackoverflow.com/q/22704202
tags question: http://stackoverflow.com/q/22745299
tags question: http://stackoverflow.com/q/22764387
type: Tag
tags question: http://stackoverflow.com/q/22722890
tags question: http://stackoverflow.com/q/22694286
tags question: http://stackoverflow.com/q/22763482

http://stackoverflow.com/comment/34517036
comment on: http://stackoverflow.com/q/22653249
score: 0
type: Comment
type: QuestionComment
has text: No, I am using Sputnik spockRunner.

http://stackoverflow.com/comment/34774152
type: QuestionComment
score: 0
has text: Sorry for the inconvenience @OcasoProtal. I have added my addMethod.
type: Comment
comment on: http://stackoverflow.com/q/22803094

http://stackoverflow.com/comment/34522690
type: QuestionComment
comment on: http://stackoverflow.com/q/22663387
has text: i tried according to u but still not getting last value what i entered in fifth column
score: 0
type: Comment

http://stackoverflow.com/q/22790721
answer count: 3
has comment: http://stackoverflow.com/comment/34750859
has answer: http://stackoverflow.com/a/22791008
has body: im really new in Java. I just need to explain how to declare 2D array of objects, i have something like: package breakout; import java.awt.Graphics; import java.awt.Graphics2D; import java.awt.RenderingHints; import java.awt.event.KeyEvent; import java.awt.event.KeyListener; import java.awt.Color; import java.awt.Font; import javax.swing.JFrame; import javax.swing.JPanel; import javax.swing.JOptionPane; public class Breakout extends JPanel { public class Ball { private int x = 400; int y = 300; int speed = 2; int dirx = 1; int diry = -1; public void bounce(int px, int py, int lx, int ly) { if ((x + 10 &gt;= 800 &amp;&amp; dirx == 1) || (x &lt;= 0 &amp;&amp; dirx == -1)) dirx *= -1; if (y &lt;= 0 &amp;&amp; diry == -1) diry *= -1; if (y + 10 &gt;= py &amp;&amp; y &lt;= py + ly &amp;&amp; diry == 1 &amp;&amp; x + 10 &gt;= px &amp;&amp; x &lt;= px + lx) diry *= -1; } int getX() { return x; } int getY() { return y; } void setDirx(){ dirx *= -1; } void setDiry(){ diry *= -1; } void move() { x += speed*dirx; y += speed*diry; } void paint(Graphics2D g) { g.fillOval(x,y,10,10); } } public class Paddle { private int x = 400; int y = 520; int width = 100; int height = 6; int speed = 6; int dirL = 0; int dirR = 0; public void move() { x -= speed*dirL; x += speed*dirR; } void stop() { if (x &lt;= 0) x = 0; if (x + width &gt;= 800) x = 800 - width; } int getX() { return x; } int getY() { return y; } int getWidth() { return width; } int getHeight() { return height; } void paint(Graphics2D g) { g.fillRect(x,y,width,height); } public void keyReleased(KeyEvent e) { if (e.getKeyCode() == KeyEvent.VK_LEFT) dirL = 0; else if (e.getKeyCode() == KeyEvent.VK_RIGHT) dirR = 0; else { dirL = 0; dirR = 0; } } public void keyPressed(KeyEvent e) { switch(e.getKeyCode()) { case KeyEvent.VK_LEFT: dirL = 1; break; case KeyEvent.VK_RIGHT: dirR = 1; break; } } } public class Brick { private int x; int y; int width; int height; boolean alive; boolean inX = false,inY = false; public void setUpBrick(in…
type: UnansweredQuestion
tagged with: 2d-games
tagged with: java
has title: 2d array of objects
type: Question
tagged with: arrays
has answer: http://stackoverflow.com/a/22790793
has answer: http://stackoverflow.com/a/22790857
score: 0

http://stackoverflow.com/comment/34512911
type: QuestionComment
score: 1
comment on: http://stackoverflow.com/q/22658324
has text: mvn clean install also create a jar as you want
type: Comment

http://stackoverflow.com/comment/34612432
type: AnswerComment
score: 0
type: Comment
has text: see you have told you need to create an executable jar in your question and you may use the above plugin.
comment on: http://stackoverflow.com/a/22713530

http://stackoverflow.com/comment/92749402
type: AnswerComment
has text: 1) only works as long as the `JLabel` has the focus (mostly other components will have it); 2) "are on your own" or consult the [official documentation](https://docs.oracle.com/en/java/javase/11/docs/api/java.desktop/javax/swing/KeyStroke.html#getKeyStroke(java.lang.String))
type: Comment
comment on: http://stackoverflow.com/a/52919766
score: 2

http://stackoverflow.com/a/22806587
has comment: http://stackoverflow.com/comment/34779553
type: AcceptedAnswer
downvote count: 0
accepted answer of: http://stackoverflow.com/q/22806202
type: Answer
has body: Fundamentally, List&lt;List&lt;?&gt;&gt; and List&lt;?&nbsp;extends&nbsp;List&lt;?&gt;&gt; have distinct type arguments. It's actually the case that one is a subtype of the other, but first let's learn more about what they mean individually. Understanding semantic differences Generally speaking, the wildcard ? represents some "missing information". It means "there was a type argument here once, but we don't know what it is anymore". And because we don't know what it is, restrictions are imposed on how we can use anything that refers to that particular type argument. For the moment, let's simplify the example by using List instead of Map. A List&lt;List&lt;?&gt;&gt; holds any kind of List with any type argument. So i.e.: List&lt;List&lt;?&gt;&gt; theAnyList = new ArrayList&lt;List&lt;?&gt;&gt;(); // we can do this theAnyList.add( new ArrayList&lt;String&gt;() ); theAnyList.add( new LinkedList&lt;Integer&gt;() ); List&lt;?&gt; typeInfoLost = theAnyList.get(0); // but we are prevented from doing this typeInfoLost.add( new Integer(1) ); We can put any List in theAnyList, but by doing so we have lost knowledge of their elements. When we use ?&nbsp;extends, the List holds some specific subtype of List, but we don't know what it is anymore. So i.e.: List&lt;? extends List&lt;Float&gt;&gt; theNotSureList = new ArrayList&lt;ArrayList&lt;Float&gt;&gt;(); // we can still use its elements // because we know they store Float List&lt;Float&gt; aFloatList = theNotSureList.get(0); aFloatList.add( new Float(1.0f) ); // but we are prevented from doing this theNotSureList.add( new LinkedList&lt;Float&gt;() ); It's no longer safe to add anything to the theNotSureList, because we don't know the actual type of its elements. (Was it originally a List&lt;LinkedList&lt;Float&gt;&gt;? Or a List&lt;Vector&lt;Float&gt;&gt;? We don't know.) We can put these together and have a List&lt;?&nbsp;extends&nbsp;List&lt;?&gt;&gt;. We don't know what type of List it has in it anymore, and we don't know …
has comment: http://stackoverflow.com/comment/34779778
score: 68
upvote count: 68
has comment: http://stackoverflow.com/comment/34779698
answers question: http://stackoverflow.com/q/22806202
has comment: http://stackoverflow.com/comment/62675135

http://stackoverflow.com/a/22749128
type: Answer
answers question: http://stackoverflow.com/q/22748307
has body: All BufferedImage objects have an upper left corner coordinate of (0, 0). Any Raster used to construct a BufferedImage must therefore have minX=0 and minY=0. Therein lies your problem. JavaDoc for BufferedImage Edit: Also remove this from your loop: for (int y = 0; y &lt; getWidth(); y++) { I.setRGB(x, x, Color.GREEN.getRGB()); }
score: 0

http://stackoverflow.com/q/22796385
has comment: http://stackoverflow.com/comment/34761118
has comment: http://stackoverflow.com/comment/34761364
type: AnsweredQuestion
upvote count: 0
accepted answer: http://stackoverflow.com/a/22796600
tagged with: java
has comment: http://stackoverflow.com/comment/34761316
has comment: http://stackoverflow.com/comment/34761184
type: Question
has comment: http://stackoverflow.com/comment/34761190
has answer: http://stackoverflow.com/a/22796600
tagged with: indexoutofboundsexception
has comment: http://stackoverflow.com/comment/34761178
score: -1
has comment: http://stackoverflow.com/comment/34761220
has comment: http://stackoverflow.com/comment/34761107
has comment: http://stackoverflow.com/comment/34761281
downvote count: 1
answer count: 1
has title: Weird IndexOutofBoundsException?
tagged with: string
has comment: http://stackoverflow.com/comment/34761106
favorite count: 0
has comment: http://stackoverflow.com/comment/34761126
has comment: http://stackoverflow.com/comment/34761323
has body: why is there an IndexOutofBoundsException? It seems as if there is no variable that index may be out of bounds. This program is supposed to convert patterns. Could this have something to do with how I read my file? Thanks. static int checkNestedParenFront(String line){ int count=0; for(int i=0;i&lt;line.length();i++ ){ if(line.charAt(i)=='(') count++; if(line.charAt(i)==')'&amp;&amp;count==0) return i; if(line.charAt(i)==')') count--; } return 0; } String line = new String(Files.readAllBytes(Paths.get("new.txt"))); PrintWriter writer = new PrintWriter("old.txt"); while(line.contains("F_4")){ while(line.contains("$F_4$")) { line=line.replace("$F_4$", "$\\AppellFiv"); } int posAppell = line.indexOf("F_4"); int posSemi = line.indexOf(';', posAppell); posSemi = line.indexOf(';', posSemi); int posComma = line.indexOf(',', posSemi); String check = line.substring(posComma+1); int i = checkNestedParenFront(check); String lastAppel = line.substring(posComma, i); String beforeAppel=line.substring(0, posComma); String afterAppel = line.substring(i+1); line = line.replaceAll("F_4[^(]*\\(([^,]+),([^;]+);([^,]+),([^;]+);([^,]+),", "\\AppellFiv@{$1}{$2}{$3}{$4}{$5}"); line = beforeAppel + "{" + lastAppel + "}" + afterAppel; }
tagged with: exception

web-services
type: Tag
tags question: http://stackoverflow.com/q/22700104
tags question: http://stackoverflow.com/q/22683007
tags question: http://stackoverflow.com/q/22784782
tags question: http://stackoverflow.com/q/22794945
tags question: http://stackoverflow.com/q/22730117
tags question: http://stackoverflow.com/q/22704876
tags question: http://stackoverflow.com/q/22778459
tags question: http://stackoverflow.com/q/22722220
tags question: http://stackoverflow.com/q/22725051
tags question: http://stackoverflow.com/q/22658949
tags question: http://stackoverflow.com/q/22803974
tags question: http://stackoverflow.com/q/22754450
tags question: http://stackoverflow.com/q/22708547
tags question: http://stackoverflow.com/q/22680376
tags question: http://stackoverflow.com/q/22734298
tags question: http://stackoverflow.com/q/22759924
tags question: http://stackoverflow.com/q/22668785
tags question: http://stackoverflow.com/q/22780786
tags question: http://stackoverflow.com/q/22772494
tags question: http://stackoverflow.com/q/22761909
tags question: http://stackoverflow.com/q/22776981
tags question: http://stackoverflow.com/q/22678871
tags question: http://stackoverflow.com/q/22763914
tags question: http://stackoverflow.com/q/22789308
tags question: http://stackoverflow.com/q/22673497
tags question: http://stackoverflow.com/q/22770890
tags question: http://stackoverflow.com/q/22657982
tags question: http://stackoverflow.com/q/22762576
tags question: http://stackoverflow.com/q/22662609
tags question: http://stackoverflow.com/q/22655661
tags question: http://stackoverflow.com/q/22789966
tags question: http://stackoverflow.com/q/22736473
tags question: http://stackoverflow.com/q/22783935
tags question: http://stackoverflow.com/q/22712438
tags question: http://stackoverflow.com/q/22749570
tags question: http://stackoverflow.com/q/22687115
tags question: http://stackoverflow.com/q/22741593
tags question: http://stackoverflow.com/q/22677822
tags question: http://stackoverflow.com/q/22711379
tags question: http://stackoverflow.com/q/22655331
tag name: web-services
tags question: http://stackoverflow.com/q/22694400
tags question: http://stackoverflow.com/q/22709822
tags question: http://stackoverflow.com/q/22740860
tags question: http://stackoverflow.com/q/22757001
tags question: http://stackoverflow.com/q/22720759
tags question: http://stackoverflow.com/q/22762854
tags question: http://stackoverflow.com/q/22680189
tags question: http://stackoverflow.com/q/22673714

http://stackoverflow.com/comment/35278627
has text: I guess I did not understand your question. Do you want to read the ontology from virtuoso or from a file? And if from a file, how does virtuoso come into play?
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/23065006
type: Comment

http://stackoverflow.com/comment/34547189
comment on: http://stackoverflow.com/q/22676743
has text: So, clearly I have no idea what I'm doing here. I'm having trouble finding a tutorial that covers everything I need, but doesn't also cover a hundred things I don't need. And I am having a lot of trouble working out what I do and don't need. I've now created a custom adapter with a viewholder, but I don't know if that's enough or too much, or how to plug everything together.
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/q/22717323
has answer: http://stackoverflow.com/a/22717755
tagged with: string-parsing
has title: Best way to select parts certain parts of data in a string that changes in size
possible better answer: http://stackoverflow.com/a/22717573
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/22717573
has answer: http://stackoverflow.com/a/22717734
tagged with: java
accepted answer: http://stackoverflow.com/a/22717755
tagged with: substring
type: Question
has body: I'm looking for a good method of parsing certain parts of information in a string that changes in size. For example, the string might be "id:1234 alert:a-b up:12.3 down:12.3" and I need to pick out the value for id, alert, up and down so my initial thought was substring but then I thought that length of the string can change in size for example "id:123456 alert:a-b-c-d up:12.345 down:12.345" So using substring each time to look at say characters 3 to 7 may not work each time because it would not capture all of the data needed. What would be a smart way of selecting each value that is needed? Hopefully I've explained this well as I normally tend to confuse people with my bad explanations. I am programming in Java.
tagged with: xml-parsing
has comment: http://stackoverflow.com/comment/34618932
tagged with: string
has comment: http://stackoverflow.com/comment/34619249
score: 0
answer count: 3

http://stackoverflow.com/comment/34505542
score: 0
comment on: http://stackoverflow.com/q/22654255
type: Comment
type: QuestionComment
has text: Could you please indent the code so that it is readable?

http://stackoverflow.com/a/22760268
has comment: http://stackoverflow.com/comment/34697208
has comment: http://stackoverflow.com/comment/34697710
accepted answer of: http://stackoverflow.com/q/22760234
type: AcceptedAnswer
score: 0
has comment: http://stackoverflow.com/comment/34697632
type: Answer
has body: Your save button with id save is not in the activity layout but in a fragment layout. It isn't in the activity view hierarchy when you call addSaveButtonListener() and findViewById() returns null. Move the save button setup to your fragment onCreateView(), e.g. View rootView = inflater.inflate(R.layout.fragment_main, container, false); Button saveBtn = (Button)rootView.findViewById(R.id.save); saveBtn.setOnClickListener(...); return rootView;
answers question: http://stackoverflow.com/q/22760234
has comment: http://stackoverflow.com/comment/34698527

http://stackoverflow.com/q/22675763
type: AnsweredQuestion
has title: Error cannot find symbol for simple investment class
possible better answer: http://stackoverflow.com/a/22675807
type: Question
accepted answer: http://stackoverflow.com/a/22675785
score: 0
tagged with: java
answer count: 3
has answer: http://stackoverflow.com/a/22675807
has body: Hello im having trouble as to why i am getting the error cannot find symbol for my simple investments class this is a compiler error. public class Investments { //instance variables private double moneyInvested; private double investRate; private int numOfYears; //construscts a investment with the parameters moneyInvested, double investRate, int numOfYears public Investments(double moneyInvested, double investRate, int numOfYears) { double amount = moneyInvested; double rate = investRate; int time = numOfYears; } public double ruleOf72() { return (72/rate); } public int simpleAnnual() { return Math.round(amount * Math.pow(1 + rate, time)); } public int compoundAnnual() { return Math.round(amount * Math.pow((1 +rate)^time)); } }
has answer: http://stackoverflow.com/a/22675887
has comment: http://stackoverflow.com/comment/34544212
tagged with: class
has answer: http://stackoverflow.com/a/22675785

http://stackoverflow.com/q/22726194
answer count: 1
favorite count: 0
has comment: http://stackoverflow.com/comment/34639501
has title: How to catch invalid Elasticsearch queries?
tagged with: elasticsearch
score: 2
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/35669140
accepted answer: http://stackoverflow.com/a/35669140
downvote count: 0
tagged with: java
has comment: http://stackoverflow.com/comment/34638319
type: Question
has body: Given an invalid query, Elasticsearch's Java API (1.1.0) throws a SearchPhaseExecutionException. This exception has no "cause", but a "message" like this one: Failed to execute phase [query_fetch], all shards failed; shardFailures {[bwUSN171Ru6rY1-su5-48A][f2f0i20hrf][0]: SearchParseException[[f2f0i20hrf][0]: from[-1],size[0]: Parse Failure [Failed to parse source [{"size":0,"query":{"bool":{"must":{"term":{"count":""}}}}}]]]; nested: NumberFormatException[For input string: ""]; } How can I distinguish invalid queries from other errors, other than doing a string search for SearchParseException, or validating the query first?
upvote count: 2

http://stackoverflow.com/comment/34739057
type: AnswerComment
type: Comment
has text: @EJP **A single example doesn't prove anything** But only 1 example can refute all!!! Can you provide it?
comment on: http://stackoverflow.com/a/22761529
score: 0

http://stackoverflow.com/a/22779539
score: 1
has comment: http://stackoverflow.com/comment/34741842
type: AcceptedAnswer
downvote count: 0
type: Answer
accepted answer of: http://stackoverflow.com/q/22774848
upvote count: 1
answers question: http://stackoverflow.com/q/22774848
has body: You can use IteratorUtils to create a List from the getElements Iterator: #[org.apache.commons.collections.IteratorUtils.toList(payload.get('MyArrayNode').elements)]
has comment: http://stackoverflow.com/comment/34741532

http://stackoverflow.com/comment/34582021
score: 0
has text: Find where thats located, then change the java build path to wherever java 6 is.
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/22696463

http://stackoverflow.com/a/22747410
has comment: http://stackoverflow.com/comment/34672767
answers question: http://stackoverflow.com/q/22747035
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/34673053
accepted answer of: http://stackoverflow.com/q/22747035
has comment: http://stackoverflow.com/comment/34672753
type: Answer
has body: In your neighbors(House victim) method you are trying to assign Houses[] to House object n[0][0] = houses[victim.address - 1] &lt;== in this line n[0][0] represent a House object while houses[victim.address-1] represent an array. You have to access the House object from your houses[][] I do not understand your logic but you could try something like this if (row != 0 &amp;&amp; row != (size - 1) &amp;&amp; col != 0 &amp;&amp; col != (size - 1)) { n[0][0] = houses[victim.address - 1][victim.j]; n[0][1] = houses[victim.address + 1][victim.j]; n[0][2] = houses[victim.address - size][victim.j]; n[0][3] = houses[victim.address - size - 1][victim.j]; n[0][4] = houses[victim.address - size + 1][victim.j]; n[0][5] = houses[victim.address + size][victim.j]; n[0][6] = houses[victim.address + size - 1][victim.j]; n[0][7] = houses[victim.address + size + 1][victim.j]; return n; } Note : as I mentioned I do not understand your logic so you may have to decide which property of victim(which is a House Object) you would like to access the column value for your houses[row][column]
has comment: http://stackoverflow.com/comment/34673026
upvote count: 1
has comment: http://stackoverflow.com/comment/34672729
has comment: http://stackoverflow.com/comment/34672991
score: 1

http://stackoverflow.com/a/22680507
downvote count: 3
type: Answer
score: 2
has comment: http://stackoverflow.com/comment/34552274
has comment: http://stackoverflow.com/comment/34553281
answers question: http://stackoverflow.com/q/22680383
has body: I can't understand how can you get that output because you are incrementing i in for loop and inner body of loop also for(int i = 100; i &lt; 200; i++) { System.out.print(i+" "); if(i%10==0) System.out.print("\n"); }
has comment: http://stackoverflow.com/comment/34552331
upvote count: 5

http://stackoverflow.com/a/22799657
has comment: http://stackoverflow.com/comment/34821985
downvote count: 0
answers question: http://stackoverflow.com/q/22792102
type: Answer
score: 1
upvote count: 1
has body: Saving the entities with one call will result in a single RPC, meaning that the window of transaction failure will be smaller (calling .now() twice is triggering two synchronous RPCs). Remember also that there is a throttle on writes to an entity group, so any pattern that causes more RPCs has a wider impact than just transaction elapsed time itself. The result of save will always have a key, a failure would result in an exception (and in the context of a transaction, possibly a retry). So it isn't meaningful to use it as a status check. Its just useful if you want to know the key after you do a put.

http://stackoverflow.com/comment/34644152
comment on: http://stackoverflow.com/q/22731049
score: 0
type: Comment
type: QuestionComment
has text: @zapl its String class

http://stackoverflow.com/q/22748628
has body: I made a class that controls all the keys for my game in lwjgl using such method: if (Keyboard.isKeyDown(Keyboard.KEY_A)) { System.out.println("....."); } Except on a much larger scale. My problem occurs that when this class is called it only runs through once so the only way to see the effect of the code is to have a thumb spasm on the A button as the game starts up... My code: public class KeyBindings { public static void run() { try { Keyboard.create(); } catch (LWJGLException e) { e.printStackTrace(); } if (Keyboard.isKeyDown(Keyboard.KEY_F1)) { System.out.println("............................."); } } And then I call KeyBindings.run(); from another class.
has title: How to make a class run constantly
type: AnsweredQuestion
downvote count: 0
score: 1
possible better answer: http://stackoverflow.com/a/22748729
favorite count: 0
has answer: http://stackoverflow.com/a/22748689
has answer: http://stackoverflow.com/a/22748729
type: Question
tagged with: java
tagged with: lwjgl
answer count: 2
upvote count: 1
accepted answer: http://stackoverflow.com/a/22748689

http://stackoverflow.com/q/22808152
possible better answer: http://stackoverflow.com/a/22808190
accepted answer: http://stackoverflow.com/a/22808207
type: AnsweredQuestion
score: 1
tagged with: java
has answer: http://stackoverflow.com/a/22808207
type: Question
has answer: http://stackoverflow.com/a/22810200
downvote count: 0
has answer: http://stackoverflow.com/a/22808249
has answer: http://stackoverflow.com/a/22808190
tagged with: arraylist
has comment: http://stackoverflow.com/comment/34782220
has title: Is there any method that creates another arraylist with the common values of two arraylists?
tagged with: compare
answer count: 4
favorite count: 0
has body: That is, if I have the next: ArrayList&lt;Integer&gt; array1 = new ArrayList&lt;Integer&gt;(); ArrayList&lt;Integer&gt; array2 = new ArrayList&lt;Integer&gt;(); array1 ==&gt; (1,11,12,13,14,15,16,17,18) array2 ==&gt; (1,17,18) Is there any method that creates another arraylist with the common values?
upvote count: 1

http://stackoverflow.com/q/22705060
linked to: http://stackoverflow.com/q/5130074
has comment: http://stackoverflow.com/comment/36505287
type: Question
has comment: http://stackoverflow.com/comment/36423396
answer count: 2
score: 5
has comment: http://stackoverflow.com/comment/34617560
downvote count: 0
linked to: http://stackoverflow.com/q/3327526
favorite count: 0
tagged with: file-io
tagged with: macos
upvote count: 5
type: UnansweredQuestion
linked to: http://stackoverflow.com/q/9230094
has answer: http://stackoverflow.com/a/38791524
has comment: http://stackoverflow.com/comment/34635368
has title: Associating file extension with Java JRE7 application for Mac
has answer: http://stackoverflow.com/a/23745580
linked to: http://stackoverflow.com/q/1575190
tagged with: plist
tagged with: java
has body: I would like to enable an opening of a file associated with my application by double-clicking on Mac. This question have been asked (many) times before, see for example Double click document file in Mac OS X to open Java application However, it looks like the changes occurred since 2009 (when the solution was posted). That solution was effectively based on 2004 article https://today.java.net/pub/a/today/2004/01/05/swing.html and relied on two pieces of the puzzle: 1. Java program should register file opening event and act appropriately. This has been accomplished using com.apple.eawt Application and Application Adapters. 2. The OS needs to be familiar with the extension, which is done by using CFBundleDocumentTypes key in .plist of the package. The constructions used in 2004 com.apple.eawt are depreciated, as mentioned in several discussions, including What's the alternative to using the now deprecated com.apple.eawt.ApplicationAdapter in Java Swing apps on the Mac? (Feb 11) It is noted there that OpenFilesHandler replaces depreciated constructions. The link to the API doc mentioned in the answer is not functioning anymore, so it is not immediately clear how to use this construction. I found the following reference that explains the reasons for the depreciation, but the link to the documentation is obsolete as well: http://lists.apple.com/archives/java-dev/2012/Jan/msg00101.html I was not able to find any documentation online for the updated API. The Apple Developer site also refers to examples in X code that are not present in the version I have (5.0.2) In the discussion in (2012) https://stackoverflow.com/questions/8857431/java-mac-jdk-7-beta-apple-application-listener-no-longer-works OpenFilesEvent was mentioned in the context of switching from jdk6 to jdk7-beta and the conclusion was the some errors attributed to jdk7-beta. Finally, also in 2012 the following question was posed where the use of OpenFilesHandler was similar. Grabbing the openFileEvent on MacOSX (…

http://stackoverflow.com/comment/34773104
has text: I Think There is Error With your Create Table. Post Your dbhelper Class Will helpful
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/22802968
type: Comment

http://stackoverflow.com/comment/34554382
score: 0
type: Comment
has text: I just added a question on the comment above **[Here:** ***How can I add an action Listener onto an appointment in an agenda (JFXtras Agenda)](http://stackoverflow.com/questions/22681781/how-can-i-add-an-action-listener-onto-an-appointment-in-an-agenda-jfxtras-agend)***. Please take a look if you can. Thanks for the help...
type: AnswerComment
comment on: http://stackoverflow.com/a/22680098

http://stackoverflow.com/comment/34540516
has text: Well, yes, an `InputStreamReader` basically turns an `InputStream` into a `Reader`, by wrapping it in logic to convert bytes to characters. It doesn't make sense to try and construct it from something that's already a `Reader`.
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/22673574
score: 1

http://stackoverflow.com/comment/34545486
comment on: http://stackoverflow.com/q/22676515
score: 0
type: Comment
type: QuestionComment
has text: I think `repaint()` is the preferred method.

http://stackoverflow.com/comment/47440623
type: AnswerComment
has text: @RenéLink No, the OP wanted to exclude all fields of a particular class, not fields being of some type. That is (e.g class Clazz { String f;}) if all fields of class Clazz are to be excluded, then we should use "f.getDeclaringClass() == Clazz.class", not "f.getDeclaredClass() == String.class".
score: 0
comment on: http://stackoverflow.com/a/22764068
type: Comment

http://stackoverflow.com/q/22782696
type: Question
upvote count: 2
has comment: http://stackoverflow.com/comment/34736150
has comment: http://stackoverflow.com/comment/34736326
tagged with: http://stackoverflow.com/tag/xml
favorite count: 0
type: UnansweredQuestion
linked to: http://stackoverflow.com/q/4481226
tagged with: android
score: 2
downvote count: 0
answer count: 0
tagged with: java
has title: how to code for floating touch in android app
has body: I am developing an app that has to use a floating touch button that performs some action on click. It always remains on top in every app and other apps on screen are still accessible. This is somewhat similar to assistive touch feature in iPhone. Please can anybody help me with how to code for this feature in my android app?
tagged with: eclipse

http://stackoverflow.com/a/22768528
answers question: http://stackoverflow.com/q/22768484
type: Answer
downvote count: 0
score: 1
has body: It looks like you are using a conditional with the else statement, and not using your operators correctly. You want to change this to else if (gross &gt; 9075 &amp;&amp; gross &lt; 36900) Notice I have changed else to else if and changed the conditional to have the comparisons done correctly.
upvote count: 1

http://stackoverflow.com/q/22741323
answer count: 1
favorite count: 0
accepted answer: http://stackoverflow.com/a/22741445
has comment: http://stackoverflow.com/comment/34661746
has comment: http://stackoverflow.com/comment/34661694
tagged with: android
has title: Getting null pointer exception on getting Async Task JSON using Android
has comment: http://stackoverflow.com/comment/34661736
tagged with: android-asynctask
type: AnsweredQuestion
has body: I'm getting a NullPointerException when I try to request a JSON with AsyncTask. I'm using loopj and AsyncTask Here's my code: String str = null; public class MainActivity extends Activity { @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); new TheTask().execute(); } class TheTask extends AsyncTask&lt;Void, Void, String&gt; { @Override protected String doInBackground(Void... params) { try{ AsyncHttpClient client = new AsyncHttpClient(); client.addHeader("Authorization", "Token token=Wa5sfwP3ku7c15qkZTsd**"); client.get("http://*********.com/api/v1/***", new AsyncHttpResponseHandler() { @Override public void onSuccess(String response) { str = response; Log.v("==========RESULT==========", response); } }); } catch(Exception e){ Log.v("========== ERROR ==========", e.toString()); } return str; } @Override protected void onPostExecute(String result) { TextView txt = (TextView) findViewById(R.id.textView1); txt.setText("Result: " + result); } } }
upvote count: 2
has comment: http://stackoverflow.com/comment/34661790
downvote count: 1
type: Question
has answer: http://stackoverflow.com/a/22741445
has comment: http://stackoverflow.com/comment/34661617
score: 1
tagged with: java
has comment: http://stackoverflow.com/comment/34661697
tagged with: http://stackoverflow.com/tag/json
has comment: http://stackoverflow.com/comment/34661692
has comment: http://stackoverflow.com/comment/34661710

http://stackoverflow.com/q/22754774
has body: Using the iText5 PDF library, I am able to read bookmarks exist in PDF. Now I want to change the zoom level of bookmarks (Inherit zoom) in existing PDF using iText. Is it possible using the iText PDF library, and how? I have attached a screenshot. This is the code I am using to change the bookmark zoom level (as per @lowagie comment): public void changeList(List&lt;HashMap&lt;String, Object&gt;&gt; list) { for (HashMap&lt;String, Object&gt; entry : list) { for (String key : entry.keySet()) { System.out.println(key); if ("Kids".equals(key)) { Object o = entry.get(key); changeList((List&lt;HashMap&lt;String, Object&gt;&gt;) o); } else if ("Page".equals(key)) { String dest = (String) entry.get(key); entry.put("Page", dest.replaceAll("Fit", "XYZ 30 100 0")); } } } } Bookmark Tree Structure :
linked to: http://stackoverflow.com/q/24260323
type: AnsweredQuestion
score: 2
tagged with: java
tagged with: itext
type: Question
has answer: http://stackoverflow.com/a/22763297
answer count: 2
downvote count: 0
linked to: http://stackoverflow.com/q/24217657
has answer: http://stackoverflow.com/a/24237904
accepted answer: http://stackoverflow.com/a/24237904
has title: Itext change bookmarks zoom level to inherit zoom in existing pdf
favorite count: 0
possible better answer: http://stackoverflow.com/a/22763297
upvote count: 2

http://stackoverflow.com/q/22698501
possible better answer: http://stackoverflow.com/a/22698543
favorite count: 0
has answer: http://stackoverflow.com/a/22698543
tagged with: android
has comment: http://stackoverflow.com/comment/34585615
has body: Re-edited... I'd like to use a superclass constructor which is hidden by the "@hide" Android tag (or whatever it is). I'm about to extend a class which has been already extended twice (within the Android OS). I'd like to create my own subclass (i.e. outside the Android OS). Example subclass, taken from Android sources: public class WifiP2pDnsSdServiceInfo extends WifiP2pServiceInfo { ... private WifiP2pDnsSdServiceInfo(List&lt;String&gt; queryList) { super(queryList); // &lt;-- this is what I'm trying to do, too } public static WifiP2pDnsSdServiceInfo newInstance(String instanceName, String serviceType, Map&lt;String, String&gt; txtMap) { ... ArrayList&lt;String&gt; queries = new ArrayList&lt;String&gt;(); ... return new WifiP2pDnsSdServiceInfo(queries); } } The superclass looks like this: public class WifiP2pServiceInfo implements Parcelable { ... // this is marked as @hidden therefore inaccessible! protected WifiP2pServiceInfo(List&lt;String&gt; queryList) { if (queryList == null) { throw new IllegalArgumentException("query list cannot be null"); } mQueryList = queryList; } } And all I want to do is to make another kind of WifiP2pServiceInfo, similar to the WifiP2pDnsSdServiceInfo example above. I can't just inherit &amp; call super() because the superclass constructor is tagged by Android's "@hide", therefore unusable without reflection for non-system programmers. So my question is how to access / call the superclass constructor if I can't do it by a plain super() call? Reflection should come handy here but I'm not very experienced in Java programming.
score: 2
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/22746189
tagged with: reflection
upvote count: 3
tagged with: java
has title: Reflection: how to call superclass constructor which is hidden?
has comment: http://stackoverflow.com/comment/34586299
has comment: http://stackoverflow.com/comment/34585659
downvote count: 1
has comment: http://stackoverflow.com/comment/34585059
tagged with: superclass
type: Question
has comment: http://stackoverflow.com/comment/34585362
has comment: http://stackoverflow.com/comment/34585920
accepted answer: http://stackoverflow.com/a/22746189
has comment: http://stackoverflow.com/comment/34585086
has comment: http://stackoverflow.com/comment/34585975
has comment: http://stackoverflow.com/comment/34586314
answer count: 2
has comment: http://stackoverflow.com/comment/34585234

http://stackoverflow.com/comment/34770145
comment on: http://stackoverflow.com/q/22801211
has text: possible duplicate of [Reading from JAVA socket slower than Python](http://stackoverflow.com/questions/22569516/reading-from-java-socket-slower-than-python)
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/34729899
score: 0
type: Comment
has text: As a temporary solution I put a `try/catch` hopefully it will work for now, still looking how to fix it the right way without adding external classes or libraries
type: QuestionComment
comment on: http://stackoverflow.com/q/22778981

http://stackoverflow.com/q/22673586
tagged with: object-pooling
has answer: http://stackoverflow.com/a/22674001
score: 0
tagged with: java
has comment: http://stackoverflow.com/comment/34541030
possible better answer: http://stackoverflow.com/a/22674001
tagged with: libgdx
has comment: http://stackoverflow.com/comment/34540781
has body: In my Android app I created a View showing a field of 9x9 (see simplified screenshot): Each field in the view is represented by an ImageView (showing pictures instead of rectangles). Some ImageViews will be deleted by setting them to null and setting visibility to View.GONE and new ImageViews will be created every time a new element is added to the field. This means I create lots of ImageViews in a short amount of time. The point is, the game runs great on my HTC One, but it's lagging after a while (I think when garbage collection is running) and then it stops lagging and works great again. This brings me to the idea of using Pool's to manage my objects, e.g. by recycling "deleted ImageViews" and reuse them by setting the position and changing the image source. I'm developing for plain Android, but I think about using the LibGDX framework. My question is: Would you have any suggestions on how to implement Pool's in plain Java/Android? I found this post interesting, thought I could go with the Apache Commons ObjectPool. Is there a better way on Android or LibGDX? Note: The ImageView's are not at the same position each round. I move them around using the Tween Engine. However, the number of the image views is kind of constant. Means at some point of the game I do have 81 ImageView's (9*9) plus a few ImageView's for animating special events (maybe +10). I would appreciate any advices/recommendations. Best regards, Jimmy
has answer: http://stackoverflow.com/a/22674145
type: AnsweredQuestion
has title: Object pools to handle ImageViews in Android?
has comment: http://stackoverflow.com/comment/34541156
type: Question
linked to: http://stackoverflow.com/q/8924086
answer count: 2
tagged with: android
accepted answer: http://stackoverflow.com/a/22674145
has comment: http://stackoverflow.com/comment/34540510

http://stackoverflow.com/comment/45658648
type: Comment
has text: thank you for your answer. I thought about something like this as well, but you will probably need an EventFilter to succed, to block all clicks from arriving at the component as well. I was just wondering why the behavior was so messed up, when I changed the TreeColumn from the first to the second one. But this seemed to be an offical bug which is fixed in 8u60, so I dont have to worry about it anymore.
type: AnswerComment
score: 0
comment on: http://stackoverflow.com/a/28640953

http://stackoverflow.com/comment/34608349
type: Comment
has text: prakash my friend if i remove this line so no effect on output
type: AnswerComment
comment on: http://stackoverflow.com/a/22711430
score: 0

http://stackoverflow.com/comment/34676412
comment on: http://stackoverflow.com/q/22749362
has text: d is an int, you should use `String.valueOf(d)`
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/a/22735778
has comment: http://stackoverflow.com/comment/34654458
has comment: http://stackoverflow.com/comment/34666758
accepted answer of: http://stackoverflow.com/q/22735089
upvote count: 1
has comment: http://stackoverflow.com/comment/34666240
type: AcceptedAnswer
answers question: http://stackoverflow.com/q/22735089
has comment: http://stackoverflow.com/comment/34659305
type: Answer
has body: Calling setContentView two times would not work. Instead you should put your canvas view and the button in a single layout itself but with proper ordering. The last widget in the relative layout gets more priority, so if you want the button to come on top of the canvas your layout should be something like this. &lt;?xml version="1.0" encoding="utf-8"?&gt; &lt;RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" android:background="@drawable/umap2" android:layout_width="match_parent" android:layout_height="match_parent" android:orientation="vertical" &gt; &lt;com.example.client.MapView android:id="@+id/mapView" android:layout_width="wrap_content" android:layout_height="wrap_content" /&gt; &lt;Button android:id="@+id/button1" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_alignParentBottom="true" android:layout_alignParentLeft="true" android:text="Button" /&gt; &lt;/RelativeLayout&gt; And to access your MapView in java class @Override protected void onCreate(Bundle savedInstanceState) { // TODO Auto-generated method stub super.onCreate(savedInstanceState); setContentView(R.layout.campus); setSize(); this.mapv = findViewById(R.id.mapView); //!! my view i= new Intent(this, myService.class); this.startService(i); } And obviously alert dialog will be on top of the canvas. Hope it helps! Edit: I think inflate error is due to incorrect class path. Since MapView is inner class of Campus, path should be like this &lt;com.example.client.Campus.MapView android:id="@+id/mapView" android:layout_width="match_parent" android:layout_height="match_parent" /&gt; Also add this constructor to your MapView class public MapView(Context context, AttributeSet attributeSet) { super(context, attributeSet) ; redPaint = new Paint(); redPaint.setAntiAlias(true); redPaint.setColor(Color.RED); redPaint.setTextSize(10); }
has comment: http://stackoverflow.com/comment/34654666
downvote count: 0
score: 1

http://stackoverflow.com/comment/34692433
type: QuestionComment
score: 1
comment on: http://stackoverflow.com/q/22757396
has text: possible duplicate of http://stackoverflow.com/questions/4430710/how-can-i-disable-jobs-in-quartz-jdbcjobstore
type: Comment

http://stackoverflow.com/q/22691635
favorite count: 0
has answer: http://stackoverflow.com/a/22692089
type: UnansweredQuestion
has body: When I annotate my FIELDS with @NotNull and validate the bean, I get the following default messages for these locales en_CA May not be null fr_CA ne peut pas être nul I would like to change the fr_CA message to ne peut pas être vide. How would I do that?
score: 1
tagged with: java
upvote count: 1
type: Question
tagged with: gwt
has title: Gwt @NotNull default message override for foreign language
answer count: 2
tagged with: validation
downvote count: 0
has answer: http://stackoverflow.com/a/22691871

http://stackoverflow.com/comment/34765708
type: Comment
has text: @Welshboy I tried doing that and it didn't print out anything. I edited my original code to display what I currently have. Any ideas where I'm going wrong here?
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/22798597

http://stackoverflow.com/comment/34665369
comment on: http://stackoverflow.com/a/22740538
score: 0
type: Comment
type: AnswerComment
has text: Thank you for the detailed explanation. It seems that I mislead myself by assuming that there should be a 'magical' way to do it with character streams, given that they were introduced later in Java.

http://stackoverflow.com/comment/34740810
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/22783956
type: Comment
has text: What do you mean with **in** ResultSet? Can't you access `rs.next()`? Or are you not able to store the result of `rs.getDouble(x)` to the variable? How do you define your Arrays `flat` and `flng`?

http://stackoverflow.com/a/22713518
score: 1
upvote count: 1
answers question: http://stackoverflow.com/q/22711290
downvote count: 0
type: Answer
has body: For datasources that comply with the JDBC specification the way to return connections to the connection pool is to call close(). The JDBC specification mandates that connections obtained from a pool should behave no different (from the perspective of the user of that connection) as a non-pooled connection; that includes having to call close() when you are done with the connection. To this end a connection pool usually wraps or proxies a connection so that it can return the connection to the pool (+ additional cleanup like closing statement and resultset (proxies)) when close().

http://stackoverflow.com/q/22649876
score: 1
tagged with: java
has title: Creating Dynamic textBox inside PanelGrid using Jsf
type: Question
upvote count: 1
favorite count: 0
type: UnansweredQuestion
has body: I have an Problem in Creating dynamic inputText inside HtmlPaneGrid in jsf. The Thing whic i have done as Follows: 1)I have an DropDown where the User Selects no. of Subjects. 2)Based on the value Selected in dropDown,i have to create inputText inside PanelGrid. 3)So in ajax change event of dropDown,im creating HtmlInputText and add it to htmlPanelGrid and update HtmlPanelGrid 4)This HtmlPanelGrid is binded to backing bean named Subject. Problems which im facing: When i select any one of the value(say for eg:3),No textbox is getting displayed in htmlPanelGrid initially. When i select another value(eg:2),Previous value is 3(so 3 TextBoxes are getting displayed) when i select another value(eg:4),Previous value is 2(so 2 TextBoxes are getting displayed) Solution Which i need: When i selct 2,2 textbox should be displayed 3 means 3 textboxes should be displayed and so on. My Xhtml Code:(This is part of xhtml code.Not Full Xhtml Code has been pasted) &lt;?xml version="1.0" encoding="UTF-8"?&gt; &lt;!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "htth://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"&gt; &lt;html xmlns="http://www.w3.org/1999/xhtml" xmlns:f="http://java.sun.com/jsf/core" xmlns:h="http://java.sun.com/jsf/html" xmlns:ui="http://java.sun.com/jsf/facelets" xmlns:p="http://primefaces.org/ui" xmlns:c="http://java.sun.com/jsp/jstl/core"&gt; &lt;h:head&gt;&lt;/h:head&gt; &lt;ui:composition template="/templates/common/layout.xhtml"&gt; &lt;ui:define name="content"&gt; &lt;h:body&gt; &lt;h:form&gt; &lt;p:panel header="Add Subject"&gt; &lt;p:growl id="subjGrowl" showDetail="true"&gt;&lt;/p:growl&gt; &lt;f:view&gt; &lt;p:panelGrid&gt; &lt;f:facet name="header"&gt; &lt;p:row&gt; &lt;p:column&gt;Degree&lt;/p:column&gt; &lt;p:column&gt;Department&lt;/p:column&gt; &lt;p:column&gt;Academic Session From&lt;/p:column&gt; &lt;p:column&gt;Academic Session To&lt;/p:column&gt; &lt;p:column&gt;Semester&lt;/p:column&gt; &lt;p:column&gt;Number Of Subjects&lt;/p:col…
answer count: 0
tagged with: jsf
downvote count: 0

http://stackoverflow.com/q/22732301
tagged with: codenameone
has title: How to implement a j2me client that fetches large data (about 5000 entries) and updates from server in real time
linked to: http://stackoverflow.com/q/24121003
answer count: 1
tagged with: java-me
favorite count: 0
has answer: http://stackoverflow.com/a/22734696
type: AnsweredQuestion
has body: Am using codename one for the client side and java servlet for the server side. I have a list of information(text, pictures and audio) on the server that changes frequently and a mobile client that let users view these information. Please, what is the best approach for fetching all these information and reflecting all the changes(updates to the data) on the client in real time, so as to avoid out-of-memory error, long time network lock on the client UI and make the updates appear in real time for all the data.
tagged with: java
downvote count: 1
type: Question
upvote count: 0
score: -1
accepted answer: http://stackoverflow.com/a/22734696

http://stackoverflow.com/comment/34761325
score: 1
has text: You should be more specific. What do you mean didn't work out? What is the expected and actual outcome of your tests?
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/22796290

http://stackoverflow.com/comment/34526366
type: Comment
comment on: http://stackoverflow.com/a/22662809
has text: This [link](http://www.mkyong.com/java/how-to-copy-directory-in-java/) should help you.
type: AnswerComment
score: 0

http://stackoverflow.com/comment/34676320
type: Comment
type: QuestionComment
score: 1
has text: And why are you using the length of some string representation of `tomData` to work out how far to iterate? And where do you think the `getMark1` method is declared? (Hint: it's not on `ArrayList`...)
comment on: http://stackoverflow.com/q/22749336

http://stackoverflow.com/comment/34576295
score: 0
has text: can't you just add a dependency from .war to ear? Which version of JBoss is this?
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/22693884

http://stackoverflow.com/comment/34616713
type: Comment
comment on: http://stackoverflow.com/q/22716105
type: QuestionComment
has text: @Absurd-Mind How about `if (s == "")`?
score: 1

http://stackoverflow.com/q/22651226
type: Question
tagged with: list
has title: Define a method for a List of customClass
tagged with: java
upvote count: 1
tagged with: methods
answer count: 1
has answer: http://stackoverflow.com/a/22651284
type: AnsweredQuestion
downvote count: 0
score: 1
has body: I'm writing a plugin, and have some custom classes already built. The way I've written everything so far (around 1000 lines), using a list is the most convenient way to store the class instances, so I've got a few lines at the top of the main class like public List&lt;Job&gt; Jobs;. In the Job class, for example's sake, I have a field called name. I'm wondering if there's a way to define a method for List&lt;Job&gt; because I would like to have a simpler way to figure out if any of the Jobs in the list have a name matching something and then what that job's index would be in the list.
favorite count: 0
accepted answer: http://stackoverflow.com/a/22651284

http://stackoverflow.com/comment/34616355
type: AnswerComment
type: Comment
score: 2
has text: You should accept the answer **You** think is the right one, which answers your question best.
comment on: http://stackoverflow.com/a/22715869

http://stackoverflow.com/a/22682200
has comment: http://stackoverflow.com/comment/43432462
has body: Missing org.glassfish.hk2.api library.
type: Answer
score: 2
downvote count: 0
upvote count: 2
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/22678588
answers question: http://stackoverflow.com/q/22678588
has comment: http://stackoverflow.com/comment/43432387
has comment: http://stackoverflow.com/comment/34727747

http://stackoverflow.com/q/22711571
favorite count: 0
tagged with: multicast
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/22715629
tagged with: java
type: Question
tagged with: network-programming
tagged with: hazelcast
has title: In Hazelcast, multicast auto discovery for the same vpc instances is not working
has body: We have opened TCP ports from 5701 to 5709 and also opened UDP port of 54327 which includes inbound and out bound rules in aws console. We have enabled multicast mode as true, TCP/IP mode as false in both machines Hazelcast configuration. And also added the following line in iptables iptables -A INPUT -m pkttype --pkt-type multicast -j ACCEPT But two machines Hazelcast cluster members are not connected. Are there any other reasons. Could you please provide if there are any other missed points here.
score: 4
tagged with: amazon-web-services
has answer: http://stackoverflow.com/a/22712600
upvote count: 4
answer count: 2
downvote count: 0

http://stackoverflow.com/q/22660833
has title: Caused by: java.lang.ClassNotFoundException: Didn't find class on path
has comment: http://stackoverflow.com/comment/34516968
type: UnansweredQuestion
score: 2
downvote count: 0
tagged with: splash-screen
favorite count: 0
has answer: http://stackoverflow.com/a/22660978
type: Question
upvote count: 2
tagged with: android
has answer: http://stackoverflow.com/a/24597801
has body: after launching my app, emulator tells me that unfortunatelly it had stopped. I had the same error previously, then I fixed it but after adding splash activity i have this problem again. 03-24 15:14:21.180: E/AndroidRuntime(857): FATAL EXCEPTION: main 03-24 15:14:21.180: E/AndroidRuntime(857): Process: com.gosha.bux, PID: 857 03-24 15:14:21.180: E/AndroidRuntime(857): java.lang.RuntimeException: Unable to instantiate activity ComponentInfo{com.gosha.bux/com.gosha.bux.perv}: java.lang.ClassNotFoundException: Didn't find class "com.gosha.bux.perv" on path: DexPathList[[zip file "/data/app/com.gosha.bux-2.apk"],nativeLibraryDirectories=[/data/app-lib/com.gosha.bux-2, /system/lib]] 03-24 15:14:21.180: E/AndroidRuntime(857): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2121) 03-24 15:14:21.180: E/AndroidRuntime(857): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2245) 03-24 15:14:21.180: E/AndroidRuntime(857): at android.app.ActivityThread.access$800(ActivityThread.java:135) 03-24 15:14:21.180: E/AndroidRuntime(857): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1196) 03-24 15:14:21.180: E/AndroidRuntime(857): at android.os.Handler.dispatchMessage(Handler.java:102) 03-24 15:14:21.180: E/AndroidRuntime(857): at android.os.Looper.loop(Looper.java:136) 03-24 15:14:21.180: E/AndroidRuntime(857): at android.app.ActivityThread.main(ActivityThread.java:5017) 03-24 15:14:21.180: E/AndroidRuntime(857): at java.lang.reflect.Method.invokeNative(Native Method) 03-24 15:14:21.180: E/AndroidRuntime(857): at java.lang.reflect.Method.invoke(Method.java:515) 03-24 15:14:21.180: E/AndroidRuntime(857): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:779) 03-24 15:14:21.180: E/AndroidRuntime(857): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:595) 03-24 15:14:21.180: E/AndroidRuntime(857): at dalvik.system.NativeStart.main(Native Method) 03-24 15:14:21.180: E/AndroidRuntime(857…
has answer: http://stackoverflow.com/a/45204054
tagged with: java
has answer: http://stackoverflow.com/a/22660946
has comment: http://stackoverflow.com/comment/34517026
has comment: http://stackoverflow.com/comment/39127668
tagged with: logcat
answer count: 4

http://stackoverflow.com/q/22735228
downvote count: 0
has body: I have tried to add a counter to my program using a while loop but have not been able to get it working yet. Can someone tell me where I am going wrong, i got it to work a little bit but if i enter a correct value the "wrong" text will still come up, it wont break out of the loop. public class Username { public static void main (String[]args) { Scanner kb = new Scanner (System.in); String [] name = {"barry", "matty", "olly","joey"}; int j = 0; while (j &lt; 3) { System.out.println("Enter your name"); String name1 = kb.nextLine(); boolean b = true; for (int i = 0; i &lt; name.length; i++) { if (name[i].equals(name1)) { System.out.println("you are verified you may use the lift"); break; // To stop loop checking names } } System.out.println("wrong"); j++; } } }
favorite count: 0
has comment: http://stackoverflow.com/comment/34651128
upvote count: 2
has answer: http://stackoverflow.com/a/22735417
accepted answer: http://stackoverflow.com/a/22735417
possible better answer: http://stackoverflow.com/a/22735341
has answer: http://stackoverflow.com/a/22735344
answer count: 4
score: 2
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/34651653
tagged with: java
type: Question
has title: Fixing while loop that contains a counter
has comment: http://stackoverflow.com/comment/34651879
has answer: http://stackoverflow.com/a/22735341
tagged with: while-loop
has answer: http://stackoverflow.com/a/22735363

http://stackoverflow.com/a/22768210
score: 1
has comment: http://stackoverflow.com/comment/34710732
has comment: http://stackoverflow.com/comment/34710862
has body: There are several algorithms that will help you. I suggest Aho-Corasick or Rabin-Karp, but a suffix tree may also come in handy. Rabin-Karp is the easiest to implement of those, but Aho-Corasick does not use hashes and so you don't need to take special care of collisions.
has comment: http://stackoverflow.com/comment/34710933
upvote count: 1
downvote count: 0
has comment: http://stackoverflow.com/comment/34710628
type: Answer
answers question: http://stackoverflow.com/q/22767742

http://stackoverflow.com/q/22751356
has comment: http://stackoverflow.com/comment/34680298
score: 0
tagged with: junit
favorite count: 0
has title: Junit - Spring - Testing Collections
has answer: http://stackoverflow.com/a/22751716
upvote count: 1
has comment: http://stackoverflow.com/comment/34680145
tagged with: spring
downvote count: 1
tagged with: spring-mvc
type: AnsweredQuestion
tagged with: java
possible better answer: http://stackoverflow.com/a/29443837
has comment: http://stackoverflow.com/comment/34680241
has answer: http://stackoverflow.com/a/29443837
type: Question
answer count: 2
has body: Can you please advise who to test Collection with JUnit 4 and Spring MVC? Controller @Controller public class PersonController { @Autowired private PersonService personService; @RequestMapping(value = {"/", "/index"}, method = RequestMethod.GET) public String getPerson(Model model) { model.addAttribute("personData", personService.getPerson); return "personPage"; } } Testing a Person class can be done by: public class TestPersonController { @Mock private PersonService personService; @InjectMocks private PersonController personController; private MockMvc mockMvc; @Before public void setup() { MockitoAnnotations.initMocks(this); mockMvc = MockMvcBuilders.standaloneSetup(personController).build(); } @Test public void testGetPerson() throws Exception { when(personService.getPerson(1L)).thenReturn(new Person(1L, "StackOverflow")); mockMvc.perform(get("/person/{id}", 1L)) .andExpect(status().isOk()) .andExpect(view().name("personPage")) .andExpect(model().attribute("personData", allOf(hasProperty("id", is(1L)), hasProperty("name", is("StackOverflow"))))); } } But I am not able to figure out how to test if perService.getPerson return List!
accepted answer: http://stackoverflow.com/a/22751716

http://stackoverflow.com/comment/34634780
type: AnswerComment
comment on: http://stackoverflow.com/a/22725846
score: 0
type: Comment
has text: Alright but, maybe I was taught wrongly but I thought Classes could NOT have straight up code in them? I thought it was Class/method/THEN code.

http://stackoverflow.com/a/22775163
type: Answer
has comment: http://stackoverflow.com/comment/34724683
answers question: http://stackoverflow.com/q/22772113
has comment: http://stackoverflow.com/comment/34737348
has body: You can do like this: Add a new Java attribute(like boolean emailEnabled) in your Java Request Object for your REST service. Client side which invokes your REST service need to provide that parameter you added in your server side, you can set a default value for that too.
score: 0

http://stackoverflow.com/comment/34677319
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/22749401
type: Comment
has text: Thank you @ludo_rj. Quick question. What is is the advantages or wrapping a BufferedReader with a InputStreamReader vs a FileReader ?

http://stackoverflow.com/comment/34691031
has text: You should keep the "provided" scope, I think. Otherwise the dependency might end-up in the EAR/ WAR file.
type: Comment
type: AnswerComment
comment on: http://stackoverflow.com/a/22756566
score: 0

http://stackoverflow.com/a/22750086
type: Answer
has body: To search your data with strength array sorted in ascended order use binarySearch: double threshold = 2.0d; int index = Arrays.binarySearch(strength, threshold); if (index &lt; 0) { index = -index - 1; } since your two arrays are "synced" this index will match your String array. Note, you could implement "binding" of strength/names data and their sorting much cleaner and more effectively in at least two different ways : use Map to store your bindings assuming your strength keys are unique, and then sorting by keys. Use helper POJO class MyData holding both strength and name, as in Hannes's answer and sort array of MyData objects supplying custom Comparator, then do binarySearch with same comparator to find index according to your requirements.
answers question: http://stackoverflow.com/q/22749761
score: 0

jms
tags question: http://stackoverflow.com/q/22775518
tags question: http://stackoverflow.com/q/22691093
tags question: http://stackoverflow.com/q/22760423
tags question: http://stackoverflow.com/q/22753380
tag name: jms
tags question: http://stackoverflow.com/q/22743406
tags question: http://stackoverflow.com/q/22691804
tags question: http://stackoverflow.com/q/22765961
tags question: http://stackoverflow.com/q/22695729
tags question: http://stackoverflow.com/q/22724474
type: Tag
tags question: http://stackoverflow.com/q/22672419
tags question: http://stackoverflow.com/q/22661163
tags question: http://stackoverflow.com/q/22802865
tags question: http://stackoverflow.com/q/22717249
tags question: http://stackoverflow.com/q/22718428

http://stackoverflow.com/comment/34711449
type: Comment
has text: @Guardanis - Please see the edit, I gave a quick attempt at what I thought you were suggesting. I'm guessing I'm using the `Handler`/`Runnable` incorrectly because it never updates the global `boolean`. I take it you had something a little different in mind? Or do I actually have to do something specific to spawn a second thread to run the handler?
score: 0
comment on: http://stackoverflow.com/q/22768191
type: QuestionComment

http://stackoverflow.com/q/22801249
has answer: http://stackoverflow.com/a/22952872
accepted answer: http://stackoverflow.com/a/22952872
possible better answer: http://stackoverflow.com/a/22801651
score: 0
has body: So I have a project that works totally fine in one workspace on my machine. I push it to the repository so everyone else can work on it. I go to pull it down making sure all the changes are good. I import the project into a new workspace and using eclipse with autobuild on it produces no errors. I go to the command line and run ant clean release on the project and right before it gets to run crunch on the assets the build fails with a mulitple dex files define error. Ive checked the project high and low and compared to the other copy of it in the original workspace but for what ever reason I cant get it to build. I erase the bin and gen folders and remove all the imports and basically leave just the project, run clean in eclipse, and still get a dex define error related to one of the lib projects classes. Ive tried to find where extra copies could be but I dont find anything. googling around for the past few days hasnt helped as the normal solutions to such a problem havent worked for me. So what is the best way to figure out where the extra class definitions are coming from so I can get rid of them and fix the repository so I can use it correctly. I have a feeling its related to one of the files in the project that I should be excluding in my gitignore but Im not sure which that would be. Any help on the matter would be greatly appreciated cause this has eaten quite a bit of time of just messing around.
tagged with: android
has title: Multiple dex files error when building project downloaded from git
has answer: http://stackoverflow.com/a/22801651
tagged with: git
type: AnsweredQuestion
tagged with: java
tagged with: eclipse
type: Question
answer count: 2
tagged with: ant

http://stackoverflow.com/comment/34696066
type: Comment
comment on: http://stackoverflow.com/a/22756555
has text: sorry wrong fetch version, I just corrected it. I just dragged and dropped it to the layout, it should be enough doesn't it? Is the code for `fetch` right when using `row` variable there and declare row's keys (`columnTitle` in this case) as column output?
type: AnswerComment
score: 0

http://stackoverflow.com/a/22683826
has comment: http://stackoverflow.com/comment/34558560
score: 2
upvote count: 2
has body: As the EmbeddedGraphDatabase class is deprecated (it will be hidden in a future release), it's a good practice to already avoid it. The best way to build a GraphDatabaseSerice, is by using the GraphDatabaseFactory and in your case the related GraphDatabaseBuilder. If you'd configure your Spring beans in java, this is what it could look like: @Configuration @ImportResource("applicationContext.xml") class SpringConfiguration extends Neo4jConfiguration { @Bean(destroyMethod = "shutdown") public GraphDatabaseService graphDatabaseService() { return new GraphDatabaseFactory().newEmbeddedDatabaseBuilder("db") .setConfig("enable_remote_shell", "true").newGraphDatabase(); } } I realize that the setConfig method I'm using is deprecated as well, but I don't see an equivalent in the GraphDatabaseSettings class. If you want to use this approach, you'll have to use a AnnotationConfigWebApplicationContext in your web.xml. If you wish to continue with XML configuration, there' a convenience bean: &lt;bean id="graphDatabaseService" class="org.springframework.data.neo4j.support.GraphDatabaseServiceFactoryBean" destroy-method="shutdown" scope="singleton"&gt; &lt;constructor-arg value="db"/&gt; &lt;constructor-arg&gt; &lt;map&gt; &lt;entry key="enable_remote_shell" value="true"/&gt; &lt;/map&gt; &lt;/constructor-arg&gt; &lt;/bean&gt;
accepted answer of: http://stackoverflow.com/q/22677382
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/34559097
has comment: http://stackoverflow.com/comment/34558946
has comment: http://stackoverflow.com/comment/34558643
type: Answer
answers question: http://stackoverflow.com/q/22677382

http://stackoverflow.com/q/22782786
downvote count: 1
tagged with: android-ndk
type: Question
tagged with: http://stackoverflow.com/tag/c
score: 0
answer count: 2
favorite count: 0
has title: Are `malloc` and `free` Java NDK Wrap the only way to overcome automatic recycling with Android?
has body: Are malloc and free Java NDK Wrap the only way to overcome automatic recycling with Android? inline jlong Java_edu_gnu_Native_malloc(jint size) { return (jlong)malloc(size); } inline void Java_edu_gnu_Native_free(jlong pointer) { free((void*)pointer); }
type: UnansweredQuestion
tagged with: android
tagged with: java
has answer: http://stackoverflow.com/a/22866706
has answer: http://stackoverflow.com/a/22782963
upvote count: 1
tagged with: memory

http://stackoverflow.com/comment/34550093
comment on: http://stackoverflow.com/q/22678968
has text: as you said, if it is hidden? how to find it out?
score: 0
type: QuestionComment
type: Comment

http://stackoverflow.com/comment/101747730
has text: Reboot was required for me.
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/26610279
type: Comment

http://stackoverflow.com/q/22778293
favorite count: 0
accepted answer: http://stackoverflow.com/a/22778497
type: Question
upvote count: 2
has comment: http://stackoverflow.com/comment/34728589
tagged with: spring
answer count: 1
has body: Suppose I want to improve performance by loading whole contents of .css, .js and some other files (favicon, some images) directly from RAM memory without hitting disk. I can just write servlet/controller which will load those files on context init or first request and cache in simple String, but is there any standard already made solution to serve selected static resources from RAM in Spring, Servlets or Tomcat specification? It would be nice to support proper headers also (cache-control etc.).
tagged with: java
tagged with: caching
has answer: http://stackoverflow.com/a/22778497
has title: Elegant way to serve static resources from memory in Spring / Servlet / Tomcat?
tagged with: tomcat
tagged with: servlets
score: 2
has comment: http://stackoverflow.com/comment/34731685
type: AnsweredQuestion
downvote count: 0

http://stackoverflow.com/a/22755219
answers question: http://stackoverflow.com/q/22755023
downvote count: 0
type: Answer
has body: Without regex: String line="\"Lee Rounded Neck, Printed\" 410.00 300.00,\"Red Blue\",lee"; System.out.println(line); char[] line2 = line.toCharArray(); boolean insideQuotes = false; for (int i = 0; i &lt; line.length(); ++i) { if (line.charAt(i) == '\"') insideQuotes = !insideQuotes; else if (line.charAt(i) == ',' &amp;&amp; !insideQuotes) line2[i] = '#'; } line = String.valueOf(line2); System.out.println(line); Output: "Lee Rounded Neck, Printed" 410.00 300.00,"Red Blue",lee "Lee Rounded Neck, Printed" 410.00 300.00#"Red Blue"#lee Ideone
upvote count: 1
score: 1

http://stackoverflow.com/q/22718335
possible better answer: http://stackoverflow.com/a/30990533
favorite count: 0
has answer: http://stackoverflow.com/a/30990533
type: Question
upvote count: 2
answer count: 2
tagged with: java
tagged with: typesafe-config
has answer: http://stackoverflow.com/a/31032380
tagged with: guice
has title: Does typesafe's config support custom converters?
accepted answer: http://stackoverflow.com/a/31032380
score: 2
type: AnsweredQuestion
downvote count: 0
has body: Context I want to automatically inject configuration items using Guice. My configuration framework is typesafe's config. public class MyObject { @Configuration("value") int value; } To do that, I wrote an annotation. // Annotations skipped, but correct public @interface Configuration { String value(); } And I wrote a module. This module checks for all types to inject, then allows the injection itself. public class ConfigurationModule extends AbstractModule { @Override protected void configure() { final Config config = ConfigFactory.load(); class ConfigurationMembersInjector&lt;T&gt; implements MembersInjector&lt;T&gt; { private final Field field; ConfigurationMembersInjector(Field field) { this.field = field; field.setAccessible(true); } @Override public void injectMembers(T t) { try { String key = field.getAnnotation(Configuration.class).value(); field.set(t, config.getXxxx()); // what to write? } catch (IllegalAccessException e) { throw new RuntimeException(e); } } } class ConfigurationTypeListener implements TypeListener { @Override public &lt;T&gt; void hear(TypeLiteral&lt;T&gt; typeLiteral, TypeEncounter&lt;T&gt; typeEncounter) { for (Field field : typeLiteral.getRawType().getDeclaredFields()) { if (field.isAnnotationPresent(Configuration.class)) { typeEncounter.register(new ConfigurationMembersInjector&lt;T&gt;(field)); } } } } bindListener(Matchers.any(), new ConfigurationTypeListener()); } } Question How do I automatically convert a configuration item to a specific yet unknown type? Is there a way to say "I want this item converted as this type"? Also, is there a way to "register" custom converters? Or else, do I have to write my own conversion mechanism?

http://stackoverflow.com/q/22683092
type: AnsweredQuestion
tagged with: swing
type: Question
tagged with: jtree
has comment: http://stackoverflow.com/comment/34558858
tagged with: java
has comment: http://stackoverflow.com/comment/34557208
accepted answer: http://stackoverflow.com/a/22683989
has comment: http://stackoverflow.com/comment/34557657
has comment: http://stackoverflow.com/comment/34556987
tagged with: defaultmutabletreenode
score: 0
has comment: http://stackoverflow.com/comment/34556918
answer count: 1
has comment: http://stackoverflow.com/comment/34557074
has title: JTree avoid collapse after reload
has comment: http://stackoverflow.com/comment/34557912
has body: I'm trying to find a solution the problem of collapse in JTree after reload it. The situation: JTree [-] Office A |---[-] Office A.1 | |---[-] Office A.1.1 | |---[-] Office A.1.2 [-] Office B |---[-] Office B.1 | |---[-] Office B.1.1 | | |---[-] Office B.1.1.1 Now I have to add the Office A.1.3. To do this I get the Office A.1 and with the method add(DefaultMutableTreeNode aNode) I add Office A.1.3. OfficeA1.add(OfficeA13); After this I call the reload method on the DefaultTreeModel of the tree. The problem is that after this call the tree collapse all: [+] Office A [+] Office B And I have to manually expand the node Office A to be sure that the node is added... [-] Office A |---[-] Office A.1 | |---[-] Office A.1.1 | |---[-] Office A.1.2 | |---[-] Office A.1.3 [+] Office B My code... DefaultMutableTreeNode root = new DefaultMutableTreeNode("Root not visibile"); DefaultMutableTreeNode usersRoot = new DefaultMutableTreeNode("Utenti"); DefaultMutableTreeNode groupsRoot = new DefaultMutableTreeNode("Gruppi"); DefaultMutableTreeNode officesRoot = new DefaultMutableTreeNode("Uffici") root.add(usersRoot); root.add(groupsRoot); root.add(officesRoot); JTree ccTree = new JTree(root); and when I add node... Office anOffice = //get the correct office object DefaultTreeModel model = (DefaultTreeModel)competenzaTree.getModel(); DefaultMutableTreeNode root = (DefaultMutableTreeNode)model.getRoot(); DefaultMutableTreeNode n = (DefaultMutableTreeNode)root.getChildAt(0); n.add(new DefaultMutableTreeNode(anOffice)); model.reload(n); The problem is whit the officesRoot node. The usersRoot and groupsRoot node are not hierarchical. Is there a way to avoid this behavior ? Thanks. Probably another way to ask can be which is the way to add/remove node from a tree without causing collapse of all tree ? p.s. I also read this post but it did not help me.
has comment: http://stackoverflow.com/comment/34558145
has answer: http://stackoverflow.com/a/22683989

http://stackoverflow.com/comment/34634023
type: QuestionComment
comment on: http://stackoverflow.com/q/22725415
has text: Do you mean this line "if (b > array.length)" should be "if (b == array.length)"? Because I still get the same errors? >
score: 0
type: Comment

http://stackoverflow.com/comment/34789382
type: AnswerComment
has text: Do you use new a EntityManager after your manual updates? Otherwise it will give you the stored entity.
score: 0
type: Comment
comment on: http://stackoverflow.com/a/22747329

http://stackoverflow.com/q/22696292
type: Question
has body: For example: string 1 = helloworld string 2 = asdfuvjerhelloworld this should return true. Another example: string 1 = helloworld string 2 = lshewodxzr this should also return true. So i'm looking how to make a method that will return a boolean that will check to see if the second string has the letters in the first string. In the second example, string2 only had the letter l once, even though the letter l shows up three times in string1 and it still returned true. Also in the second example string2 had letters that weren't in string1, but it still returned true. Any help on how to code this would be very appreciated!
tagged with: string
has answer: http://stackoverflow.com/a/22697010
score: 0
upvote count: 1
downvote count: 1
has title: How to check to see if the characters of one string are in another string
has answer: http://stackoverflow.com/a/22696937
favorite count: 0
has answer: http://stackoverflow.com/a/22696367
answer count: 5
type: UnansweredQuestion
tagged with: java
has answer: http://stackoverflow.com/a/22696750
has answer: http://stackoverflow.com/a/22697087

http://stackoverflow.com/a/22713300
upvote count: 2
answers question: http://stackoverflow.com/q/22712631
downvote count: 0
type: Answer
score: 2
has body: Instead of blocking the main thread, you could introduce a screen to the users with a connection notification to let them know what's happening. While showing a screen with the notification you could check for a connection using the ConnectivityManager Note that checking only a WIFI connection will not guarantee a data service. Network issues, server downtime, authorization, etc. could always occur. Example of usage: private boolean isNetworkAvailable() { ConnectivityManager connectivityManager = (ConnectivityManager) getSystemService(Context.CONNECTIVITY_SERVICE); NetworkInfo activeNetworkInfo = connectivityManager.getActiveNetworkInfo(); return activeNetworkInfo != null &amp;&amp; activeNetworkInfo.isConnected(); } Also, don't forget to add the right permission: &lt;uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" /&gt; You can find more about this on the Android Developer website: Determining and Monitoring the Connectivity Status Good luck.

http://stackoverflow.com/comment/34756871
has text: Apply closing brackets for Method Power4 condition in your question
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/22793988
score: 0

http://stackoverflow.com/q/22728846
has comment: http://stackoverflow.com/comment/34639817
tagged with: java
upvote count: 1
tagged with: eclipse
has comment: http://stackoverflow.com/comment/34639819
type: Question
tagged with: android-layout
has body: I'm having a problem when setting two different backgrounds for two different activities , the program crashes after opening the second activity. knowing that I added the two pics to res==> drawable-hdpi only, and the format for both is JPEG and their size is around 200 Kbyte. this is the main activity java file ================================================= package com.example.ewrwer; import com.example.ewrwer.Main1Activity; import com.example.ewrwer.R; import android.os.Bundle; import android.app.Activity; import android.content.Intent; import android.view.Menu; import android.view.MenuItem; public class MainActivity extends Activity { @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; } public boolean onOptionsItemSelected(MenuItem item) { switch (item.getItemId()) { default: // this.closeOptionsMenu(); Intent InfoIntent= new Intent(this,Main1Activity.class); this.startActivity(InfoIntent); // startActivity(new Intent(this, InfoActivity.class)); // startActivityForResult(new Intent(this, InfoActivity.class), 0); return true; } } } ======================================== this is the main activity xml file &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" android:background="@drawable/info" tools:context=".MainActivity" &gt; &lt;TextView android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="…
has comment: http://stackoverflow.com/comment/34641720
has comment: http://stackoverflow.com/comment/34639792
answer count: 1
downvote count: 0
has title: two different backgrounds for two different activities crashes the app
score: 1
has comment: http://stackoverflow.com/comment/34640558
has comment: http://stackoverflow.com/comment/34641725
favorite count: 0
type: UnansweredQuestion
tagged with: android
has answer: http://stackoverflow.com/a/22730124
tagged with: android-intent

http://stackoverflow.com/a/22666568
has body: Swing gets confused here because it does not realy have a reference to where the columns should be. Best solution in this case would be to create at least one row with all columns, and the weightx defined on these columns. Also, a JEditorPane doesn't work well in a gridBagLayout. You should use a JScrollPane (or something else) and put the JEditorPane in this pane. this.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); this.setPreferredSize(new Dimension(1080, 720)); this.setLayout(new GridBagLayout()); GridBagConstraints constraints; JLabel a = new JLabel(); constraints = new GridBagConstraints(); constraints.fill = GridBagConstraints.BOTH; constraints.gridx = 0; constraints.gridy = 0; constraints.weightx=0.25; constraints.insets = new Insets(4,4,4,4); this.add(a,constraints); JLabel b = new JLabel(); constraints = new GridBagConstraints(); constraints.fill = GridBagConstraints.BOTH; constraints.gridx = 1; constraints.gridy = 0; constraints.weightx=0.25; this.add(b,constraints); JLabel c = new JLabel(); constraints = new GridBagConstraints(); constraints.fill = GridBagConstraints.BOTH; constraints.gridx = 2; constraints.gridy = 0; constraints.weightx=0.5; constraints.insets = new Insets(4,4,4,4); this.add(c,constraints); JLabel d = new JLabel(); constraints = new GridBagConstraints(); constraints.fill = GridBagConstraints.BOTH; constraints.gridx = 3; constraints.gridy = 0; constraints.weightx=0; this.add(d,constraints); JLabel p1 = new JLabel("Project - 1"); constraints = new GridBagConstraints(); constraints.fill = GridBagConstraints.BOTH; constraints.gridx = 0; constraints.gridy = 0; constraints.gridwidth=2; constraints.insets = new Insets(4,4,4,4); this.add(p1,constraints); JLabel p2 = new JLabel("Project - 2"); constraints = new GridBagConstraints(); constraints.fill = GridBagConstraints.BOTH; constraints.gridx = 2; constraints.gridy = 0; constraints.gridwidth=2; constraints.insets = new Insets(4,4,4,4); this.add(p2,constraints); JScrollPane projectScrollPane = n…
type: Answer
score: 2
accepted answer of: http://stackoverflow.com/q/22665272
upvote count: 2
answers question: http://stackoverflow.com/q/22665272
has comment: http://stackoverflow.com/comment/34531042
type: AcceptedAnswer
downvote count: 0

http://stackoverflow.com/a/22683145
has comment: http://stackoverflow.com/comment/34556719
has comment: http://stackoverflow.com/comment/34556792
downvote count: 0
has comment: http://stackoverflow.com/comment/34556668
type: Answer
answers question: http://stackoverflow.com/q/22682979
score: 1
upvote count: 1
has body: Please try android:gravity="center_horizontal"

http://stackoverflow.com/a/22698040
has body: Three for cycles: for(var i:int = 0; i &lt; to_do.length; i++) { for (var k:int = 0; k &lt; to_do[i];k++){ new_array.push(new Array()); for (var j:int = 0; j &lt; another_array.length; j++) { new_array[k].push(another_array[j]); } } } This should get the job done.
answers question: http://stackoverflow.com/q/22696403
has comment: http://stackoverflow.com/comment/34584726
has comment: http://stackoverflow.com/comment/34584851
has comment: http://stackoverflow.com/comment/34584946
score: 0
type: Answer

http://stackoverflow.com/comment/34744692
type: Comment
score: 0
has text: Hm, Not entirely certain. I suppose you could be tricky with something like sockets, but that kind of cross-process communication starts to get tricky with Java.
type: AnswerComment
comment on: http://stackoverflow.com/a/22768048

http://stackoverflow.com/a/22648427
answers question: http://stackoverflow.com/q/22648342
type: Answer
score: 3
downvote count: 0
has body: You should not be using Integer (the object type) here, as it can be null (which you don't need and trip over here). When you dereference a null in Java, you get a NullPointerException. In this case, it is a bit tricky, because automatic unboxing is involved (fancy name for conversion between the primitive types and their object wrappers). What happens under the hood is that Integer result = myfirstinteger/mythirdinteger; is really compiled as Integer result = Integer.valueOf( myfirstinteger.intValue() / mythirdinteger.intValue()); The call to intValue() fails on a null pointer. Just use int (the primitive). public static void main(String[] args) { int myfirstinteger = 1; int mysecondinteger = 2; int mythirdinteger = 0; int result = myfirstinteger/mythirdinteger; // will still fail, you cannot divide by 0 }
upvote count: 3

http://stackoverflow.com/q/22652692
tagged with: selenium-webdriver
upvote count: 2
has title: How to Kill IEDriver exe process running in background (Selenium webdriver)?
has answer: http://stackoverflow.com/a/56534883
type: Question
tagged with: internet-explorer
tagged with: java
has answer: http://stackoverflow.com/a/22652979
answer count: 3
tagged with: taskmanager
score: 2
downvote count: 0
has answer: http://stackoverflow.com/a/22652938
favorite count: 0
has body: I'm using selenium webdriver(for Internet Explorer). What it does it basically opens a webpage in internet explorer and does form submitting. How can I kill internetexplorer.exe running in background Automatically ?
type: UnansweredQuestion

http://stackoverflow.com/q/22735857
score: 1
has title: Java: Binary Tree Node displaying only memory addresses or null
favorite count: 0
tagged with: binary-tree
accepted answer: http://stackoverflow.com/a/22735954
has comment: http://stackoverflow.com/comment/34652126
type: AnsweredQuestion
tagged with: java
has comment: http://stackoverflow.com/comment/34652138
has comment: http://stackoverflow.com/comment/34652401
upvote count: 1
type: Question
has answer: http://stackoverflow.com/a/22735954
has body: I have a node class and am just trying to narrow down an issue when adding elements to my tree. I think my node class is just not properly creating the node to add in the tree. When I print each node, it is returning memory addresses, I believe. I cannot seem to get it to print anything else. Any help in determining if my node class is faulty would be great. Example of what my program prints: ([C@f72003d) ([C@56dacb7) ([C@63662529) ([C@4711d9ba) The TreeNode class: public class TreeNode { char[] data; TreeNode left, right, parent; // used for printing: int column; int row; int center; public TreeNode(char[] data) { this.data = data; left = right = parent = null; } @Override public String toString() { return "(" + data + ")"; } public int return_letter(){ char x = data[0]; int b = Character.getNumericValue(x); return b; } public int findMaxDepth() { int lmax = 0; int rmax = 0; if (left != null) { lmax = left.findMaxDepth(); } if (right != null) { rmax = right.findMaxDepth(); } return 1 + Math.max(lmax, rmax); } }
has comment: http://stackoverflow.com/comment/34652148
answer count: 1
downvote count: 0

http://stackoverflow.com/comment/34535546
comment on: http://stackoverflow.com/a/22670972
score: 0
type: AnswerComment
has text: I only did it through students.size()-2
type: Comment

http://stackoverflow.com/comment/34547038
score: 0
comment on: http://stackoverflow.com/q/22677127
type: Comment
type: QuestionComment
has text: What could I do to make the code not so messy?

http://stackoverflow.com/q/22677153
score: -2
has body: Hey I am trying to verify the password matches the one they entered with the email I have been searching for the web for a few hours and everything else I have tried does not work this is what i have so far: try { Class.forName(driver).newInstance(); Connection conn = (Connection) DriverManager.getConnection (url + dbName, userName, password); PreparedStatement checkUserInfo = (PreparedStatement) conn.prepareStatement ("SELECT password FROM profiles WHERE email = ?"); checkUserInfo.setString(1, emailT); //emailT is email pulled from an editText //checkUserInfo.setString(2, pass1); //Statement state = (Statement) conn.createStatement(); //String querychk = "SELECT * FROM profiles WHERE email = '"+emailT+"'"; //ResultSet rs = state.executeQuery(querychk); ResultSet rs = checkUserInfo.executeQuery(); while (rs.next()){ String pass = rs.getString(2); if (pass.equals(pass1)) { return success; } } conn.close(); } catch (Exception e) { e.printStackTrace(); }
type: AnsweredQuestion
linked to: http://stackoverflow.com/q/549
downvote count: 2
tagged with: mysql
has answer: http://stackoverflow.com/a/22677279
type: Question
has title: How do I verify password entered is the password associated with entered email?
has comment: http://stackoverflow.com/comment/34546576
has comment: http://stackoverflow.com/comment/34546423
has comment: http://stackoverflow.com/comment/34546453
has comment: http://stackoverflow.com/comment/34546403
tagged with: java
upvote count: 0
answer count: 1
accepted answer: http://stackoverflow.com/a/22677279
favorite count: 0
tagged with: android
has comment: http://stackoverflow.com/comment/34546562

http://stackoverflow.com/q/22716428
tagged with: jtree
tagged with: defaultmutabletreenode
has body: Is it possible to remove the dots border for DefaultMutableTreenNode in JTree? For JButton I use: JButton btn; btn.setFocusPainted(false); But I cannot find an equivalent for DefaultMutableTreenNode.
upvote count: 2
answer count: 1
favorite count: 0
has title: Java remove focusPainted on DefaultMutableTreenNode in JTree
type: AnsweredQuestion
score: 2
downvote count: 0
has answer: http://stackoverflow.com/a/22717328
tagged with: java
accepted answer: http://stackoverflow.com/a/22717328
tagged with: swing
tagged with: uimanager
type: Question

http://stackoverflow.com/q/22802865
score: 0
answer count: 1
tagged with: jms
type: UnansweredQuestion
tagged with: spring
tagged with: java
type: Question
has title: Missing body in JMS / websocket message
tagged with: stomp
tagged with: websocket
has answer: http://stackoverflow.com/a/23024932
has body: I'm trying to understand why serialized objects are being stripped out when received. Here is the general layout : 1. Produce JMS messages and send to a topic on an external ActiveMQ broker. The code is based off the Spring boot JMS message and can be viewed at http://bit.ly/QECQ21 . In my example, I generate various types of messages (text , POJO, Map) 2. I have 2 JMS consumers that subscribe to this topic. a. One is a java client. This client correctly identifies all the various message types. b. The 2nd client is a javascript client based on websockets + stomp.js . This correctly identifies text messages but not messages that contain POJOs generated by my producer. Here is the sample output from the web client (source at http://bit.ly/Od0noF ) . What am I doing wrong? Something wrong with the the addressing or something else in the code? Something about the way I'm using (or misusing) STOMP? I had to use "tcp://localhost:61616" in the Application.java class to correctly contact the broker. Thanks MESSAGE priority:4 persistent:true subscription:sub-0 expires:0 timestamp:1396418227090 destination:/topic/greetings message-id:ID:blackbox-53461-1396418226684-1:1:2:1:1 content-length:4 ping Body:ping MESSAGE priority:4 persistent:true subscription:sub-0 expires:0 timestamp:1396418227117 destination:/topic/greetings message-id:ID:blackbox-53461-1396418226684-1:1:2:1:2 Body: ======> missing body MESSAGE priority:4 persistent:true subscription:sub-0 expires:0 timestamp:1396418227122 destination:/topic/greetings message-id:ID:blackbox-53461-1396418226684-1:1:2:1:3 Body: ======> missing body MESSAGE priority:4 persistent:true subscription:sub-0 expires:0 timestamp:1396418227125 destination:/topic/greetings message-id:ID:blackbox-53461-1396418226684-1:1:2:1:4 content-length:5 close Body:close

http://stackoverflow.com/a/22757551
answers question: http://stackoverflow.com/q/22757505
downvote count: 0
type: Answer
has body: Use the api JFrame.getFocusOwner() This will return a reference to the component with focus You ca also check.... KeyboardFocusManager.getCurrentKeyboardFocusManager().getFocusOwner() To the modification, just add a FocusListener to your respective Component, and implement the interface to your particular acitons.
upvote count: 1
score: 1

http://stackoverflow.com/a/22668913
type: Answer
has body: One simple approach would be something like: public static String removeLetters(String source, String lettersToRemove) { StringBuilder builder = new StringBuilder(); for (int i = 0; i &lt; source.length(); i++) { if (lettersToRemove.indexOf(source.charAt(i)) == -1) { builder.append(source.charAt(i)); } } return builder.toString(); } Or: public static String removeLetters(String source, String lettersToRemove) { for (int i = 0; i &lt; lettersToRemove.length(); i++) { source = source.replace(lettersToRemove.substring(i, i + 1), ""); } return source; } While the approaches using regular expressions will work in many cases, you'd need a bit more work to make them robust against things like "-" within lettersToRemove. It really depends on your requirements. (As noted in Sabuj's answer, Pattern.quote may well be enough here... but I'd want to validate that for myself with a few weird cases.)
score: 2
downvote count: 0
has comment: http://stackoverflow.com/comment/34532078
answers question: http://stackoverflow.com/q/22668741
upvote count: 2
has comment: http://stackoverflow.com/comment/34532011
has comment: http://stackoverflow.com/comment/34532057

http://stackoverflow.com/a/22703216
has comment: http://stackoverflow.com/comment/34594092
has comment: http://stackoverflow.com/comment/34593977
answers question: http://stackoverflow.com/q/22703165
type: Answer
has comment: http://stackoverflow.com/comment/34594013
score: 3
downvote count: 0
has comment: http://stackoverflow.com/comment/34594065
has body: You're calling the super.paintComponents method inside of your paintComponent override. Yikes. You are also using null layout and shouldn't be. You are setting background color but doing nothing with it. You should instead set the background color on your JPanel object, not in its paintComponent method. i.e., here panel_1.setBackground(Color.orange); // here // !! panel_1.setBounds(484, 12, 202, 346); // you shouldn't need this! contentPane.add(panel_1); Edit You state: Is it enough to simply append a string to the text area, and it will be displayed on the screen automatically? Yes, as long as you take Swing thread rules into consideration.
upvote count: 3

http://stackoverflow.com/comment/34501224
type: QuestionComment
comment on: http://stackoverflow.com/q/22651007
has text: I have posted the HTML above. Please suggest me some solution
score: 0
type: Comment

http://stackoverflow.com/comment/34645636
type: QuestionComment
has text: The stack trace of the exception tells you exactly where it happens. Something is null at this line.
score: 0
comment on: http://stackoverflow.com/q/22732118
type: Comment

http://stackoverflow.com/q/22773968
tagged with: ms-access
favorite count: 0
type: UnansweredQuestion
answer count: 0
tagged with: java
upvote count: 1
type: Question
linked to: http://stackoverflow.com/q/1915166
has body: Class.forName("sun.jdbc.odbc.JdbcOdbcDriver"); Global.database ="jdbc:odbc:Driver={Microsoft Access Driver (*.mdb, *.accdb)};DBQ=C:\\DB\\swift_db_14.accdb;"; Global.conn = DriverManager.getConnection(Global.database, "", ""); Global.s = Global.conn.createStatement(); Global.s.executeUpdate("INSERT INTO swiftRecord(payLine1)VALUES ('') RETURNING recID"); Global.uniNum.setText(Global.rs.getString("recID")); Here within this code im trying to insert a new blank record and get its unique id which is recID, i want to display recID on a form and when the user is done filling up the fields it will then save/update the row of recID. i want to know how i can get the value of the latest row created by the command i created.
has comment: http://stackoverflow.com/comment/34721180
downvote count: 0
has title: How to get the unique ID of a newly inserted row?
tagged with: insert
score: 1

http://stackoverflow.com/a/22742952
answers question: http://stackoverflow.com/q/22742848
type: Answer
accepted answer of: http://stackoverflow.com/q/22742848
has body: Garbage collection is a usual process on Android OS. You don't have to fight it unless you have unreasonable memory allocations / memory leaks.
downvote count: 0
score: 1
has comment: http://stackoverflow.com/comment/34664690
upvote count: 1
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/34664595

http://stackoverflow.com/comment/34536166
comment on: http://stackoverflow.com/q/22671315
has text: I don't know what you mean by "method comprator()" because there's no such thing in `HashSet` either.
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/34644483
score: 0
comment on: http://stackoverflow.com/a/22730388
type: Comment
has text: @RaulGuiu Oh, I thought that was the client, I'll change that. Thanks again
type: AnswerComment

http://stackoverflow.com/comment/34757231
score: 0
type: Comment
has text: @Andrey `Integer` is meant to be the reference type equivalent of `int`. Sure it was a design decision, but by that fact alone it has to be immutable.
type: AnswerComment
comment on: http://stackoverflow.com/a/22793630

http://stackoverflow.com/a/22739286
type: AcceptedAnswer
type: Answer
has body: Change ArrayList&lt;EntityPlayer&gt; EnemyList; to ArrayList&lt;EntityPlayer&gt; EnemyList = new ArrayList&lt;EntityPlayer&gt;();
answers question: http://stackoverflow.com/q/22739196
downvote count: 0
score: 1
accepted answer of: http://stackoverflow.com/q/22739196
upvote count: 1

http://stackoverflow.com/comment/34554511
score: 2
type: QuestionComment
comment on: http://stackoverflow.com/q/22681703
has text: You already mentioned it. Use a callback. GWT communication between client and server is always programming with callbacks. You show a please wait message box, do a server request with the login credentials and install a callback for the login request. Then do nothing. The callback handler then checks, if the login was successfull and then shows the main panel.
type: Comment

http://stackoverflow.com/comment/92753573
type: Comment
comment on: http://stackoverflow.com/a/52919766
type: AnswerComment
score: 0
has text: the op is writing a game so i don't think it would be possible for the JLabel to lose the focus. But can't they get the focus again with `listener.requestFocus();` I myself is checking the documentation now and will update my answer soon with

http://stackoverflow.com/q/22770503
tagged with: zeromq
has title: JZMQ error: no thread available
answer count: 1
downvote count: 0
favorite count: 0
has body: I'm trying to write a simple java application that would run on a server and do some simple stuff. But currently my application is failing on a weird error i cannot seem to find any information on Exception in thread "main" org.zeromq.ZMQException: No thread available(0x9523dfe) Both services run on the same server, but only my application is failing. I have found only minimal documentation for the C zmq framework. Nothing for java. The class where the error occurs: public class TestService extends GenericService { public TestService(String[] args) { init(args); } private void init(String[] args) { int i = 0; serviceId = args[i++]; servicePort = Integer.valueOf(args[i++]); } private void retrieveConfig() { } public void run() { System.out.println("Running"); initZmq(); // &lt;---- Here retrieveConfig(); for (int i=0; i&lt;120; i++) { System.out.println("Counter = " + i); try { Thread.sleep(1000); } catch (InterruptedException e) { } } closeZmq(); System.out.println("Done!"); } @Override protected void requestInit() { zmqClient.send(getInitMessage().getBytes(),0); byte[] reply = zmqClient.recv(0); System.out.println("Config - " + (new String(reply))); } } Abstract generic service class. public abstract class GenericService { protected Context zmqContext; protected Socket zmqClient; protected int port; protected int servicePort; protected String serviceId; protected static final String addressNoPort = "tcp://127.0.0.1:"; public GenericService() {} protected void initZmq() { zmqContext = ZMQ.context(0); zmqClient = zmqContext.socket(ZMQ.REQ); zmqClient.connect(getAddress()); } protected void closeZmq() { zmqClient.close(); zmqContext.term(); } protected abstract void requestInit(); public String getAddress() { return addressNoPort+servicePort; } public String getInitMessage() { return serviceId+":init"; } } how i run my application. public class TestServiceRunner { public static void main(String[] args) { for (String string : args) { System.out.println("Params = "+stri…
type: UnansweredQuestion
tagged with: jzmq
score: 1
tagged with: java
upvote count: 1
has answer: http://stackoverflow.com/a/22770941
type: Question

http://stackoverflow.com/comment/34824755
has text: That doesn't really answer my question. One thing supporting it doesn't mean that it's a standard way of doing things...
type: Comment
comment on: http://stackoverflow.com/q/22766493
type: QuestionComment
score: 0

http://stackoverflow.com/q/22720995
has title: Adding entries to an Arraylist
type: Question
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/34629071
tagged with: java
score: -1
has body: I am trying to compile the code that adds Address book entries into my array. I have most of the driver program, which takes the input of first and last name, and then adds them, and also searches for certain values. My problem is the code that adds a new entry- I am trying to add multiple strings as one entry in an address book, and then call addEntry, but I am getting the following errors... C:\Users\Scherpich\Desktop\Jim School\CS 219 Programming Fundamentals\Programs\ScherpichJamesTest2.java:17: error: constructor SJAddressBook in class SJAddressBook cannot be applied to given types; aBook.add(new SJAddressBook()); ^ required: String,String found: no arguments reason: actual and formal argument lists differ in length C:\Users\Scherpich\Desktop\Jim School\CS 219 Programming Fundamentals\Programs\ScherpichJamesTest2.java:18: error: cannot find symbol aBook.get(count).addEntry(); ^ symbol: method addEntry() location: class SJAddressBook C:\Users\Scherpich\Desktop\Jim School\CS 219 Programming Fundamentals\Programs\ScherpichJamesTest2.java:24: error: cannot find symbol int foundIndex = abook.search(SJ); ^ symbol: variable SJ location: class ScherpichJamesTest2 C:\Users\Scherpich\Desktop\Jim School\CS 219 Programming Fundamentals\Programs\ScherpichJamesTest2.java:24: error: cannot find symbol int foundIndex = abook.search(SJ); ^ symbol: variable abook location: class ScherpichJamesTest2 C:\Users\Scherpich\Desktop\Jim School\CS 219 Programming Fundamentals\Programs\ScherpichJamesTest2.java:30: error: cannot find symbol SJ.get(foundIndex).display(); ^ symbol: variable SJ location: class ScherpichJamesTest2 .\SJAddressBook.java:27: error: missing method body, or declare abstract public static int search(ArrayListaBook); ^ .\SJAddressBook.java:34: error: cannot find symbol int choice=integer.parseInt(entry.nextLine()); ^ symbol: variable integer location: class SJAddressBook .\SJAddressBook.java:38: error: cannot find symbol for(SJAddressBook Address: aBook) ^ symbol: va…
tagged with: search
has answer: http://stackoverflow.com/a/22722157
accepted answer: http://stackoverflow.com/a/22722157
tagged with: arrays
answer count: 1
favorite count: 0
tagged with: arraylist
downvote count: 1
has comment: http://stackoverflow.com/comment/34626010
upvote count: 0

http://stackoverflow.com/a/22794289
has comment: http://stackoverflow.com/comment/34760282
type: AcceptedAnswer
type: Answer
answers question: http://stackoverflow.com/q/22792711
has body: You aren't restricting where muscleExercise and muscleGroup are the same group id... see the amended WHERE predicate below. "SELECT muscleGroup.group_id, muscleGroup.groupName, muscleExercise.exerciseName FROM muscleGroup,muscleExercise WHERE muscleGroup.groupName =\"" + group + "\" and muscleExercise.group_id = muscleGroup.group_id"; OR... (preferred) SELECT muscleGroup.group_id, muscleGroup.groupName, muscleExercise.exerciseName FROM muscleGroup JOIN muscleExercise USING(group_id) WHERE muscleGroup.groupName =\"" + group + "\" actually you should use prepared statements and parametrize group instead of just adding it in the query. How does Java&#39;s PreparedStatement work?
score: 0
accepted answer of: http://stackoverflow.com/q/22792711

http://stackoverflow.com/comment/34594655
score: 0
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/22703656
has text: But, still, synchronized flushes writes to the main memory at the the end of setter. "o" should become visible to other threads. Or not?

http://stackoverflow.com/q/22703409
has comment: http://stackoverflow.com/comment/34594318
favorite count: 0
downvote count: 1
has comment: http://stackoverflow.com/comment/34594777
has comment: http://stackoverflow.com/comment/34594327
has comment: http://stackoverflow.com/comment/34594519
has comment: http://stackoverflow.com/comment/34594227
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/34594487
linked to: http://stackoverflow.com/q/3796841
score: 1
tagged with: java
type: Question
upvote count: 2
has answer: http://stackoverflow.com/a/22704074
has title: java code to get the difference between two timestamp stored in arraylist
has comment: http://stackoverflow.com/comment/34594689
answer count: 1
has body: String sql = "SELECT endtime FROM user_req"; ResultSet rs = stmt.executeQuery(sql); ArrayList&lt;Timestamp&gt; list1= new ArrayList&lt;Timestamp&gt;(); while (rs.next()) { list1.add(rs.getTimestamp("endtime")); } System.out.println("\n the requested time is : "); System.out.println(list1); this gives me the result:- the requested time is : [2013-12-12 07:00:00.0, 2013-12-12 05:00:00.0] this is the code which I've used that retrieves the timestamp data from MySQL and stores it in an aaraylist. but how to compare those dates and get the difference in terms of days and hours. please help me and thanks in advance.

http://stackoverflow.com/a/22724524
score: 2
downvote count: 0
has body: There are a couple of solutions here. Note, though, that the socket solution needs to be modified if you are worried that something else on the same machine could be using the same port.
upvote count: 2
type: Answer
answers question: http://stackoverflow.com/q/22724353

http://stackoverflow.com/comment/35097749
comment on: http://stackoverflow.com/a/22983166
type: AnswerComment
has text: Thanks Jens , looks like this might work , let me give it a try , bbl :)
score: 0
type: Comment

http://stackoverflow.com/q/22672619
has title: Instantiate a generic Number class in Java
tagged with: java
has answer: http://stackoverflow.com/a/22672793
has comment: http://stackoverflow.com/comment/34545638
type: Question
has comment: http://stackoverflow.com/comment/34538384
score: 0
answer count: 1
tagged with: generics
type: UnansweredQuestion
has body: I am trying to create an Array-like object that can store Number types. I want to initialize each value in Object[] array to 0. If I knew that the NegativeArray was storing Integers, then I could do new Integer(0). Unfortunately, when dealing with the generic type E, I don't know how to create a new Number with value 0. This is my current implementation: package com.gly.sfs.util; public class NegativeArray &lt;E extends Number&gt; { private int firstIndex; private int lastIndex; private Object[] array; public NegativeArray(int firstIndex, int lastIndex) { this.firstIndex = firstIndex; this.lastIndex = lastIndex; boolean isValid = lastIndex &gt; firstIndex; if (!isValid) { throw new IllegalArgumentException( "lastIndex &gt; firstIndex violated!"); } array = new Object[size()]; } public void set(int index, E e) { checkIndexValidity(index); array[getIndex(index)] = e; } public E get(int index) { checkIndexValidity(index); @SuppressWarnings("unchecked") E e = (E) array[getIndex(index)]; return e; } public int size() { return lastIndex - firstIndex; } private int getIndex(int index) { return index - firstIndex; } private void checkIndexValidity(int index) { boolean isValid = (index &gt;= firstIndex) &amp; (index &lt; lastIndex); if (!isValid) { throw new ArrayIndexOutOfBoundsException(); } } }
has comment: http://stackoverflow.com/comment/34547739
has comment: http://stackoverflow.com/comment/34569860

http://stackoverflow.com/q/22736350
answer count: 1
tagged with: string
has comment: http://stackoverflow.com/comment/34653041
favorite count: 0
has body: I'm newbie to java and I'm stuck on a function. I have a string : "test lala idea&lt;I want potatoes&lt;". and I want to math the text before the "&lt;". example : Str[0] = test lala idea Str[1] = I want potatoes I try to use RegEx but everythig has not worked. So if anyone has an idea? Sorry for my english skills. Thanks.
tagged with: regex
upvote count: 2
tagged with: match
downvote count: 1
type: AnsweredQuestion
has title: Match string before special char
score: 1
tagged with: java
has answer: http://stackoverflow.com/a/22736414
accepted answer: http://stackoverflow.com/a/22736414
type: Question
has comment: http://stackoverflow.com/comment/34652932
tagged with: char

http://stackoverflow.com/comment/34709056
has text: What's the type of `id`?
score: 0
comment on: http://stackoverflow.com/q/22767309
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/34709319
score: 1
comment on: http://stackoverflow.com/a/22755044
type: AnswerComment
type: Comment
has text: @Ali: The branch misprediction penalty is something like 14 cycles, while both `cmov` and predicted branch can execute in a single cycle (they both may be free if there are free units at a proper time; this is where the branch has a better chance.). The results you linked ate interesting, but my above link demonstrates that the misprediction penaly is pretty high. I'll edit my post when I get time to think hard about the case you linked.

http://stackoverflow.com/comment/34685812
type: Comment
score: 0
type: QuestionComment
comment on: http://stackoverflow.com/q/22752834
has text: Since this was inexplicably closed while I was writing my solution, I have had to post my solution at http://pastebin.com/U15Bw2CN - I tried to produce a more object-oriented answer than the other solution here, for those who like that sort of thing.

http://stackoverflow.com/comment/34587966
type: Comment
comment on: http://stackoverflow.com/a/22695943
has text: I'd say that frameworks can be more or less RESTfully-oriented, and I'm pretty sure that's precisely what's being addressed in the question. That said, I'm not convinced the question is on-topic on SO.
type: AnswerComment
score: 0

http://stackoverflow.com/a/22697304
score: 2
upvote count: 2
downvote count: 0
answers question: http://stackoverflow.com/q/22695718
has body: Looked at your file you gave from GitHub.. LivingEntity is an interface and so you would have to implement it into another class because it's methods aren't allowed to be defined. Just follow Emerson's overridden method, as it's correct. Put your custom code under the call to super.setCustomName(name);.
type: Answer

http://stackoverflow.com/a/22742350
upvote count: 2
has body: Check out the Neo4j JDBC driver. That should work best for your purposes: https://github.com/neo4j-contrib/neo4j-jdbc/tree/2.0 If you've worked with a JDBC driver before it should be as easy. Just make sure to use parametrized PreparedStatement for your queries.
type: Answer
score: 2
downvote count: 0
answers question: http://stackoverflow.com/q/22740759

http://stackoverflow.com/a/22801331
type: Answer
answers question: http://stackoverflow.com/q/22801211
downvote count: 0
score: 1
has body: You should use a BufferedInputStream to increase the speed of reading. Alternatively you can use the Apache Commons IOUtils read method
upvote count: 1

http://stackoverflow.com/comment/34561159
score: 0
type: Comment
has text: use dropzone if u want..
type: QuestionComment
comment on: http://stackoverflow.com/q/22685742

http://stackoverflow.com/comment/75750292
score: 0
type: AnswerComment
has text: nope. You can give the path of the users.xml via pathname of the context.xml
type: Comment
comment on: http://stackoverflow.com/a/42480966

http://stackoverflow.com/q/22754258
has answer: http://stackoverflow.com/a/23509032
possible better answer: http://stackoverflow.com/a/22780780
has answer: http://stackoverflow.com/a/22780780
upvote count: 1
accepted answer: http://stackoverflow.com/a/23509032
type: AnsweredQuestion
score: 1
tagged with: java
tagged with: itext
has title: Downloaded PDF in iPad has name of the Servlet. How can this be fixed
tagged with: servlets
type: Question
answer count: 2
has body: I am generating PDF from HTML, everything works fine in all the browsers but in iPad when we download the PDF, it saves with the name of the Servlet. my response headers are: response.setHeader("Cache-Control","private"); response.setContentType("application/pdf"); response.addHeader("Content-Disposition", "attachment; filename=\"" +docTitle+".pdf" + "\""); Please let me know if I am missing something.
downvote count: 0
favorite count: 0

http://stackoverflow.com/comment/34940892
type: Comment
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/22814174
has text: I'm not sure why you would need a combiner in sequential streams either. Oracle should definitively be a bit more clear on this topic in their JavaDocs.

http://stackoverflow.com/comment/34615304
type: QuestionComment
comment on: http://stackoverflow.com/q/22714896
type: Comment
has text: In Swing dialog, when you pass a frame, the dialog will take the passed frame as parent and will reside upon the passed frame. In that case you can access all other applications. JDialog is default modal. When you setModal(false), then the dialog will not reside upon the parent frame, you can access all application(including parent frame) and the dialog floats. Remove setModal(false) and try
score: 0

http://stackoverflow.com/a/22744215
type: Answer
has comment: http://stackoverflow.com/comment/34670389
answers question: http://stackoverflow.com/q/22744197
score: 5
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/22744197
downvote count: 0
has body: That warning would come when you invoke the getEdges() method on raw type Graph. When that is the case, all the generic types are replaced with their erasure. So, for Graph raw type, the method signature becomes like: public ArrayList getEdges(); Solution is to use parameterized type or wildcard types.
upvote count: 5

http://stackoverflow.com/comment/34609632
has text: possible duplicate of [Java: How to detect (and change?) encoding of System.console?](http://stackoverflow.com/questions/2415597/java-how-to-detect-and-change-encoding-of-system-console)
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/22712131
score: 0

http://stackoverflow.com/comment/34768481
has text: there's a typo on the pastebin class. There's 2 bitmapfortrails, have you seen? delete the private Bitmap mTransparentBitmapForTrails . Maybe that's the problem!
comment on: http://stackoverflow.com/a/22798758
type: AnswerComment
score: 0
type: Comment

http://stackoverflow.com/q/22716160
downvote count: 0
score: 1
linked to: http://stackoverflow.com/q/22735446
has body: I have 2 class one for io/reading file and other one for the GUI, in the past few days I was working on the class of io/reading and I was using simple technique for getting the file from hard disk by writing the file name only as string note: look at the code, but now after I finished the io/reading code I need to use more professional way by adding JFileChooser in the Gui class and couple them and here is the difficulty can some one tell me how? The Jfilechooser code inside the constrictor in the GUI class this only going to open the JFileChooser and select the file and save the file to the String srtPath. Action openAction = new AbstractAction("Open Subtitle", openIcon) { @Override public void actionPerformed(ActionEvent e) { ourFileSelector.setFileSelectionMode(JFileChooser.FILES_AND_DIRECTORIES); ourFileSelector.showSaveDialog(null); ourSrtFile = ourFileSelector.getSelectedFile(); srtPath = ourSrtFile.getAbsolutePath(); } }; all the class of reading file package AnimeAid; import java.io.*; import java.nio.ByteBuffer; import java.nio.charset.Charset; import java.nio.file.Files; import java.nio.file.Path; import java.nio.file.Paths; import java.util.ArrayList; import java.util.regex.Matcher; import java.util.regex.Pattern; public class ReadFile { public static ArrayList<String> getFileStartingTime(String file){ ArrayList<String> Lines = new ArrayList<String>(); //String file = "tra.srt"; BufferedReader br = null; try { br = new BufferedReader(new FileReader(file)); String line; while((line = br.readLine()) != null) { if (line.indexOf(':') != -1 && line.indexOf(',') != -1 && line.indexOf('0') != -1) { Lines.add(line.substring(0, 12)); } } }catch(IOException ex){ System.err.println(ex); } return Lines; } public static ArrayList<String> getFileEndingTime(String file){ ArrayList<String> Lines = new ArrayList<String>(); //String file = "tra.srt"; BufferedReader br = null; try { br = new BufferedReader(new FileReader(file)); String line; while((line = br.readLine()) != …
favorite count: 0
type: Question
accepted answer: http://stackoverflow.com/a/22721280
has comment: http://stackoverflow.com/comment/34617304
has comment: http://stackoverflow.com/comment/34619807
has comment: http://stackoverflow.com/comment/34651498
upvote count: 1
tagged with: swing
has title: Selecting file using JFileChooser from other class
answer count: 1
has comment: http://stackoverflow.com/comment/34650607
tagged with: java
has comment: http://stackoverflow.com/comment/34617023
tagged with: jfilechooser
has answer: http://stackoverflow.com/a/22721280
type: AnsweredQuestion
tagged with: user-interface

http://stackoverflow.com/q/22788599
tagged with: java
linked to: http://stackoverflow.com/q/22790094
tagged with: jaxb
type: Question
score: 2
downvote count: 0
answer count: 1
tagged with: moxy
tagged with: http://stackoverflow.com/tag/xml
favorite count: 0
upvote count: 2
type: UnansweredQuestion
has body: I'm trying to map the following class with xml binding file (jaxb-moxy): public class A{ private String name; private B b; ..... } public class B{ private String surname; } In the binding file I have: .... &lt;java-type name="A" xml-accessor-type="NONE"&gt; &lt;java-attributes&gt; &lt;xml-element java-attribute="b$surname" name="surname"/&gt; &lt;xml-element java-attribute="name" name="name"/&gt; &lt;/java-attributes&gt; &lt;/java-type&gt; .... Unfortunately, the xml generated has always surname field empty (and I log this error message: Ignoring attribute [b$surname] on class [A] as no Property was generated for it). Could you help me to undestand how to map member attributes? Thanks in advance.
has title: moxy jaxb: mapping member attribute
has answer: http://stackoverflow.com/a/22860058

http://stackoverflow.com/a/22753250
type: Answer
answers question: http://stackoverflow.com/q/22753034
score: 0
has comment: http://stackoverflow.com/comment/34683451
has body: I would guess that your delays are too short to see any significant mixing. You pass in 20, as if it's 20 seconds, but it's only 20 milliseconds of sleep. Pass in 20,000 and see if you get the behavior you expect.

http://stackoverflow.com/a/22806200
type: Answer
answers question: http://stackoverflow.com/q/22805989
score: 0
has body: To convert your 24-hour time to minutes you need to determine hours and minutes: int hours = time / 100; int minutes = time % 100; And then calculate minutes since midnight: int minutesSinceMidnight = (hours * 60) + minutes; You can subtract the minutesSinceMidnight for both times to arrive at the time difference in minutes.

http://stackoverflow.com/a/22744597
score: 1
downvote count: 0
has comment: http://stackoverflow.com/comment/34667656
type: Answer
answers question: http://stackoverflow.com/q/22744584
has comment: http://stackoverflow.com/comment/34667576
upvote count: 1
has body: For example, when I work on excel, sometimes I like to save different versions of excel workbooks so that I can roll back if there is a problem. Learn to use a good source control (version control) system. That's a much cleaner solution than just keeping lots of different copies around. You should still be able to compare different versions easily - and you can experiment on different branches, etc. It'll also make it much easier to share your code with others, should you wish to. Additionally, it's not clear whether you're currently just a hobbyist or not, but if you're intending to code professionally you'll definitely need to get used to source control systems. (Every software company worth their salt uses source control.) You might want to look at: Git (you might want to start at GitHub) Mercurial Subversion (All of these are free, and have Eclipse plug-ins available.)

dialog
tag name: dialog
type: Tag
tags question: http://stackoverflow.com/q/22716249
tags question: http://stackoverflow.com/q/22697227
tags question: http://stackoverflow.com/q/22730170
tags question: http://stackoverflow.com/q/22791821
tags question: http://stackoverflow.com/q/22796419

http://stackoverflow.com/comment/34584847
comment on: http://stackoverflow.com/q/22698310
type: Comment
type: QuestionComment
has text: here is what you need http://ideone.com/KXmybg
score: 1

http://stackoverflow.com/a/22789270
answers question: http://stackoverflow.com/q/22789196
has body: Have a look to Websocket or server side event. You can also implement your own mechanism. Create an URL endpoint where javascript clients connect regulary to check for updates. The idea is to have a service exposing updates to clients each time a data is updated in the database.
downvote count: 0
type: Answer
has comment: http://stackoverflow.com/comment/34895339
score: 1
upvote count: 1

http://stackoverflow.com/a/22743667
has comment: http://stackoverflow.com/comment/34666799
score: 0
has comment: http://stackoverflow.com/comment/34670178
has comment: http://stackoverflow.com/comment/34674058
has comment: http://stackoverflow.com/comment/34665961
type: Answer
answers question: http://stackoverflow.com/q/22743642
has body: Change the LazyAdapter() constructor from this... public LazyAdapter(Activity a, String[] d){} to this... public LazyAdapter(Context context, String[] d){} Then pass the Context object through the ImageLoader() constructor as follows... Context mContext; public LazyAdapter(Context context, String[] d) { mContext = context; data=d; inflater = (LayoutInflater)mContext .getSystemService(Context.LAYOUT_INFLATER_SERVICE); imageLoader=new ImageLoader(mContext); }
has comment: http://stackoverflow.com/comment/34670387
has comment: http://stackoverflow.com/comment/34665869

http://stackoverflow.com/comment/34589824
type: Comment
type: QuestionComment
score: 1
has text: Perhaps [this](http://wiki.fasterxml.com/JacksonPolymorphicDeserialization) will help.
comment on: http://stackoverflow.com/q/22701053

http://stackoverflow.com/comment/34696737
score: 0
type: Comment
comment on: http://stackoverflow.com/a/22760482
has text: I am using both of these layouts along with layout:margin. Is this ok?
type: AnswerComment

http://stackoverflow.com/comment/34742458
score: 0
type: Comment
has text: didnt help. please see my updte
comment on: http://stackoverflow.com/a/22786121
type: AnswerComment

http://stackoverflow.com/comment/34754884
has text: @AndreiVolgin Thank you, the `.setAttribute("disabled", "disabled");` works perfecly fine and all the time. It's fantastic.
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/22790511
score: 0

http://stackoverflow.com/a/22704620
type: Answer
answers question: http://stackoverflow.com/q/22703412
has comment: http://stackoverflow.com/comment/52566421
has comment: http://stackoverflow.com/comment/87853066
has comment: http://stackoverflow.com/comment/48585660
score: 401
has comment: http://stackoverflow.com/comment/63359873
upvote count: 403
has comment: http://stackoverflow.com/comment/111877294
has comment: http://stackoverflow.com/comment/53386555
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/97209862
has comment: http://stackoverflow.com/comment/91346150
has body: In IntelliJ IDEA: In File Menu → Project Structure → Project, change Project Language Level to 8.0 - Lambdas, type annotations etc. For Android 3.0+ Go File → Project Structure → Module → app and In Properties Tab set Source Compatibility and Target Compatibility to 1.8 (Java 8) Screenshot:
has comment: http://stackoverflow.com/comment/57161733
has comment: http://stackoverflow.com/comment/61952013
has comment: http://stackoverflow.com/comment/54786650
downvote count: 2
accepted answer of: http://stackoverflow.com/q/22703412

http://stackoverflow.com/comment/34650613
type: Comment
comment on: http://stackoverflow.com/a/22711767
has text: I revised my answer ;)
score: 0
type: AnswerComment

http://stackoverflow.com/comment/34707719
type: Comment
type: QuestionComment
has text: What about the fps? Does that change?
comment on: http://stackoverflow.com/q/22750877
score: 0

http://stackoverflow.com/comment/34632558
has text: You don't want to use singleton, but you want a singleton. How about you say why you don't want to use singleton, and what you mean by that?
comment on: http://stackoverflow.com/q/22724547
score: 6
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/69704614
score: 0
type: Comment
type: QuestionComment
has text: http://software.muzychenko.net/eng/vac.htm does what you want to do - but im afraid it doesnt work under windows 10 because it uses obsolete API - and it seems to be Abandonware ... too sad
comment on: http://stackoverflow.com/q/22723999

http://stackoverflow.com/a/22756300
answers question: http://stackoverflow.com/q/22755523
type: Answer
has comment: http://stackoverflow.com/comment/34688982
has comment: http://stackoverflow.com/comment/34689026
has body: Today is the 31st of March. When you set the month of the Calendar, the current day remains set, but the 31st of June doesn't exist so the Calendar rolls over to the 1st of July.
upvote count: 5
score: 5
has comment: http://stackoverflow.com/comment/34689146
type: AcceptedAnswer
downvote count: 0
accepted answer of: http://stackoverflow.com/q/22755523

http://stackoverflow.com/q/22774602
tagged with: active-directory
score: 0
has body: Below is a sample Kerberos JAAS client I used for trying out Active Directory authentication (based on this Spring Source code http://goo.gl/qRFNKY). I am able to authenticate the user when the name and password contain only English characters. //works client.login("joe@MYDOMAIN.COM", "Password1"); It fails when either field contains international characters. //fails client.login("áá@MYDOMAIN.COM", "çã123"); How to internationalize this code? package aa; import java.io.IOException; import java.util.HashMap; import javax.security.auth.callback.Callback; import javax.security.auth.callback.CallbackHandler; import javax.security.auth.callback.NameCallback; import javax.security.auth.callback.PasswordCallback; import javax.security.auth.callback.UnsupportedCallbackException; import javax.security.auth.login.AppConfigurationEntry; import javax.security.auth.login.Configuration; import javax.security.auth.login.LoginContext; import javax.security.auth.login.LoginException; public class SampleKerberosClient { public static void main(String[] args) throws LoginException { SampleKerberosClient client = new SampleKerberosClient(); //works client.login("joe@MYDOMAIN.COM", "Password1"); //fails client.login("áá@MYDOMAIN.COM", "çã123"); } private boolean debug = true; private String krbConfLocation = "/Users/aa/java/jaas/src/aa/krb5.conf"; public SampleKerberosClient() { System.setProperty("java.security.krb5.conf", krbConfLocation); System.setProperty("sun.security.krb5.debug", "true"); } public String login(String username, String password) throws LoginException { System.out.println("Trying to authenticate " + username + " with Kerberos"); String validatedUsername; LoginContext loginContext = new LoginContext("", null, new KerberosClientCallbackHandler(username, password), new LoginConfig(this.debug)); loginContext.login(); System.out.println("Kerberos authenticated user: " + loginContext.getSubject()); validatedUsername = loginContext.getSubject().getPrincipals().iterator().n…
tagged with: jaas
answer count: 1
has title: JAAS Kerberos authentication fails for user with international characters
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/22823057
tagged with: java
tagged with: authentication
type: Question
tagged with: kerberos

http://stackoverflow.com/comment/34635707
type: AnswerComment
score: 0
type: Comment
comment on: http://stackoverflow.com/a/22726084
has text: @user3439273 change to `[index++ % 26]` to avoid going out of bounds

http://stackoverflow.com/q/22772550
upvote count: 2
tagged with: hashcode
tagged with: java
answer count: 3
has body: Simple question. I have an object: class User { int id; String username; public User() { } public User(int id, String username) { this.id = id; this.username = username; } @Override public String toString() { return id + " - " + username; } @Override public int hashCode() { int hash = 7; hash = 31 * hash + this.id; return hash; } @Override public boolean equals(Object obj) { if (obj == null) { return false; } if (getClass() != obj.getClass()) { return false; } final User other = (User) obj; return this.id == other.id; } public void setUsername(String username) { this.username = username; } public void setId(int id) { this.id = id; } public String getUsername() { return username; } public int getId() { return id; } } Whose equality is determined based on int id (it is a database id). Netbeans auto-generated this hashCode() method: @Override public int hashCode() { int hash = 7; hash = 31 * hash + this.id; return hash; } The question is: is there any advantage to this over just returning the (already) unique int id ? @Override public int hashCode() { return id; } Collisions are impossible either way. Right?
has title: generating hashcode with already unique integer
has comment: http://stackoverflow.com/comment/34718639
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/22772603
score: 2
has comment: http://stackoverflow.com/comment/34718778
downvote count: 0
tagged with: hash-code-uniqueness
favorite count: 0
has answer: http://stackoverflow.com/a/22772611
has comment: http://stackoverflow.com/comment/34718613
type: Question
has answer: http://stackoverflow.com/a/22772610
has comment: http://stackoverflow.com/comment/34718596

http://stackoverflow.com/a/22697305
has comment: http://stackoverflow.com/comment/34705311
has comment: http://stackoverflow.com/comment/34790351
answers question: http://stackoverflow.com/q/22694436
has comment: http://stackoverflow.com/comment/34701790
has comment: http://stackoverflow.com/comment/34703823
score: 0
has comment: http://stackoverflow.com/comment/34792825
type: Answer
has comment: http://stackoverflow.com/comment/34599666
has body: First you have to do your file a valid xml: <?xml version="1.0"?> 1234566546 AbcdeXYZ-23243423 1030253498 23423423423 1234566546 AbcdeXYZ-154555 1030253498 434343242 1234566546 AbcdeXYZ-4566545 1030253498 2323232323 And then you can start reading your file, just check it out. import java.io.File; import javax.xml.parsers.DocumentBuilder; import javax.xml.parsers.DocumentBuilderFactory; import org.w3c.dom.Document; import org.w3c.dom.Element; import org.w3c.dom.Node; import org.w3c.dom.NodeList; public class ReadXMLFile { public static void main(String argv[]) { try { File fXmlFile = new File("file.xml"); DocumentBuilderFactory dbFactory = DocumentBuilderFactory.newInstance(); DocumentBuilder dBuilder = dbFactory.newDocumentBuilder(); Document doc = dBuilder.parse(fXmlFile); doc.getDocumentElement().normalize(); System.out.println("Root element :" + doc.getDocumentElement().getNodeName()); NodeList nList = doc.getElementsByTagName("parentnode"); for (int temp = 0; temp < nList.getLength(); temp++) { Node nNode = nList.item(temp); System.out.println("Current Element :" + nNode.getNodeName()); if (nNode.getNodeType() == Node.ELEMENT_NODE) { Element eElement = (Element) nNode; System.out.println("Staff id : " + eElement.getElementsByTagName("Child1").item(0).getTextContent()); System.out.println("First Name : " + eElement.getElementsByTagName("Child1").item(0).getTextContent()); System.out.println("Last Name : " + eElement.getElementsByTagName("country").item(0).getTextContent()); System.out.println("Nick Name : " + eElement.getElementsByTagName("state").item(0).getTextContent()); } } } catch (Exception e) { e.printStackTrace(); } } }
has comment: http://stackoverflow.com/comment/34582866

http://stackoverflow.com/a/22794599
has body: for (int x = 0; x &lt; 128; x++) { for (int y = 0; y &lt; 128; y++) { tempMap[x][y] = itemGen(); } } try this I am not sure that &lt; 127 was right i think you wanted &lt; 128 Also tempMap[y][x] = itemGen(); seems counter intuitive, unless otherwise needed perhaps you should do tempMap[x][y] = itemGen(); Right now you are filling a whole column before moving to the next column, where as it seems more intuitive to fill a whole row, before moving on to the next row. Finally it makes sense to move the int y = 0 to inside the for loop like so for (int y = 0; y &lt; 128; y++) as you are recreating y every time x iterates anyways. otherwise you may do it like so int x = 0; int y = 0; for (x = 0; x &lt; 128; x++) { for (y = 0; y &lt; 128; y++) { tempMap[x][y] = itemGen(); } } you can say it does not work, but having run this code int[][] table = new int[128][128]; int x = 0; int y = 0; for (x = 0; x &lt; 128; x++) { for (y = 0; y &lt; 128; y++) { table[x][y] = 1; } } for (x = 0; x &lt; 128; x++) { String line = ""; for (y = 0; y &lt; 128; y++) { line += ", " + table[x][y]; } out.println(line); } I know that it does work.
has comment: http://stackoverflow.com/comment/34804989
downvote count: 0
score: 1
type: Answer
answers question: http://stackoverflow.com/q/22794493
has comment: http://stackoverflow.com/comment/34758206
upvote count: 1

http://stackoverflow.com/comment/34680340
type: Comment
has text: @clcto My issue is that I'm using .contains on the arraylist. It always returns a false because it's checking each entry for an exact match. I want to search for "lane", not "Alex eats at 4231 charlie lane".
comment on: http://stackoverflow.com/q/22751383
score: 0
type: QuestionComment

http://stackoverflow.com/comment/34787519
has text: Can you give me some ideas of writing the step def?
comment on: http://stackoverflow.com/a/22804758
type: Comment
score: 0
type: AnswerComment

http://stackoverflow.com/q/22699789
tagged with: moxy
tagged with: http://stackoverflow.com/tag/xml
favorite count: 0
has title: How to manage several xml format with jaxb/moxy
upvote count: 1
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/22720100
tagged with: java
has comment: http://stackoverflow.com/comment/34587477
tagged with: jaxb
downvote count: 1
has body: I need to perform some calls to a backend not managed by me. The point is that they use different xml format to trasport the data. Even for the same call request and response are different: same data but different root tags. At first I tried to map them with different beans using annotations (moxy jaxb), but the I had to manage to many of them and rhe cost of change was too high. Then I switched to xml file mapping: it seems better then previous choice, but still I have to manage lots of xml files (douzen). Have you got any proposal in order to keep the project light and scalable? Thanks in advance for the help.
type: Question
accepted answer: http://stackoverflow.com/a/22720100
score: 0
has comment: http://stackoverflow.com/comment/34587617
answer count: 1

http://stackoverflow.com/comment/34654812
type: QuestionComment
comment on: http://stackoverflow.com/q/22737319
has text: did it :) please help me :(
score: 0
type: Comment

http://stackoverflow.com/comment/34577655
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/22694489
has text: Do you get any error?

http://stackoverflow.com/q/22713288
answer count: 1
accepted answer: http://stackoverflow.com/a/22713861
tagged with: datetime
has answer: http://stackoverflow.com/a/22713861
type: AnsweredQuestion
tagged with: java
has body: I am trying to find the difference between two dates and display it in the format "0 years 0 months 0 days 0 hours 0 minutes 0 seconds". I have created a method that takes two DateTime objects and return a string representing the difference. Here is the method: public static String getReadableDifference(DateTime start, DateTime end){ int years = Years.yearsBetween(start, end).getYears(); end = end.minusYears(years); int months = Months.monthsBetween(start, end).getMonths(); end = end.minusMonths(months); int days = Days.daysBetween(start, end).getDays(); end = end.minusDays(days); int hours = Hours.hoursBetween(start, end).getHours(); end = end.minusHours(hours); int minutes = Minutes.minutesBetween(start, end).getMinutes(); end = end.minusMinutes(minutes); int seconds = Seconds.secondsBetween(start, end).getSeconds(); StringBuilder returnString = new StringBuilder(); if(years != 0){ returnString.append(years); returnString.append(" years "); } if(months != 0){ returnString.append(months); returnString.append(" months "); } if(days != 0){ returnString.append(days); returnString.append(" days "); } if(hours != 0){ returnString.append(hours); returnString.append(" hours "); } if(minutes != 0){ returnString.append(minutes); returnString.append(" minutes "); } if(seconds != 0){ returnString.append(seconds); returnString.append(" seconds "); } return returnString.toString(); } I then created two DateTime objects and calculated the difference using the method. If I initialize the DateTime objects as so, (startin this case equals 2014-03-28T12:56:38.137+01:00 and end would be read from a file in the full program.) DateTime start = new DateTime(); DateTime end = DateTime.parse("2015-03-28T12:56:35.137+01:00"); the resulting output would be 11 months 31 days -3 seconds, but if I initialized the DateTime objects like so, DateTime now = DateTime.parse(new DateTime().toString()); DateTime end = DateTime.parse("2015-03-28T12:56:35.137+01:00"); the resulting output would be 11 mo…
has comment: http://stackoverflow.com/comment/34611543
type: Question
tagged with: jodatime
has title: Why does Joda-Time-2.3 return incorrect difference?
has comment: http://stackoverflow.com/comment/34611613
tagged with: difference
has comment: http://stackoverflow.com/comment/34612607
tagged with: date
has comment: http://stackoverflow.com/comment/34612426
score: 0

http://stackoverflow.com/comment/34705689
type: Comment
has text: @Byron : good point.....easy to implement and bang on!! :D
comment on: http://stackoverflow.com/q/22764871
score: 0
type: QuestionComment

http://stackoverflow.com/comment/34706098
score: 0
comment on: http://stackoverflow.com/q/22756353
type: QuestionComment
has text: I am using JTable inside javascript tag
type: Comment

avl-tree
tags question: http://stackoverflow.com/q/22674631
type: Tag
tag name: avl-tree

http://stackoverflow.com/comment/34613644
type: QuestionComment
comment on: http://stackoverflow.com/q/22714223
type: Comment
score: 1
has text: Actually pageload and ajax requests technically are user interactions ... so my initial answer should have been "Yes". Now that I am thinking about it for my specific use case crashing to 500 might be the preferable way.

http://stackoverflow.com/comment/34674633
score: 0
type: Comment
type: QuestionComment
has text: haha sorry, yeah I meant notation!!
comment on: http://stackoverflow.com/q/22748315

http://stackoverflow.com/comment/34500512
type: Comment
has text: If possible, can you give an example query to do it, also can you let me know how to make each row seperated by 'OR' using result set or any other method
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/22651102

http://stackoverflow.com/comment/34601178
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/22707501
has text: @Seelenvirtuose I forgot to specify Tomcat version and I added it, version is 7.0.26
score: 0

http://stackoverflow.com/comment/34762626
score: 0
type: Comment
has text: Also, how do I find the current heap size?
comment on: http://stackoverflow.com/a/22779950
type: AnswerComment

http://stackoverflow.com/q/22799553
has comment: http://stackoverflow.com/comment/34767175
has comment: http://stackoverflow.com/comment/34767146
has answer: http://stackoverflow.com/a/22799721
has comment: http://stackoverflow.com/comment/34767359
has body: Here is my code. I am having an issue. It works just fine but when you convert morse code to english, it only prints out the morse code single digit letters. Can someone give me a solution or at least help me understand what is wrong because it is immensely frustrating. Here is the bit of my code that matters An example of the problem is when i put in .- it printed e and t, not a. public class Project1 { public static void main( String [] args ) { System.out.println(); choice(); } public static void choice() { int user_choice = 0; user_choice = Input.getInt("Enter 1 if you want to change English to Morse code, and enter 2 to change Morse code to English"); if(user_choice == 1) { String output = new String(); String inital = new String(); inital = english_to_morse(); for( int k = 0; k &lt; inital.length(); k++) { output += morse(inital.charAt( k )); } System.out.print(output); } if(user_choice == 2) { String output2 = new String(); String inital2 = new String(); inital2 = morse_to_english(); for( int k = 0; k &lt; inital2.length(); k++) { System.out.println("#####"+String.valueOf(inital2.charAt( k ))+"#####"); output2 += english(String.valueOf(inital2.charAt( k ))); } System.out.print(output2); } } public static String english_to_morse() { String user_input = new String(); user_input = Input.getString("Enter a phrase and I'll convert it to Morse Code"); return user_input.toLowerCase(); } public static String morse_to_english() { String user_input = new String(); user_input = Input.getString("Enter a phrase in Morse Code and I'll convert it to English"); return user_input.toLowerCase(); } public static String morse(char letter) { String output = new String(); char[] alphabet_numbers = {'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z', '0', '1', '2', '3', '4', '5', '6', '7', '8', '9', ' ' }; String morse_code[] = { ".-", "-...", "-.-.", "-..", ".", "..-.", "--.", "....", "..", ".---", "-.-"…
has comment: http://stackoverflow.com/comment/34767283
answer count: 3
upvote count: 1
has comment: http://stackoverflow.com/comment/34767115
has comment: http://stackoverflow.com/comment/34767141
favorite count: 0
has comment: http://stackoverflow.com/comment/34767278
has answer: http://stackoverflow.com/a/22799728
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/34767298
has answer: http://stackoverflow.com/a/22799735
downvote count: 0
has comment: http://stackoverflow.com/comment/34767196
score: 1
tagged with: java
has comment: http://stackoverflow.com/comment/34767430
has comment: http://stackoverflow.com/comment/34767120
has title: How can I have my translator detect the morse code as a string, not a char
has comment: http://stackoverflow.com/comment/34767315
has comment: http://stackoverflow.com/comment/34767081
has comment: http://stackoverflow.com/comment/34767136
type: Question

http://stackoverflow.com/comment/34650355
type: Comment
type: QuestionComment
has text: where excatly are you getting the null pointer exception. just upload the exception stack trace also
comment on: http://stackoverflow.com/q/22734703
score: 0

http://stackoverflow.com/a/70271804
answers question: http://stackoverflow.com/q/22779406
upvote count: 1
has body: Conceptually, BigInteger converts an integer into arbitrary-length bit string, and then split the bit string by 4bytes. Then, each 4bytes result is assigned into each element in mag array: BigInteger bi = new BigInteger("1234567890"); byte[] bytes = bi.toByteArray(); String rs = ""; for (byte b : bytes) { String bs1 = Integer.toBinaryString(b & 0xff); String bs2 = String.format("%8s", bs1).replace(' ', '0'); rs = rs + bs2 + " "; } System.out.println(bi.signum()); // 1 System.out.println(bi.bitLength()); // 31 System.out.println(rs); // 01001001 10010110 00000010 11010010 The final int signum is 1 (00000000 00000000 00000000 00000001). The mag[0] in final int[] mag is 1234567890 (01001001 10010110 00000010 11010010). Yes, mag has one element only. Let's represent more bigger integer: BigInteger bi = new BigInteger("12345678901234567890"); byte[] bytes = bi.toByteArray(); String rs = ""; for (byte b : bytes) { String bs1 = Integer.toBinaryString(b & 0xff); String bs2 = String.format("%8s", bs1).replace(' ', '0'); rs = rs + bs2 + " "; } System.out.println(bi.signum()); // 1 System.out.println(bi.bitLength()); // 64 System.out.println(rs); // 00000000 10101011 01010100 10101001 10001100 11101011 00011111 00001010 11010010 The final int signum is 1 (00000000 00000000 00000000 00000001). The mag[0] in final int[] mag is -1420514932 (10101011 01010100 10101001 10001100). The mag[1] in final int[] mag is -350287150 (11101011 00011111 00001010 11010010). When we instantiate an BigInteger instance with a negative integer: BigInteger bi = new BigInteger("-1234567890"); byte[] bytes = bi.toByteArray(); String rs = ""; for (byte b : bytes) { String bs1 = Integer.toBinaryString(b & 0xff); String bs2 = String.format("%8s", bs1).replace(' ', '0'); rs = rs + bs2 + " "; } System.out.println(bi.signum()); // -1 System.out.println(bi.bitLength()); // 31 System.out.println(rs); // 10110110 01101001 11111101 00101110 The final int signum is -1 (11111111 11111111 11111111 11111111). The m…
type: Answer
downvote count: 0
score: 1

http://stackoverflow.com/a/22702086
upvote count: 1
accepted answer of: http://stackoverflow.com/q/22701891
type: AcceptedAnswer
answers question: http://stackoverflow.com/q/22701891
has body: The problem is here: else{ //i == s.length - 1 temp.links[t] = new TrieNode((char) (97+t), true, null); } When you add "teach", it will new a node at char 'h', which replace the node 'h' of teacher. You should write it like this: else{ //i == s.length - 1 if(temp.links[t] == null) { temp.links[t] = new TrieNode((char) (97+t), true, null); } else { // change the leaf tag from false to true } }
type: Answer
downvote count: 0
score: 1

http://stackoverflow.com/q/22688935
tagged with: java
type: Question
has title: Android ListView - Some element has wrong position
tagged with: listview
has comment: http://stackoverflow.com/comment/34567272
score: 0
has comment: http://stackoverflow.com/comment/34567613
has comment: http://stackoverflow.com/comment/34567394
tagged with: android-asynctask
type: UnansweredQuestion
tagged with: android
answer count: 0
has body: I use AsyncTask for parsing JSON and loading in ListView(text, images and other), but some elements after loading are has wrong position or are repeated. How to fix it? For example: 1 2 2 3 4 4 Code AsyncTask: public class AsyncTaskParseJson extends AsyncTask&lt;String, String, String&gt; { final String TAG = "AsyncTaskParseJson.java"; // contacts JSONArray JSONArray dataJsonArr = null; @Override protected void onPreExecute() {} @Override protected String doInBackground(String... arg0) { try { // instantiate our json parser JsonParser jParser = new JsonParser(); // get json string from url JSONObject json = jParser.getJSONFromUrl(URL); // get the array of users dataJsonArr = json.getJSONArray("data"); // loop through all users for (int i = 0; i &lt; dataJsonArr.length(); i++) { JSONObject c = dataJsonArr.getJSONObject(i); // Storing each json item in variable String nickname = c.getString("nickname"); products.add(new Product(nickname)); } } catch (JSONException e) { e.printStackTrace(); } return null; } @Override protected void onPostExecute(String strFromDoInBg) { SetAdapter(); } } And i use simple BaseAdapter, code: public class BoxAdapter extends BaseAdapter { Context ctx; LayoutInflater lInflater; ArrayList&lt;Product&gt; objects; String name, rating, desc, date; long date_time; Integer rate; ImageView imageID; TextView textDesc; BoxAdapter(Context context, ArrayList&lt;Product&gt; products) { ctx = context; objects = products; lInflater = (LayoutInflater) ctx .getSystemService(Context.LAYOUT_INFLATER_SERVICE); } @Override public int getCount() { return objects.size(); } @Override public Object getItem(int position) { return objects.get(position); } @Override public long getItemId(int position) { return position; } @Override public View getView(int position, View convertView, ViewGroup parent) { View view = convertView; if (view == null) { view = lInflater.inflate(R.layout.item, parent, false); } Product p = getProduct(position); textDesc = (TextView) view.find…

http://stackoverflow.com/a/22869311
has body: I'm pretty sure this isn't a common problem, but will answer it anyway. Turning off hardware acceleration did the trick, the maps are working now.
answers question: http://stackoverflow.com/q/22712518
type: Answer
accepted answer of: http://stackoverflow.com/q/22712518
score: 0
type: AcceptedAnswer

http://stackoverflow.com/q/22751454
has title: How to delete a file in Java (Android)
type: Question
tagged with: java
tagged with: android-file
linked to: http://stackoverflow.com/q/1248292
score: 0
answer count: 1
has comment: http://stackoverflow.com/comment/34680332
favorite count: 0
has comment: http://stackoverflow.com/comment/34680389
has comment: http://stackoverflow.com/comment/34687794
tagged with: android
has answer: http://stackoverflow.com/a/22752135
has body: I'm trying to run the following code when an android activity is created, so that two files will be deleted. protected void onCreate(Bundle savedInstanceState) { File file = new File (CSQ1.likes_filename); file.delete(); file = new File (CSQ1.answers_filename); file.delete(); // Rest of onCreate function } Seems simple enough, but it doesn't work. What am I doing wrong?
type: UnansweredQuestion
upvote count: 1
downvote count: 1

http://stackoverflow.com/q/22685245
tagged with: arrays
score: 0
has answer: http://stackoverflow.com/a/22685356
answer count: 3
has comment: http://stackoverflow.com/comment/34560265
has answer: http://stackoverflow.com/a/22685309
possible better answer: http://stackoverflow.com/a/22685298
has answer: http://stackoverflow.com/a/22685298
has body: } I have an input.txt file, i want call that from console. This file includes whitespaces and quotes. I write this code but it give me the error. Where is my fault in this code, guys? Also, if (chars[i]=='"'){ j = i ; i++ ; while (chars[i] != '"'){ i++; } System.out.println(str.substring(j,i)); } because of the error, the print does not work.
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/22685309
tagged with: java
tagged with: loops
has title: java.lang.ArrayIndexOutOfBoundsException error in nested if statements
type: Question

http://stackoverflow.com/a/22775879
type: Answer
answers question: http://stackoverflow.com/q/22771804
has body: Have you compiled your GWT project? Is there nocache.js file generated in your project at correct location? You have to read about Understanding the GWT Compiler. Every thing is defined at above link including project structure, GWT compilation etc. Use rename-to attribute in your module gwt.xml file. Directly from the above link: You may have noticed that one of the generated files is named after your module, followed by a .nocache.js suffix. This is the GWT bootstrap file. Similar to the output subdirectory war/, the name of this file is also controlled by the rename-to attribute in your module XML file.
score: 0

http://stackoverflow.com/comment/34525482
score: 3
comment on: http://stackoverflow.com/q/22665410
type: QuestionComment
type: Comment
has text: Maybe you can "favor composition over inheritance", by that I mean just keep an instance of `Base` in your Singleton class. You should keep in mind that with inheritance, every subclass should be able to be used instead of the superclass and making a singleton subclass does not quite fit that. Maybe think about if you really need a singleton.

http://stackoverflow.com/q/22652953
type: Question
tagged with: clone
tagged with: arraylist
has comment: http://stackoverflow.com/comment/34503613
has title: How to deep clone an ArrayList?
downvote count: 0
has comment: http://stackoverflow.com/comment/34503549
favorite count: 0
duplicate of: http://stackoverflow.com/q/715650
type: UnansweredQuestion
linked to: http://stackoverflow.com/q/715650
has body: How can I clone an arrayList with the following structure: List&lt;empItem&gt; empList = new ArrayList&lt;empItem&gt; (); I need to create a clone in such a way that i need to modify the empItem without affecting the original? Yes the same scenario has an answer already.How to clone ArrayList and also clone its contents? But since the post is Outdated , i am looking for any fresh / latest way ..
answer count: 0
score: 1
tagged with: java
upvote count: 1

trie
tags question: http://stackoverflow.com/q/22701891
tags question: http://stackoverflow.com/q/22769832
tags question: http://stackoverflow.com/q/22659088
type: Tag
tag name: trie

frame
tags question: http://stackoverflow.com/q/22749955
type: Tag
tags question: http://stackoverflow.com/q/22650872
tags question: http://stackoverflow.com/q/22708732
tags question: http://stackoverflow.com/q/22731062
tags question: http://stackoverflow.com/q/22683140
tag name: frame

http://stackoverflow.com/q/22764310
accepted answer: http://stackoverflow.com/a/22764409
score: 10
has answer: http://stackoverflow.com/a/34321248
has answer: http://stackoverflow.com/a/41993425
has title: regex - replace underscore lowercase with uppercase
favorite count: 0
upvote count: 10
tagged with: regex
answer count: 4
type: AnsweredQuestion
possible better answer: http://stackoverflow.com/a/22764578
downvote count: 0
tagged with: java
has answer: http://stackoverflow.com/a/22764578
has body: I've wondering is there a regex pattern that i could use to convert a pattern which is an underscore and a lowercase letter into an uppercase letter. I'm trying to generate fieldnames for a java bean from a SQL statement. At the moment the DB columns are load_id,policy_id,policy_number but i would like to the java field names to be loadId,policyId,policyNumber I've tried with this regex fiddle
type: Question
has answer: http://stackoverflow.com/a/22764409

http://stackoverflow.com/q/22795964
type: UnansweredQuestion
upvote count: 1
type: Question
score: 1
tagged with: java
has comment: http://stackoverflow.com/comment/34810339
tagged with: http://stackoverflow.com/tag/c
has comment: http://stackoverflow.com/comment/34831411
downvote count: 0
has comment: http://stackoverflow.com/comment/34770888
tagged with: ioctl
favorite count: 0
tagged with: jna
has body: I am using JNA library to call native C on a BeagleBone for communication to the I2C bus. Communication to I2C bus requires low level file actions such as open, ioctl, close, read, and write. I am able to open the bus file no problem but I cannot get ioctl to work. If I could get this working I believe I would have I2C function working on either BeagleBone Black or Raspberry Pi. Here is my code import java.util.Arrays; import java.util.List; import com.sun.jna.*; public class Main { static Linux_C_lib_DirectMapping libC = new Linux_C_lib_DirectMapping(); public static int O_RDWR = 0x00000002; public static void main(String[] args) { new Main(); } public Main(){ System.setProperty("jna.library.path","/usr/lib/cgi-bin/jna"); //Open I2C Bus 1 file String fileName = "/dev/i2c-1"; int file = libC.open(fileName, O_RDWR); if(file&lt;0){ System.out.println("Error opening file"); return; }else{ System.out.println("File open for reading and writing"); } //Print out returned value from file open System.out.println(file); //initiate connection to chip. I2C chip I am using mounts on 0x21 int[] address = {33}; int i2c_slave = 1795; //This is what fails. I always get -1 back. int iocntl = libC.ioctl(file, i2c_slave, address); //Print returned value after ioctl action System.out.println("fcntl = "+iocntl); if(iocntl&lt;0){ System.out.println("error on libC.ioctl"); libC.close(file); return; }else{ System.out.println("ioctl complete"); } //Initialize communication to chip byte[] buf = {0,0}; if(libC.write(file, buf, 2) != 2){ System.out.println("error writing"); libC.close(file); return; }else{ System.out.println("I2C chip initialized"); } while(true){ if(turnOnAllRelays(file)){ try { Thread.sleep(1000); turnOffAllRelays(file); Thread.sleep(1000); } catch (InterruptedException e) { // TODO Auto-generated catch block e.printStackTrace(); } } } } public boolean turnOnAllRelays(int file){ byte[] buffer = {0xA,0xF}; if(libC.write(file, buffer, 2) != 2){ System.out.println("all relays on…
has title: Java JNA for communication with I2C on embedded Ubuntu(BeagleBone Black)
has comment: http://stackoverflow.com/comment/34842150
tagged with: beagleboneblack
has comment: http://stackoverflow.com/comment/34793639
answer count: 0

http://stackoverflow.com/q/22684264
has answer: http://stackoverflow.com/a/22684374
has answer: http://stackoverflow.com/a/22684919
has answer: http://stackoverflow.com/a/55722326
tagged with: java
has comment: http://stackoverflow.com/comment/48811534
score: 4
type: Question
upvote count: 4
tagged with: javaparser
has answer: http://stackoverflow.com/a/30359920
downvote count: 0
answer count: 7
favorite count: 0
linked to: http://stackoverflow.com/q/7526817
has body: I have a class like below. public class Login { private Keyword browser; private String page; } Keyword is a class in different package. I want to get the fully qualified name of the class Keyword while parsing the Login class using javaparser.
has answer: http://stackoverflow.com/a/22684390
has comment: http://stackoverflow.com/comment/34559084
has title: how get the fully qualified name of the java class
has answer: http://stackoverflow.com/a/57002990
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/22684583

http://stackoverflow.com/q/22804909
has comment: http://stackoverflow.com/comment/34776442
type: Question
has body: I am working with a multi-module maven project (~100) modules, modules within modules etc... From certain point it has become unbelievably memory hungry when celan installing the project, no test skipping just mvn clean install So without 3GB allocated to permgen - it cannot complete those goals successfully which is insane by my POV because whole project with compiled source presented in standard target directory + metadata doesn't weigh more than 1GB ~980MB. I have some experience of profiling heap memory and its dumps but I never have dealt with profiling PermGen and Maven plus its plugins so after googling for a while all I ever found concerning maven 3 and java.lang.OutOfMemoryError: PermGen space which occurs is to increase PermGen space but never have I found how to try and solve the problem - Maybe some MAVEN plugin, maybe malformed pom structure miss configuration etc... I would really like to hear out suggestions concerning my problem and the action option that are available in this situation. Thank you
has comment: http://stackoverflow.com/comment/34777750
score: 0
has comment: http://stackoverflow.com/comment/34778303
has title: Java Maven 3.0.4 Obscene memory consumptions
has comment: http://stackoverflow.com/comment/34776451
has comment: http://stackoverflow.com/comment/34777461
has comment: http://stackoverflow.com/comment/34777340
has comment: http://stackoverflow.com/comment/34777752
answer count: 0
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/34776531
tagged with: maven
has comment: http://stackoverflow.com/comment/34776449
has comment: http://stackoverflow.com/comment/34777846
has comment: http://stackoverflow.com/comment/34776672
tagged with: java

http://stackoverflow.com/q/22737931
has comment: http://stackoverflow.com/comment/34658690
has body: This is my code so far: public static void init() { Canvas background = new Canvas(); Canvas mapWindow = new Canvas(); Frame window = new Frame(); background.setSize(500,700); mapWindow.setSize(500,500); background.setBackground(Color.darkGray); mapWindow.setBackground(Color.black); background.setForeground(Color.white); window.add(mapWindow); window.add(background); window.setLayout(new FlowLayout()); window.setSize(500,700); //mapWindow.translate(0,100); window.setVisible(true); } The code that is commented out is the one that I'm having trouble with (I know I'm using the wrong method. I haven't done much with graphics so I'm experimenting.) I'm trying to move the mapWindow canvas so that it starts 100 pixels down instead of at (0,0) on the frame. Is there a way to do this?
tagged with: canvas
downvote count: 0
favorite count: 0
has title: How to change the position of a canvas (not in Android)?
has comment: http://stackoverflow.com/comment/34658343
answer count: 0
has comment: http://stackoverflow.com/comment/34656494
tagged with: translate
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/34657572
upvote count: 1
has comment: http://stackoverflow.com/comment/34656487
type: Question
tagged with: graphics
score: 1
tagged with: java

http://stackoverflow.com/comment/34734833
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/22729239
type: Comment
has text: hey guys, it's ok I got the error ! It's is just a small one... Thanks for helping

http://stackoverflow.com/comment/34598120
type: Comment
comment on: http://stackoverflow.com/a/22705434
has text: @TruePS, your sample looked like you'd know, if not I think you'll need to expect and handle the exception, also available() is not useful as on the stream it is documented to only return the number of bytes that can be read without blocking, not the overall number of bytes left to read.
score: 1
type: AnswerComment

http://stackoverflow.com/comment/34662738
comment on: http://stackoverflow.com/a/22736873
type: Comment
has text: Can you explain please ` // some code to read the dependencies proj.dependencies.compile project(otherProjectName)`?
score: 0
type: AnswerComment

http://stackoverflow.com/q/22748273
possible better answer: http://stackoverflow.com/a/22748394
has title: Waiting for threads to complete in a executor service
has answer: http://stackoverflow.com/a/22748394
tagged with: executorservice
has comment: http://stackoverflow.com/comment/34674490
has answer: http://stackoverflow.com/a/22748844
tagged with: multithreading
type: AnsweredQuestion
tagged with: java
has comment: http://stackoverflow.com/comment/34674721
accepted answer: http://stackoverflow.com/a/22748844
type: Question
answer count: 2
has body: I have initialized a exectuor service with N threads. After the N threads finishes i want to wait for a while and then reuse the executor with new instance of N threads. How do i do this? Here is the sample code i am using that is failing: int NumberOfThreads=Integer.parseInt(PropertyHandler.getProperty("numberOfThreads")); ExecutorService executor = Executors.newFixedThreadPool(NumberOfThreads); log.info("Executor class has been initialized"); while (true) { jobStack = MrMestri.buildJobs(); log.info("Creating a job stack of the search urls"); if (jobStack.isEmpty()) { Thread.sleep(10000); } else { int jobToken = 0; while (jobStack.size() &gt; 0) { jobToken++; MrRunnable worker = new MrRunnable(jobStack.pop()); executor.execute(worker); if (jobToken% Integer.parseInt(PropertyHandler.getProperty("totalTrends")) == 0) { log.info("All jobs for the clock cycle complete , waiting for next clock cycle to start. Number of jobs completed " + jobToken); executor.shutdown(); Thread.sleep(milliseconds); } Now that i am using executor shutdown , there is no executor to execute my threads. And my threads implement runnable. Any quick response would be of great help. Thank you.
score: 0

http://stackoverflow.com/a/22776224
has comment: http://stackoverflow.com/comment/34724901
has body: All you know for sure is that the object returned by evt.getNewValue() is a Number object. What if you use that information to your advantage and try something along these lines: temp = ((Number)evt.getNewValue()).doubleValue();
accepted answer of: http://stackoverflow.com/q/22776172
answers question: http://stackoverflow.com/q/22776172
type: AcceptedAnswer
downvote count: 0
upvote count: 2
type: Answer
score: 2

http://stackoverflow.com/comment/34591616
comment on: http://stackoverflow.com/q/22701891
has text: So, what's your _specific_ question? What part of the code isn't acting as you'd expect -- and what did you expect that code to do? This is more of a bug report than a question, so it's OT for stackoverflow.
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/34625843
score: 0
type: Comment
type: QuestionComment
has text: It doesn't affect. By using while loop, client doesn't get any message.
comment on: http://stackoverflow.com/q/22719106

http://stackoverflow.com/comment/34576008
type: Comment
score: 0
has text: A = [2 4 2; 6 8 1;5 7 5] Matlab result: V = -0.3486 -0.8276 0.1922 -0.5798 0.5601 -0.4032 -0.7364 0.0374 0.8947 L = 12.8778 0 0 0 -0.7978 0 0 0 2.9200 Java using Jama Library [[0.8275575078346545, -0.3493113857121139,0.24597790205308678], [-0.5601335729999509,-0.5809634522691761,-0.5159207870175849], [-0.037402561741212,-0.7379374514853343,1.144995023469712]] [[-0.7977988158677061,0.0, 0.0], [0.0, 12.877769427129202, 0.0], [0.0, 0.0,2.9200293887385067]]
type: QuestionComment
comment on: http://stackoverflow.com/q/22672172

http://stackoverflow.com/q/22715220
has answer: http://stackoverflow.com/a/22740862
type: Question
tagged with: servlets
has body: The following code is my web.xml file : <?xml version="1.0" encoding="UTF-8"?> MySimpleServletProject xmlServlet myServletPackage.XmlServlet xmlServlet /xmlServletpath The following code is a simple class that extends the HTTPServlet class: package myServletPackage; import java.io.IOException; import java.io.PrintWriter; import javax.servlet.ServletException; import javax.servlet.http.HttpServlet; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; public class XmlServlet extends HttpServlet { private static final long serialVersionUID = 1L; /** * @see HttpServlet#doGet(HttpServletRequest request, HttpServletResponse response) */ protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { response.setContentType("text/html"); PrintWriter out = response.getWriter(); out.println("Msg from 'XmlServlet' class"); } } When I try to run this code on Tomcat 7, it's displaying the following error message: HTTP Status 404 - /MySimpleServletProject/servlet/myServletPackage.XmlServlet -------------------------------------------------------------------------------- type Status report message /MySimpleServletProject/servlet/myServletPackage.XmlServlet description The requested resource (/MySimpleServletProject/servlet/myServletPackage.XmlServlet) is not available. -------------------------------------------------------------------------------- Apache Tomcat/7.0.12" Can someone please tell me what's wrong with this code? And please suggest how I can successfully run this.
score: 0
answer count: 2
has title: 404 Error on running a simple class that extends HTTPServlet
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/22715493
tagged with: java

http://stackoverflow.com/q/22767887
tagged with: reflection
has title: How to cast dynamically loaded annotation class to Annotation?
type: Question
has answer: http://stackoverflow.com/a/22767974
accepted answer: http://stackoverflow.com/a/22767974
tagged with: java
score: 0
answer count: 1
has body: I want to achieve the following logic: Load an annotation class with ClassLoader.loadClass( String ) Check if a given Class object has that annotation using Class.isAnnotationPresent(Class&lt;? extends Annotation&gt;) However, the return type of loadClass() is Class&lt;?&gt;, which cannot be used in isAnnotationPresent() directly. So, what steps should I take to use the loaded annotation class in isAnnotationPresent()? This seems a simple problem, but I just fail to find an answer from the mighty Google. :-( In any case, thank you very much.
type: AnsweredQuestion

http://stackoverflow.com/q/22697538
has comment: http://stackoverflow.com/comment/34584032
has comment: http://stackoverflow.com/comment/34615029
linked to: http://stackoverflow.com/q/2056221
has answer: http://stackoverflow.com/a/22697609
score: 0
possible better answer: http://stackoverflow.com/a/22697729
accepted answer: http://stackoverflow.com/a/22697609
has comment: http://stackoverflow.com/comment/34582998
has comment: http://stackoverflow.com/comment/34584118
has comment: http://stackoverflow.com/comment/34583046
has title: finding the sum of number dividsable by x using recursion
has answer: http://stackoverflow.com/a/22698281
has comment: http://stackoverflow.com/comment/34587980
answer count: 4
has comment: http://stackoverflow.com/comment/34589579
tagged with: recursion
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/22697729
has answer: http://stackoverflow.com/a/22697823
tagged with: java
has comment: http://stackoverflow.com/comment/68316769
type: Question
has body: I want to find the sum of numbers that is divisible by x using recursive method Ex if n= 10, x=3, the code should return sum of 3+6+9 Write a recursive method sumDivByX(n, x), which finds the sum of all numbers from 0 to n that are divisible by x. I asked my teacher about it and he told me "Firstly, total should be global. You should return 0 if n or x == 0. I only care if n is divisible by x. So I only add n to total (total+=n) if (n%x==0) otherwise do nothing. And do recursion sumDivByX(n-1,x) and return total as usual." I tried to correct it. public static int sumDivByX(int n, int x) { int total = 0; if (n == 0 || x == 0) { return -1; } if (n % x &gt;= 1) { return total = 0; } else if (n % x == 0) { return total += n; } return total + sumDivByX(n - 1, x); } When I run the program I get 0.

http://stackoverflow.com/q/22772756
type: Question
has body: I'm building a program that will send/receive data between two android devices. First i created a client thread to send data public void run() { try { //Create the datagram packet byte[] buffer = message.getBytes(); InetAddress addr = InetAddress.getByName(address); DatagramPacket packet = new DatagramPacket(buffer, buffer.length, addr, 5555); //Create Datagram Socket DatagramSocket socket = new DatagramSocket(); socket.setBroadcast(broadcast); // send the packet socket.send(packet); // i think that the problem was here } catch (Exception e) { e.printStackTrace(); Log.i("CTHREAD", "erreur"); } At the Server thread, i want to receive this packet, so i opened a datagramsocket to receive ten the packet. public void run() { try { serverIP = getLocalIpAddress(); Log.v("addr", serverIP); serverSocket = new ServerSocket(5001); Log.v("socket", "created"); while(socketOk) { //boucle infini Socket client = serverSocket.accept(); // Log.v("client", "received"); try { DatagramSocket socket = new DatagramSocket(5556); byte[] buf = new byte[1024]; //buffer DatagramPacket packet = new DatagramPacket(buf, buf.length); socket.receive(packet); byte[] result = new byte[packet.getLength()]; System.arraycopy(packet.getData(), 0, result, 0, packet.getLength()); String msg = new String(result); updateGui(msg, packet.getAddress()); } catch (Exception e) { socketOk =false; Log.v("ServerThread", "SocketOk =false"); } } } catch (Exception e) {} } } When i want to send a message, i obtain some warning so the program can't run the ClientThread. at libcore.io.IoBridge.maybeThrowAfterSendto(IoBridge.java:506) at libcore.io.IoBridge.sendto(IoBridge.java:475) at java.net.DatagramSocket.send(DatagramSocket.java:284) Caused by: libcore.io.ErrnoException: sendto failed: EACCES (Permission denied) Manifest.xml: &lt;uses-permission android:name="android.permission.ACCESS_WIFI_STATE"&gt;&lt;/uses-permission&gt; &lt;uses-permission android:name="android.permission.CHANGE_WIFI_STATE"&gt;&lt;/uses-permissio…
score: 0
tagged with: udp
answer count: 1
type: UnansweredQuestion
tagged with: multithreading
tagged with: android
has title: Android - Cannot send DatagramPacket
tagged with: java
has answer: http://stackoverflow.com/a/22775564

code-generation
tag name: code-generation
tags question: http://stackoverflow.com/q/22754225
tags question: http://stackoverflow.com/q/22745762
type: Tag

http://stackoverflow.com/comment/34763860
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/22793454
score: 0
has text: You can use a JLayeredPane and add your Panel and button to it, which will allow you to better control the zorder or use the glass pane...

http://stackoverflow.com/q/22723413
has answer: http://stackoverflow.com/a/22723639
score: 1
accepted answer: http://stackoverflow.com/a/22723639
tagged with: java
tagged with: swing
type: Question
possible better answer: http://stackoverflow.com/a/22723466
has title: How do I change the size of a JScrollPane in java
answer count: 3
tagged with: jscrollpane
upvote count: 1
favorite count: 0
has answer: http://stackoverflow.com/a/22723466
tagged with: jlist
has body: I have never used one of these before.I have only used normal JOptionPane boxes.This is what I have at the moment: JOptionPane.showMessageDialog(null,new JScrollPane(new JList(uniqueWords.toArray())),"Unique Words",1); where uniqueWords is an array list.The problem is the length of the dialog box is tiny.You can only see one line on screen at a time.How can I make it display more at a time. Also is it possible to get rid of these notes and what causes them Note: Files.java uses unchecked or unsafe operations. Note: Recompile with -Xlint:unchecked for details. EDIT: I changed my code to this JScrollPane jspane = new JScrollPane(new JList(uniqueWords.toArray())); Dimension size = new Dimension(1000,1000); jspane.setMinimumSize(size); JOptionPane.showMessageDialog(null,jspane,"Unique Words",1); but it is still displaying the same dialog box
tagged with: joptionpane
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/22723661
downvote count: 0

http://stackoverflow.com/comment/34715869
comment on: http://stackoverflow.com/a/22757840
score: 0
type: Comment
type: AnswerComment
has text: But if I undestood it correctly, all of that applies to the old JMM, where "final" did not have any thread-safe semantics (actually the article states that), so it does not apply here

http://stackoverflow.com/q/22748243
favorite count: 0
has comment: http://stackoverflow.com/comment/34674299
tagged with: android
has body: i am trying to import an existing android project into my workspace. I am facing issue with R.java file. it is not getting generated. I have gone through the solutions mentioned elsewhere on this site, but nothing seems to work. It is showing error sign on a folder drawable-xxxhdpi which has a .png file by the name ic_launcher.png in it.i cant understand what the error is. Any suggestions?
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/34674328
score: 1
tagged with: java
upvote count: 1
type: Question
has answer: http://stackoverflow.com/a/22748279
accepted answer: http://stackoverflow.com/a/22748279
has title: R.java file not being generated
tagged with: r.java-file
answer count: 1
downvote count: 0

http://stackoverflow.com/comment/34583818
type: QuestionComment
comment on: http://stackoverflow.com/q/22697935
has text: Why would you want that? Where do you want that?
score: 0
type: Comment

http://stackoverflow.com/q/22705400
has answer: http://stackoverflow.com/a/22705467
tagged with: java
type: Question
has answer: http://stackoverflow.com/a/22705478
score: 0
has body: I pass string value to this method.but im getting Array index bound exception please help me. public void separateCards(String cards) { cardNames+=cards+"-"; String[] parts = cardNames.split("-"); String part1 = parts[0]; // 004 String part2 = parts[1]; // 034556 Toast.makeText(getActivity(), part1,Toast.LENGTH_SHORT).show(); } } My logcat 03-28 11:27:41.213: E/AndroidRuntime(22392): FATAL EXCEPTION: main 03-28 11:27:41.213: E/AndroidRuntime(22392): java.lang.ArrayIndexOutOfBoundsException: length=1; index=1 03-28 11:27:41.213: E/AndroidRuntime(22392): at com.compareCr.ListvCompare.separateCards(ListvCompare.java:760) 03-28 11:27:41.213: E/AndroidRuntime(22392): at com.compareCr.ListvCompare$2$1.onClick(ListvCompare.java:627) 03-28 11:27:41.213: E/AndroidRuntime(22392): at android.view.View.performClick(View.java:4261) 03-28 11:27:41.213: E/AndroidRuntime(22392): at android.view.View$PerformClick.run(View.java:17356) 03-28 11:27:41.213: E/AndroidRuntime(22392): at android.os.Handler.handleCallback(Handler.java:615) 03-28 11:27:41.213: E/AndroidRuntime(22392): at android.os.Handler.dispatchMessage(Handler.java:92)
has answer: http://stackoverflow.com/a/22705472
has comment: http://stackoverflow.com/comment/34597545
has comment: http://stackoverflow.com/comment/34597546
favorite count: 0
answer count: 5
has comment: http://stackoverflow.com/comment/34597948
has comment: http://stackoverflow.com/comment/34597512
tagged with: android
has answer: http://stackoverflow.com/a/22705452
has answer: http://stackoverflow.com/a/22705456
has title: Error java.lang.ArrayIndexOutOfBoundsException:
type: UnansweredQuestion
upvote count: 1
downvote count: 1
has comment: http://stackoverflow.com/comment/34597520

http://stackoverflow.com/a/22784602
answers question: http://stackoverflow.com/q/22783805
type: Answer
has body: This is my database solution. It is all contained in one class. Too call it the syntax is... DatabaseManager mDatabase = DatabaseManager.getInstance(); public class DatabaseManager { private static DatabaseManager instance; private final String DB_NAME = "singoff_database"; private final int DB_VERSION = 1; private final String GAME_TABLE_NAME = "game_table"; private final String GAME_ID = "gameid"; private final String GAME_OPPONENT_ID = "opponent"; private final String GAME_TRACK = "track"; private final String GAME_FILE_PATH = "filepath"; private final String GAME_PICTURE = "picture"; private final String GAME_GUESSES = "guesses"; private final String GAME_DATE = "date"; private SQLiteDatabase mDb; private Context context; private DatabaseManager(Context context) { this.context = context; //create new or open database DatabaseHelper helper = new DatabaseHelper(context); this.mDb = helper.getWritableDatabase(); } public synchronized static DatabaseManager getInstance() { if (instance == null) { Context context = Main.getInstance(); instance = new DatabaseManager(context); } return instance; } //__________________________________________________________________________________________// //GAME LIST HANDLING STATEMENTS public synchronized void addGame(String gID, String oID, String track, String path, byte[] thumb, String datetime) { ContentValues values = new ContentValues(); values.put(GAME_ID, gID); values.put(GAME_OPPONENT_ID, oID); values.put(GAME_TRACK, track); values.put(GAME_FILE_PATH, path); values.put(GAME_PICTURE, thumb); values.put(GAME_DATE, datetime); mDb.insert(GAME_TABLE_NAME, null, values); } public synchronized List&lt;File&gt; getGames() { List&lt;File&gt; games = new ArrayList&lt;File&gt;(); Cursor cursor; cursor = mDb.query( GAME_TABLE_NAME, new String[]{GAME_FILE_PATH}, null, null, null, null, null); cursor.moveToFirst(); if (!cursor.isAfterLast()) { do { File file = new File(cursor.getString(0)); games.add(file); } while (cursor.moveToNext());…
score: 0
has comment: http://stackoverflow.com/comment/53111285

http://stackoverflow.com/q/22788068
linked to: http://stackoverflow.com/q/12385544
type: Question
tagged with: c3p0
score: 0
has answer: http://stackoverflow.com/a/22793863
answer count: 1
type: UnansweredQuestion
tagged with: java
has body: In my project I'm using hibernate 3, Spring and C3p0 and after consulting postgres' pg_stat_activity I strongly suspect this query to be from hibernate query to populate an EAGER list in one of my entities select listrulesf0_.rule_block_register_id as rule4_15_1_, listrulesf0_.id as id1_16_1_, listrulesf0_.id as id1_16_0_, listrulesf0_.display_order as display2_16_0_, listrulesf0_.id_field as id3_16_0_, listrulesf0_.rule_block_register_id as rule4_16_0_ from (...) this query hangs idle in transaction effectively blocking every other operation in my program. I have no idea how this happens and how I can fix it.
tagged with: hibernate
has title: Hibernate Eager select hangs in "Idle in transaction"
has comment: http://stackoverflow.com/comment/34750477

http://stackoverflow.com/a/22804831
has body: You: "handle" all exceptions with an empty block; have no finally where you release the database resources; have no line of code whatsoever which should close the database connection, even in a "happy day" scenario. Your program stops working because each time the task runs, one database connection is left hanging. Soon enough there are no more connections to acquire, but you don't get informed of that because you decided not to log the exception.
answers question: http://stackoverflow.com/q/22804359
type: Answer
type: AcceptedAnswer
score: 0
accepted answer of: http://stackoverflow.com/q/22804359

http://stackoverflow.com/q/22662069
has title: Get Color logs in console for log4j without ANSI color sequence
answer count: 1
tagged with: log4j
favorite count: 0
has answer: http://stackoverflow.com/a/22668403
type: UnansweredQuestion
score: 2
downvote count: 0
tagged with: java
type: Question
has body: I want to color the log4j error logs with red. I have gone through few links advising how to do that but following all the steps what i see on Eclipse or command console is something like [[31m INFO[m] and not the color. I guess plugin is required for both Eclipse and command for ANSI. But I want to know if there is a way out where we do not require ANSI plugins. Because Java System.err logs do come out to console with red color.
tagged with: eclipse
upvote count: 2

http://stackoverflow.com/comment/34821493
has text: @Bringer128 Interesting difference between Java and C# regarding binary compatibility; in Java we assume that future versions will be binary compatible. Thanks for the info.
comment on: http://stackoverflow.com/a/22803460
score: 0
type: AnswerComment
type: Comment

http://stackoverflow.com/q/22758890
score: 0
has comment: http://stackoverflow.com/comment/34693966
answer count: 1
has title: Unable to start hive server in java program
type: UnansweredQuestion
tagged with: hive
has answer: http://stackoverflow.com/a/22779966
tagged with: java
type: Question
has comment: http://stackoverflow.com/comment/34694406
linked to: http://stackoverflow.com/q/318239
has comment: http://stackoverflow.com/comment/34693501
has comment: http://stackoverflow.com/comment/34693747
has body: I am trying to start a Hive server using Java program. This is my Java code. p = Runtime.getRuntime().exec("/home/bigdata/hive/bin/hive --service hiveserver"); p.waitFor(); Error: Cannot find hadoop installation: $HADOOP_HOME or $HADOOP_PREFIX must be set or hadoop must be in the path I started my hdfs. But also i am getting this error

http://stackoverflow.com/q/22748496
has comment: http://stackoverflow.com/comment/34675693
has comment: http://stackoverflow.com/comment/34752779
answer count: 1
has body: I was working on my game today and I found that the top of my trees have a weird texture problem where they overlap each other with a black box. It is only the top of the trees and the tops are split up into 9 blocks all with their own image. The 9 images are transparent, each is 32x32, and I've tried it a bunch of different ways with no luck. Does anyone know what the problem with the texture is? This isn't a generation question but an OpenGL/Slick2D question about textures. Here's a screenshot of the problem: Screenshot EDIT: Here's a piece of the rendering code. for (int x = (int) (World.instance.camera.getX() / Block.WIDTH); x &lt; width; x++) { for (int y = (int) (World.instance.camera.getY() / Block.HEIGHT); y &lt; height; y++) { try { if (blocks[x][y] != Block.AIR.getId()) { g.drawImage(textureCache.get(blocks[x][y]), x * Block.WIDTH, y * Block.HEIGHT); } } catch(Exception ex) { } } }
has comment: http://stackoverflow.com/comment/34756515
tagged with: textures
type: UnansweredQuestion
score: 0
has answer: http://stackoverflow.com/a/22803110
type: Question
has comment: http://stackoverflow.com/comment/34768186
tagged with: java
tagged with: slick2d
has title: Java Slick2D Texture Issue
tagged with: image

http://stackoverflow.com/q/22734776
has comment: http://stackoverflow.com/comment/34651354
has comment: http://stackoverflow.com/comment/34650577
has title: BODMAS, Java. Simple Math that won't Add Up
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/22734915
accepted answer: http://stackoverflow.com/a/22734915
has comment: http://stackoverflow.com/comment/34650660
tagged with: addition
has comment: http://stackoverflow.com/comment/34650312
has body: Hello can't figure out why I can't get right result for startE just a simple program, to illustrate the problem. "NUMBER CLASS" public class Number { public static void main(String[] args) { Grow big = new Grow(); big.growing(); }} "GROW CLASS" public class Grow { private int startE = 50000 / 1 / 2; private int startC = 50000 / 1 / 3; public void growing() { for (int i = 0; i &lt; 10; i++) { startE = startE + (((50000 * (13 / 20)) - (50000 * (1 / 2))) / 200); startC = startC + ((50000 / 1 / 2 - 50000 / 1 / 3) / 75); System.out.println(startE); System.out.println(startC); } }} You will see that 'startC' does as expected, however I am getting no joy with 'startE' If you can help that would be great What it prints out on console. 25000 25000 25000 25000 25000 etc
tagged with: loops
type: Question
tagged with: math
tagged with: java
score: 0
answer count: 1
has comment: http://stackoverflow.com/comment/34650308

http://stackoverflow.com/comment/34692456
type: QuestionComment
comment on: http://stackoverflow.com/q/22757894
score: 0
has text: have you tried using an explicit wait instead of an implicit wait?
type: Comment

http://stackoverflow.com/q/22697324
has comment: http://stackoverflow.com/comment/34582700
type: UnansweredQuestion
tagged with: swt
has title: Executable jar and double-click
tagged with: maven
has body: I'm in the process of creating a fairly extensive desktop application using SWT. To generate an executable jar file I use maven-shade-plugin in version 2.1. After generating a file, typical double-clicking does not work (the system tries to open a few seconds and stops). Calling from the console java -jar pakiet.jar works very well. Previously, I created a project with SWING with using the same plugin and double click worked without a problem. Is the problem may be to use SWT? Java version 1.7.0_25 OS Windows 7 Professional x64
has answer: http://stackoverflow.com/a/23248465
tagged with: java
has answer: http://stackoverflow.com/a/23192650
type: Question
answer count: 2
tagged with: jar
has comment: http://stackoverflow.com/comment/34604817
score: 0

http://stackoverflow.com/a/22660323
type: AcceptedAnswer
downvote count: 0
has body: Â€ is 2 characters and that's why you get an error about an invalid character constant. You have to use a single character: arrayOfByte1['Â'] = 12; arrayOfByte1['€'] = 13;
type: Answer
answers question: http://stackoverflow.com/q/22660063
score: 1
upvote count: 1
accepted answer of: http://stackoverflow.com/q/22660063

http://stackoverflow.com/a/22719184
downvote count: 0
has comment: http://stackoverflow.com/comment/34622412
has body: your bob is null and you can not call equal() on that either change your program to if(bob != null){ if bob.equals("blah blah blah"){ do_something(); } } OR initialize bob like String bob = new String("some string");
type: Answer
answers question: http://stackoverflow.com/q/22719126
has comment: http://stackoverflow.com/comment/34622510
score: 1
has comment: http://stackoverflow.com/comment/34622575
upvote count: 1
has comment: http://stackoverflow.com/comment/34622571
has comment: http://stackoverflow.com/comment/34622464

http://stackoverflow.com/q/22658111
accepted answer: http://stackoverflow.com/a/22658258
favorite count: 0
has comment: http://stackoverflow.com/comment/34512268
upvote count: 1
has body: Quick question. Let's say I define an ArrayList bigArrayList as a ArrayList of ArrayList . Can my bigArrayList contain other data types other than a ArrayList? Other data types like int, String, objects or a simple array? Example code of ArrayList creation: ArrayList&lt;ArrayList&lt;String&gt;&gt; bigArrayList = new ArrayList&lt;ArrayList&lt;String&gt;&gt;(); ArrayList&lt;String&gt; smallArrayList = new ArrayList&lt;String&gt;(); bigArrayList.add(smallArrayList); int myInt = 12; bigArrayList.add(smallArrayList); //Acceptable?? Also how would I go about modifying smallArrayList once it's added to bigArrayList? Thanks in advance.
has title: ArrayList of ArrayList
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/34512296
tagged with: java
has answer: http://stackoverflow.com/a/22658258
downvote count: 1
has answer: http://stackoverflow.com/a/22658692
type: Question
answer count: 2
tagged with: arrays
possible better answer: http://stackoverflow.com/a/22658692
tagged with: listview
score: 0

http://stackoverflow.com/comment/34637343
type: Comment
type: QuestionComment
score: 0
has text: Do you actually have a log configuration?
comment on: http://stackoverflow.com/q/22727398

http://stackoverflow.com/a/22777751
has body: use this code, may help you: String s1=e1.getText().toString(); and check the s1.len&gt;0 hit the button convert the answer otherwise the don't do anything....
score: 0
answers question: http://stackoverflow.com/q/22777573
type: Answer

http://stackoverflow.com/a/22703059
has body: You need to add both snippets below OpenEntityManagerInViewFilter org.springframework.orm.jpa.support.OpenEntityManagerInViewFilter and OpenEntityManagerInViewFilter /* Then you need to add spring-orm-{our version here}.jar to your classpath. Like this if you're using maven org.springframework spring-orm ${spring.ver} --EDIT-- Sorry, I'm using JPA, your code suggests you are using hibernate3 so your filter-class should be org.springframework.orm.hibernate3.support.OpenSessionInViewFilter
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/34593770
type: Answer
has comment: http://stackoverflow.com/comment/34593801
has comment: http://stackoverflow.com/comment/34594090
has comment: http://stackoverflow.com/comment/34593668
accepted answer of: http://stackoverflow.com/q/22702851
has comment: http://stackoverflow.com/comment/34593638
upvote count: 9
answers question: http://stackoverflow.com/q/22702851
has comment: http://stackoverflow.com/comment/48314672
has comment: http://stackoverflow.com/comment/34594047
score: 9
has comment: http://stackoverflow.com/comment/34593606

http://stackoverflow.com/a/22720376
upvote count: 3
has comment: http://stackoverflow.com/comment/34629155
type: Answer
has comment: http://stackoverflow.com/comment/34628926
has comment: http://stackoverflow.com/comment/34629296
score: 3
downvote count: 0
has comment: http://stackoverflow.com/comment/34624744
answers question: http://stackoverflow.com/q/22719976
has body: Yours is almost a minimal example program. To truly comply, it must compile (yours doesn't -- new TestClass()?), and it should be in one file with imports. This for example is closer: import java.awt.*; import javax.swing.*; import javax.swing.border.LineBorder; public class Run extends JFrame { public Run() { // !!?? add(new TestClass()); add(new Center()); // !! this is better setDefaultCloseOperation(EXIT_ON_CLOSE); pack(); setLocationRelativeTo(null); setVisible(true); } public static void main(String[] _) { new Run(); } } class Buttons extends JPanel { public Buttons() { setLayout(new GridLayout(2, 3)); add(new JButton("Button 1")); add(new JButton("Button 2")); add(new JButton("Button 3")); add(new JButton("Button 4")); add(new JButton("Button 5")); add(new JButton("Button 6")); } } class Center extends JPanel { JPanel centerFrame = new JPanel(); public Center() { setLayout(new BorderLayout()); centerFrame.setBackground(Color.RED); centerFrame.setBorder(new LineBorder(Color.BLUE, 6)); centerFrame.add(panel1()); add(centerFrame, BorderLayout.CENTER); add(new Buttons(), BorderLayout.PAGE_END); System.out.println(centerFrame.getLayout()); // !! hm, this may be important } public JPanel panel1() { JPanel pane = new JPanel(new BorderLayout()); JPanel content = new JPanel(); content.setPreferredSize(new Dimension(400, 200)); pane.add(content, BorderLayout.CENTER); return pane; } } But more importantly, if you run this program, you'll see that I've added a line of code which will answer your question for you. :)
has comment: http://stackoverflow.com/comment/34628878

http://stackoverflow.com/comment/34767761
has text: Using exceptions as a replacement for logic is just plain bad practice.
type: Comment
comment on: http://stackoverflow.com/a/22799838
score: 0
type: AnswerComment

http://stackoverflow.com/q/22784684
has answer: http://stackoverflow.com/a/22784738
has comment: http://stackoverflow.com/comment/105750832
favorite count: 0
has body: I want to have a Java enum whose values are integers. For example: public enum TaskStatus { TaskCreated(1), TaskDeleted(2) } But I also want custom names for these two constants like e.g. "Task Created" and "Task Deleted" (with spaces there). I want to do it as elegantly as possible without writing too much additional code. Can I achieve this without an additional map which maps the enum constants to their custom names? I am using JDK 6 in this project.
has title: Java enum - custom names
possible better answer: http://stackoverflow.com/a/22784857
accepted answer: http://stackoverflow.com/a/22784738
has answer: http://stackoverflow.com/a/22784857
type: AnsweredQuestion
tagged with: enums
tagged with: java
has comment: http://stackoverflow.com/comment/124562054
type: Question
upvote count: 4
answer count: 2
downvote count: 0
score: 4

http://stackoverflow.com/q/22717218
type: Question
accepted answer: http://stackoverflow.com/a/22717403
type: AnsweredQuestion
tagged with: java
linked to: http://stackoverflow.com/q/409784
has title: How to Create ArrayList of 2D Arrays
tagged with: arrays
answer count: 1
tagged with: arraylist
score: 0
has answer: http://stackoverflow.com/a/22717403
has comment: http://stackoverflow.com/comment/34619373
has body: I've run across a very perturbing problem. I'm trying to create a "chunking" system for this little game I'm making. What I want to do right now is just generate infinite chunks of dirt blocks. It works right now, but I'm just using a two dimensional array, which stores the column and the index of the dirt. Here is the actual code: public void generate(){ int newMax = dirtCount + dirtGeneratorChunk; int oldCount = dirtCount; for(int i = oldCount;i&lt;newMax;i++){ dirt[dirtCount] = newDirt(spawnDirtX+column*16, spawnDirtY,16,16,column,columnNumber); columnNumber ++; blockGrid[column][columnNumber] = spawnDirtY; updateBlockGrid(column,(spawnDirtY-spawnDirtTop)/16,spawnDirtY); dirtX[i] = spawnDirtX+column*16; dirtY[i] = spawnDirtY; hasDirt = true; dirtCount ++; spawnDirtY += 16; if(spawnDirtY&gt;500){ column++; columnNumber = 0; spawnDirtY = spawnDirtYOriginal; } } repaint(); } Hopefully that is helpful to show what I'm trying to do. As I'm sure you can tell by the code, I'm pretty new to Java and may be using bad practices/inefficient methods. If you have any suggestions on how I can improve my programming, I would love to hear them! Back to the point. Here is what I have so far on the ArrayList: //Construct a new empty ArrayList for type int[][] ArrayList&lt;int[][]&gt; chunkHolder = new ArrayList&lt;int[][]&gt;(); //Fill ArrayList (index, int[][]) chunkHolder.add(chunkCount, createBlockGrid()); chunkCount ++; Object[] chunkArray = chunkHolder.toArray(); System.out.println(chunkArray[0]); public static int[][] createBlockGrid(){ int[][] blockGrid = new int[64][256]; return blockGrid; } When I attempt to use System.out.println(chunkHolder.get(0));, it returns: [[I@337838. Obviously this isn't what I want... what am I doing wrong? Thank you all for your help! ~Guad (If I explained anything without clarity, please tell me!)
has comment: http://stackoverflow.com/comment/34618860

http://stackoverflow.com/comment/34656755
comment on: http://stackoverflow.com/q/22737903
score: 0
type: Comment
type: QuestionComment
has text: Down the rabbit hole of DI I wnet. I found the Wikipedia article to be the most helpful (http://en.wikipedia.org/wiki/Dependency_injection) and it confirmed I'm on the right path. Especially helpful was the discussion of when to use what DI (Constructor, Setter, Interface). Thanks to all again for the (almost instant) replies :-)

http://stackoverflow.com/comment/34551193
has text: This is not for changing the wiring of bolts but rather for getting the column names in db to insert the data. So, I want to maintain an editable properties file.
score: 0
type: Comment
comment on: http://stackoverflow.com/a/22660115
type: AnswerComment

http://stackoverflow.com/comment/34591239
has text: You are attempting to modify a temporary variable created just for that foreach loop: http://stackoverflow.com/questions/85190/how-does-the-java-for-each-loop-work, http://docs.oracle.com/javase/1.5.0/docs/guide/language/foreach.html
type: Comment
score: 1
comment on: http://stackoverflow.com/q/22701694
type: QuestionComment

http://stackoverflow.com/q/22668731
favorite count: 0
tagged with: google-app-engine
upvote count: 1
tagged with: java
has title: RuntimeException: Unable to restore the previous TimeZone
answer count: 0
downvote count: 0
type: UnansweredQuestion
has body: When I run my GAE application it throws this error: java.lang.RuntimeException: Unable to restore the previous TimeZone at com.google.appengine.tools.development.DevAppServerImpl.restoreLocalTimeZone(DevAppServerImpl.java:348) at com.google.appengine.tools.development.DevAppServerImpl.start(DevAppServerImpl.java:251) at com.google.appengine.tools.development.gwt.AppEngineLauncher.start(AppEngineLauncher.java:97) at com.google.gwt.dev.DevMode.doStartUpServer(DevMode.java:509) at com.google.gwt.dev.DevModeBase.startUp(DevModeBase.java:1068) at com.google.gwt.dev.DevModeBase.run(DevModeBase.java:811) at com.google.gwt.dev.DevMode.main(DevMode.java:311) Caused by: java.lang.NoSuchMethodException: java.util.TimeZone.setDefaultInAppContext(java.util.TimeZone) at java.lang.Class.getDeclaredMethod(Class.java:2117) at com.google.appengine.tools.development.DevAppServerImpl.restoreLocalTimeZone(DevAppServerImpl.java:344) at com.google.appengine.tools.development.DevAppServerImpl.start(DevAppServerImpl.java:251) at com.google.appengine.tools.development.gwt.AppEngineLauncher.start(AppEngineLauncher.java:97) at com.google.gwt.dev.DevMode.doStartUpServer(DevMode.java:509) at com.google.gwt.dev.DevModeBase.startUp(DevModeBase.java:1068) at com.google.gwt.dev.DevModeBase.run(DevModeBase.java:811) at com.google.gwt.dev.DevMode.main(DevMode.java:311) The app is usine JDK 1.8.0 from Oracle, how do I fix this error?
type: Question
score: 1

http://stackoverflow.com/a/22801416
answers question: http://stackoverflow.com/q/22801373
type: Answer
has body: SHA256 returns pure binary output, with all values from 00 to FF essentially equally likely for each character. For text output, you'll need to convert it to a text form, like Base64 encoding byte[] encodedBytes = Base64.encodeBase64("Test".getBytes()); System.out.println("encodedBytes " + new String(encodedBytes)); The only way to go from a cryptographically sound hash (or most hashes, even cryptographically unsound ones) back to the original input is to apply the hash to input after input until you get the same result - that's either the original input, or a collision.
downvote count: 0
score: 1
upvote count: 1

http://stackoverflow.com/q/22757303
type: Question
has title: Best method to transfer large continuous data
type: AnsweredQuestion
tagged with: java
score: 0
tagged with: mobile
answer count: 1
has answer: http://stackoverflow.com/a/22764282
tagged with: android
has body: I am beginning to write an app that sends data from the app to computer software via a wifi connection. There is a lot of data needed to be sent. Ie. Microphone input. The software needs to be able to tell if their is noise going into the microphone, and could be extended to indicate noise levels. However I have thought of two ways to transfer the data. Send all the data outright continuously and then let the computer software handle it. The pros of this is that if I want to make changes to how the data is interpret I only have to update the computer software and not the mobile app. The cons being I have to send a lot of data for a simple on/off state. Send only the states (there is noise/there isn't). The pros of this is that the data transfer will be heavily reduced and can be sent only when there is a state change. The cons now being in order to update the software I must update the app too. I am concerned about mismatches in app/software versions causing problems for users, but also concerned of large data transfer. Which method is best to use? Is there another method I have not considered?
accepted answer: http://stackoverflow.com/a/22764282

http://stackoverflow.com/q/22650711
has body: I'm interested in knowing how I can declare and initialize an array of JButtons in a class so that the constructor and methods of that same class will all have access to this array. Currently, I declared the JButtons and array at the start of my class definition and initialized the array in the class constructor. However, this does not allow the rest of the class' methods to access the array's variables. Your help is greatly appreciated! public class demo{ public JButton one; public JButton two; public JButton three; public JButton demoArray[] = new JButton[3]; public demo(){ demoArray[0] = one; demoArray[1] = two; demoArray[2] = three; .... } public void actionPerformed(ActionEvent e) {... for(int i=0; i&lt;3; i++) { demoArray[i].setEnabled(false); } } }
accepted answer: http://stackoverflow.com/a/22650828
tagged with: java
downvote count: 5
tagged with: class
has title: Java - How to allow all methods of a class to access an array initialized in constructor?
type: AnsweredQuestion
possible better answer: http://stackoverflow.com/a/22650794
tagged with: arrays
has comment: http://stackoverflow.com/comment/34499654
has answer: http://stackoverflow.com/a/22650794
score: -4
has comment: http://stackoverflow.com/comment/34499629
favorite count: 0
type: Question
tagged with: constructor
has comment: http://stackoverflow.com/comment/34537046
has comment: http://stackoverflow.com/comment/34500104
answer count: 2
upvote count: 1
tagged with: methods
has answer: http://stackoverflow.com/a/22650828
has comment: http://stackoverflow.com/comment/34499622

http://stackoverflow.com/comment/34783234
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/22790290
has text: @1Poseidon3 In reply to some of your comments: `Generator` **is** a `SimpleApplication`. Any method that wants a `SimpleApplication` will be very happy with a `Generator`. (although of course you can't instantiated `Generator` because it is also `abstract`. Why is it abstract?)

http://stackoverflow.com/a/72991743
score: 3
upvote count: 3
has body: Over the period java interfaces have evolved a lot and Java 8 completely changed the way interfaces were presumed. Coming to question, yes we can have a method body in the interface. whereas in java 8 we can have a method body in a static method and in the default method like the below example. interface CheckMyEvolution{ default void whatsNew() { System.out.print("Hello there!Check my Evolution"); } static ZoneId getZoneId (String zoneString) { try { return ZoneId.of(zoneString); } catch (DateTimeException e) { System.err.println("Invalid time zone: " + zoneString + "; using default time zone instead."); return ZoneId.systemDefault(); } } } we can also have the private method in the interfaces from java 9 onwards. like below code compiles well in java 9 and above versions but fails in java 8 and below interface CheckMyEvolution{ default void whatsNew() { checkIt(); } // Private method private void checkIt() { System.out.println("Hello there! I can have private method now. Make sure you are using JDK 9 or Above."); } } public class CheckMyEvolutionImpl implements CheckMyEvolution{ public static void main(String[] args) { CheckMyEvolution evolution= new CheckMyEvolutionImpl(); evolution.whatsNew(); } } References: https://docs.oracle.com/javase/tutorial/java/IandI/defaultmethods.html [https://www.quora.com/profile/Rajat-Singh-187/Private-Method-in-the-Java-Interface]
answers question: http://stackoverflow.com/q/22713652
downvote count: 0
type: Answer

http://stackoverflow.com/q/22771404
answer count: 0
tagged with: java
type: Question
tagged with: client-server
score: 0
has comment: http://stackoverflow.com/comment/34716462
tagged with: netbeans
has title: Login/Register from a Client to a Server
tagged with: jframe
type: UnansweredQuestion
has body: so I was hoping that there would be someone who could show me/direct me to creating a Login/ Registration server within Java. I am creating a Chat Client for some friends and I, and I would like to have the user to be able to Login/Register an account, sending the information to the server to store in a database for later use. Any ideas? I have created JFrames, and got my basic things done for the Client so far, I have not yet begun working on the server.
has comment: http://stackoverflow.com/comment/34716441

http://stackoverflow.com/comment/34742837
type: Comment
comment on: http://stackoverflow.com/a/22785960
score: 0
type: AnswerComment
has text: I think I answered my own question... if m/(m/100) is always 100 for m>100, I'm basically saying the bigO is O(100*logn) which is O(logn), can I substract the logn from the bigO you wrote (since log2n is bigger than log3m) and just make it O(log3m)?

http://stackoverflow.com/comment/34664855
type: Comment
type: QuestionComment
score: 0
has text: You can't; a `String` is not made to store binary data!
comment on: http://stackoverflow.com/q/22743012

http://stackoverflow.com/a/22742858
downvote count: 0
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/34664555
has body: To directly answer your question, I would create the file in the constructor, this allows you code to fail fast and let the caller know this is not going to work. I would then have a try/finally block which wraps all the code, something like public void run() { try { run0(); } catch(Throwable t) { System.err.println("Process dying"); t.printStackTrace(); } finally { // close all resources } } private void run0() throws Stuff... { // does the real work } How can I make sure that when I kill this process that I close BufferedReader and BufferedWriter to prevent memory leaks? When you kill a process, the OS will reclaim all the processes resources so you can't get a memory leak not matter how you code it. The only resource leak you can get is unwanted temporary files being left behind. BTW When you call FileWriter, it will create a new file or truncate as required. There is no point checking if the file still exists because even if it had been deleted (which is extremely unlikely) , you would not be using the one you just created. I wouldn't create a new thread just at the end of main as this gains you nothing. Also I would only call a thread daemon if it is a daemon thread. Giving it a misleading name could be confusing.
accepted answer of: http://stackoverflow.com/q/22742771
type: Answer
answers question: http://stackoverflow.com/q/22742771
score: 1
upvote count: 1
has comment: http://stackoverflow.com/comment/34664611

http://stackoverflow.com/a/44608958
answers question: http://stackoverflow.com/q/22781940
downvote count: 0
score: 1
type: Answer
upvote count: 1
has body: I know it's a old thread but I'd like to present a situation where the threads get interrupted and doesn't execute finally: Here is the sample code: public class Test { public static void main(String[] args) { Test test = new Test(); test.LockWork(); }public void LockWork() { WithLock withLock = new WithLock(); Thread t1 = new Thread(() -&gt; { withLock.produce(); }); Thread t2 = new Thread(() -&gt; { withLock.consume(); }); ExecutorService service= Executors.newCachedThreadPool(new WithLockThreadFactory()); Future f1=service.submit(t1); Future f2=service.submit(t2); //f1.cancel(true); try { System.out.println("-------------------------------------sleeping now-------------------------------------"); Thread.sleep(3000); System.out.println("-------------------------------------Intereputing Producer-------------------------------------"); f1.cancel(true); service.shutdown(); Thread.sleep(1000); System.out.println("is Producer done: "+f1.isDone()); service.awaitTermination(1, TimeUnit.DAYS); System.out.println("is Consumer done: "+f2.isDone()); } catch (InterruptedException e) { e.printStackTrace(); } System.out.println("Ending Program"); } now There is my Thread Factory: public class WithLockThreadFactory implements ThreadFactory { private int counter; public WithLockThreadFactory() { this.counter = 1; } @Override public Thread newThread(Runnable r) { Thread t = new Thread(r, "WithLockThreadFactoryThread " + counter); counter++; return t; } now WithLock Class: public class WithLock { ReentrantLock lock = new ReentrantLock(true); LinkedList&lt;Integer&gt; linkedList = new LinkedList&lt;&gt;(); Condition isEmpty = lock.newCondition(); Condition isFull = lock.newCondition(); int limit = 10; volatile int interruptCounter = 0; public void produce() { System.out.println("WithLock.produce() Name: " + Thread.currentThread().getName()); try { int value = 1; while (true) { lock.lockInterruptibly(); if (limit == linkedList.size()) { System.out.println("acquiring lock in produce")…

http://stackoverflow.com/q/22720411
has comment: http://stackoverflow.com/comment/34629998
upvote count: 1
has answer: http://stackoverflow.com/a/22722455
answer count: 1
has comment: http://stackoverflow.com/comment/34624817
has title: Java LinkedList iterator and Thread Safety for game with RenderThread and UpdateThread
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/22722455
downvote count: 0
score: 1
favorite count: 0
has comment: http://stackoverflow.com/comment/34632671
type: Question
tagged with: multithreading
tagged with: android
has comment: http://stackoverflow.com/comment/34624987
has comment: http://stackoverflow.com/comment/34624903
has comment: http://stackoverflow.com/comment/34625755
has comment: http://stackoverflow.com/comment/34626441
has comment: http://stackoverflow.com/comment/34628048
has body: Simply I have a shared java LinkedList in an Android app that has 2 Threads, a render thread and an update thread. Both threads run continously and keep on iterating over the shared LinkedList. Sometimes the update thread has to remove an object from the LinkedList. How do I code the program such to keep multithreaded performance but allowing this to happen. I keep receiving a java.util.ConcurrentModificationException from the render thread because I am guessing the object is being removed while I am trying to render it. Please note, I use iterators in my code... public void run() { if(Thread.currentThread() == renderThread) { while(true) { for(Iterator&lt;GameObject&gt; it = objects.iterator(); it.hasNext();) { it.next().render(); } } } if(Thread.currentThread() == updateThread) { while(true) { for(Iterator&lt;GameObject&gt; it = objects.iterator(); it.hasNext();) { GameObject o = it.next(); it.next().update(); if(o.shouldBeRemoved()) it.remove(); } } } } One possible solution is to catch the Exception and just ignore it, but I feel that is the cheaters way out since exceptions should be used for exceptional circumstances, not flow.
tagged with: linked-list
tagged with: java
tagged with: thread-safety

http://stackoverflow.com/comment/34771295
type: Comment
has text: Unfortunately this isnt related to a jar which wouldve been an easy fix. It has to do with a certain class that is in a project that my android project is dependent on and for some reason gets added twice. Ive tried locating the duplicate file but I just cant find it. Ive even tried letting everything build into another folder outside the project instead of the bin file but still its a no go.
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/22801651

http://stackoverflow.com/q/22717006
has answer: http://stackoverflow.com/a/22717990
possible better answer: http://stackoverflow.com/a/22717990
accepted answer: http://stackoverflow.com/a/22717129
tagged with: android
type: AnsweredQuestion
tagged with: java
type: Question
tagged with: onscroll
answer count: 2
has title: Java Android - Show more element in ListView
has body: i use setOnScrollListener that show other element. lvMain.setOnScrollListener(new OnScrollListener() { @Override public void onScroll(AbsListView view, int firstVisibleItem, int visibleItemCount, int totalItemCount) { // TODO Auto-generated method stub if(firstVisibleItem + visibleItemCount &gt;= totalItemCount) { boxAdapter.count += visibleItemCount; boxAdapter.notifyDataSetChanged(); } else {} } @Override public void onScrollStateChanged(AbsListView view, int scrollState) { // TODO Auto-generated method stub } }); By default, the list gets only 10 elements. @Override public int getCount() { //return objects.size(); return 10; } Everything is loaded when I scroll, but when I reach the end of the application is closed. What is the reason? LogCat: 03-28 18:27:22.243: E/AndroidRuntime(31068): FATAL EXCEPTION: main 03-28 18:27:22.243: E/AndroidRuntime(31068): Process: com.example.warapp, PID: 31068 03-28 18:27:22.243: E/AndroidRuntime(31068): java.lang.IndexOutOfBoundsException: Invalid index 100, size is 100 03-28 18:27:22.243: E/AndroidRuntime(31068): at java.util.ArrayList.throwIndexOutOfBoundsException(ArrayList.java:255) 03-28 18:27:22.243: E/AndroidRuntime(31068): at java.util.ArrayList.get(ArrayList.java:308) 03-28 18:27:22.243: E/AndroidRuntime(31068): at com.example.warapp.BoxAdapter.getItem(BoxAdapter.java:49) 03-28 18:27:22.243: E/AndroidRuntime(31068): at com.example.warapp.BoxAdapter.getView(BoxAdapter.java:67) 03-28 18:27:22.243: E/AndroidRuntime(31068): at android.widget.AbsListView.obtainView(AbsListView.java:2240) 03-28 18:27:22.243: E/AndroidRuntime(31068): at android.widget.ListView.makeAndAddView(ListView.java:1790) 03-28 18:27:22.243: E/AndroidRuntime(31068): at android.widget.ListView.fillDown(ListView.java:691) 03-28 18:27:22.243: E/AndroidRuntime(31068): at android.widget.ListView.fillGap(ListView.java:655) 03-28 18:27:22.243: E/AndroidRuntime(31068): at android.widget.AbsListView.trackMotionScroll(AbsListView.java:5136) 03-28 18:27:22.243: E/An…
has answer: http://stackoverflow.com/a/22717129
tagged with: listview
score: 0

http://stackoverflow.com/comment/34778243
type: Comment
score: 3
has text: @RafaEl: The above error message isn't printed by Eclipse itself. The first error originates from a unit test run **inside** of Eclipse (so Eclipse might be eating all the memory) and the second one is from Windows *before* Eclipse can even be started.
comment on: http://stackoverflow.com/a/22805787
type: AnswerComment

http://stackoverflow.com/a/23273106
has body: I found the way in the PEX and I simplified it: First I need to declare a Field variable: public static Field mezo; After that, at OnEnable method I need to get CraftHumanEntitys perm field: try{ mezo=Class.forName("org.bukkit.craftbukkit.v1_7_R1.entity.CraftHumanEntity").getDeclaredField("perm"); } catch(Throwable h){ } And at every player join I need to register the player: Jogkezelheto uj=new Jogkezelheto(j); try{ mezo.setAccessible(true); mezo.set(j,uj); } catch (Throwable h){ } Jogkezelheto is my class, which extends the PermissibleBase, such as the PermissiblePex is PEX. And it's working!
type: AcceptedAnswer
type: Answer
upvote count: 4
downvote count: 0
accepted answer of: http://stackoverflow.com/q/22699883
score: 4
answers question: http://stackoverflow.com/q/22699883

http://stackoverflow.com/a/22715503
type: Answer
answers question: http://stackoverflow.com/q/22713412
score: 0
has body: Because you are storing fruit names in an array, you can store the array index of the fruit currently being displayed when onSaveInstanceState is called. In onRestoreInstanceState, you can then retrieve the index of the current fruit using getInt (String key, int defaultValue). If you assign -1 to the fruit index variable if no saved instance state exists, and specify it as the default value if none is stored in the saved instance state, you can then either simply generate a new random index if the variable is -1, or assign the correct text to the TextView if it is not. public class MainActivity extends Activity { TextView labelFruit; Button buttonCycle; String[] fruitArray; Random rand = new Random(); int fruitIndex = -1; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); fruitArray = getResources().getStringArray(R.array.fruits); labelFruit = (TextView) findViewById(R.id.text_fruit); buttonCycle = (Button) findViewById(R.id.button_cycle); buttonCycle.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { fruitIndex = rand.nextInt(fruitArray.length); labelFruit.setText(fruitArray[fruitIndex]); } }); } @Override protected void onRestoreInstanceState(Bundle savedInstanceState) { super.onRestoreInstanceState(savedInstanceState); if (savedInstanceState == null) { fruitIndex = -1; } else { fruitIndex = savedInstanceState.getInt("FRUIT_INDEX", -1); } if (fruitIndex == -1) { fruitIndex = rand.nextInt(fruitArray.length); } labelFruit.setText(fruitArray[fruitIndex]); } @Override protected void onSaveInstanceState(Bundle outState) { super.onSaveInstanceState(outState); outState.putInt("FRUIT_INDEX", fruitIndex); } }

http://stackoverflow.com/comment/34644854
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/22729875
has text: @TilwinJoy I have updated complete code. Please help
score: 0

http://stackoverflow.com/a/22670698
has body: With Java 8 you could do something like: return IntStream.iterate(N, i -&gt; i - 1).limit(N).toArray();
answers question: http://stackoverflow.com/q/22670571
type: Answer
score: 0

http://stackoverflow.com/a/22731375
type: Answer
accepted answer of: http://stackoverflow.com/q/22694380
has body: Like this: List&lt;SyndLink&gt; links = entry.getLinks(); for (SyndLink link : links) { System.out.println(link.getType()); }
answers question: http://stackoverflow.com/q/22694380
has comment: http://stackoverflow.com/comment/34883837
has comment: http://stackoverflow.com/comment/34800632
downvote count: 0
score: 1
upvote count: 1
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/34882100
has comment: http://stackoverflow.com/comment/34851566

http://stackoverflow.com/comment/70805161
comment on: http://stackoverflow.com/a/32382708
type: Comment
score: 1
has text: Are you including the aar as flatDir? If so, I would refer you to the following comment: http://stackoverflow.com/questions/25698160/can-an-aar-include-transitive-dependencies#comment68753630_25730092
type: AnswerComment

http://stackoverflow.com/comment/34630733
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/22723121
has text: @user3474146: you use whatever layout works best for you. For example in the code I've posted above, I use a simple FlowLayout.
type: Comment

http://stackoverflow.com/comment/34606409
type: Comment
has text: That makes sense, but shouldn't it be viable to have a static empty array in the class returning null and to return it instead of null? I don't know how the GC behaves in these cases, but my guess is that the static variable would be accessed by reference and wouldn't need to be GC'ed...or am I wrong?
comment on: http://stackoverflow.com/a/22710260
score: 1
type: AnswerComment

http://stackoverflow.com/comment/34534758
type: AnswerComment
has text: how to print log4j's logs in cmd. Full exeuction log should in cmd console
score: 0
type: Comment
comment on: http://stackoverflow.com/a/22657848

http://stackoverflow.com/comment/57503192
score: 0
type: Comment
comment on: http://stackoverflow.com/q/22780051
type: QuestionComment
has text: No, sorry, I was not able to make it work at that time. I ended up brushing aside AspectJ for that project.

http://stackoverflow.com/comment/34524064
score: 0
type: Comment
has text: In the PartDescriptor, should I add the part that I created or the class which creates the part dynamically? What properties of `PartDescriptor` should I configure?
type: AnswerComment
comment on: http://stackoverflow.com/a/22661945

http://stackoverflow.com/comment/34750724
score: 0
has text: What is it doing? What do you want it to do that it's not doing? Can you post a SSCCE?
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/22790686

http://stackoverflow.com/q/22756789
score: 0
answer count: 2
tagged with: xpath
has answer: http://stackoverflow.com/a/22757144
tagged with: selenium-ide
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/22763207
tagged with: java
tagged with: selenium
type: Question
has comment: http://stackoverflow.com/comment/34690019
has body: I have a specific table that is within multiple tables, and does not have any unique ID or Name. I'm looking for a dynamic solution to find a specific text that will surely occur only once in the whole document, and get the WebElement of the link (text = Add) within the same row. The text i'm looking for is in the 1st column, and the link is in the 6th column. Basically i'm looking for a selenium alternate of nextSibling() with a twist that it has to be a link.
has title: Selenium IDE - Find link within the same row of a specific text from table

http://stackoverflow.com/a/22809282
answers question: http://stackoverflow.com/q/22807748
has comment: http://stackoverflow.com/comment/34806843
upvote count: 2
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/34867657
type: Answer
has body: Ah, did not see that one before responding to your other question. The reason that prototype scope should be used, is that Akka will restart actors on failures. If you have singleton scope this might lead to problems. However, Akka will not create new instances of your actor randomly. When you create an actor using actorOf, there will be an actor created each time, but only one actor (unless you use a router of course). So as long as you create your actors correctly you will only have one instance of this actor, and the ActorRef you got back from actorOf will always point to an instance of your actor. When exceptions occur, the actor will be stopped and a new instance is started, the actorRef will still point to that actor.
score: 2
downvote count: 0
has comment: http://stackoverflow.com/comment/104129980
accepted answer of: http://stackoverflow.com/q/22807748
has comment: http://stackoverflow.com/comment/34806358

http://stackoverflow.com/comment/34674767
comment on: http://stackoverflow.com/a/22746825
type: AnswerComment
has text: *Repeat any one for all four images.* Read inline comments for more information about images location.
score: 0
type: Comment

http://stackoverflow.com/q/22795894
tagged with: java
has answer: http://stackoverflow.com/a/22796097
has comment: http://stackoverflow.com/comment/34760350
type: Question
has comment: http://stackoverflow.com/comment/34760203
score: 5
has comment: http://stackoverflow.com/comment/34760148
has comment: http://stackoverflow.com/comment/34760427
upvote count: 5
has body: I have a Question object that has 4 Answer objects inside. In Question.java I have a method that is: public Answer getA() { return a; } and in another method I have: if (questions.get(randomNum).getA().isCorrect()) System.out.println("Correct!"); where Questions is an ArrayList containing my Question objects. This gives me a Cannot resolve method getA() error and I'm not quite sure why. For reference: System.out.println(questions.get(randomNum)); works perfectly fine in printing out the question and the answers. Question.java public class Question { private String questionText; private Answer a, b, c, d; public Question(String questionText, Answer a, Answer b, Answer c, Answer d) { this.questionText = questionText; this.a = a; this.b = b; this.c = c; this.d = d; } public String getQuestionText() { return questionText; } public void setQuestionText(String questionText) { this.questionText = questionText; } public Answer getA() { return a; } public void setA(Answer a) { this.a = a; } public Answer getB() { return b; } public void setB(Answer b) { this.b = b; } public Answer getC() { return c; } public void setC(Answer c) { this.c = c; } public Answer getD() { return d; } public void setD(Answer d) { this.d = d; } public String toString() { return questionText + "\nA) " + a + "\nB) " + b + "\nC) " + c + "\nD) " + d; } } Answer.Java public class Answer { private String answerText; private boolean correct; public Answer(String answerText) { this.answerText = answerText; this.correct = false; } public String getAnswerText() { return answerText; } public void setAnswerText(String answerText) { this.answerText = answerText; } public boolean isCorrect() { return correct; } public void setCorrect() { this.correct = true; } public String toString() { return answerText; } }
has comment: http://stackoverflow.com/comment/34760165
answer count: 1
downvote count: 0
has comment: http://stackoverflow.com/comment/34760227
favorite count: 0
tagged with: compiler-errors
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/34760259
has comment: http://stackoverflow.com/comment/34760476
has title: Cannot resolve method in Java

http://stackoverflow.com/comment/34686207
score: 1
has text: No, certainly not! You don't encrypt text, you encrypt bytes, always. And what those bytes will be when you deal with text will depend on what character encoding the text uses
type: Comment
comment on: http://stackoverflow.com/q/22754788
type: QuestionComment

http://stackoverflow.com/q/22764273
score: -1
type: Question
has comment: http://stackoverflow.com/comment/34703571
has comment: http://stackoverflow.com/comment/34703554
upvote count: 0
favorite count: 0
has answer: http://stackoverflow.com/a/22764341
tagged with: android
answer count: 1
has body: I'm currently working on android project related with database connectivity. As a part of App, there is an activity that form to insert data into database and retrieve the response whether it is inserted or not. Activity inserts data into database properly But, It fires an JSON parsing exception an couldn't get the response. Here is my logcat scrreen: 03-31 09:49:38.196: D/JSON String:(884): Connection Error 03-31 09:49:38.236: D/Parsing Error!(884): Can't parse the stringorg.json.JSONException: Value &lt;br of type java.lang.String cannot be converted to JSONObject 03-31 09:49:38.236: D/Exception!(884): java.lang.NullPointerException 03-31 09:49:38.526: W/InputMethodManagerService(373): Window already focused, ignoring focus gain of: com.android.internal.view.IInputMethodClient$Stub$Proxy@b410d300 attribute=null, token = android.os.BinderProxy@b40b3160 Here is my PHP Database connection script:config.inc.php I think it is faulty!! &lt;?php $username = "homeyadmin"; $password = "8YvUPxCsVHEca2Ru"; $host = "localhost"; $dbname = "homey_db"; //Communicate via UTF8 $options = array(PDO::MYSQL_ATTR_INIT_COMMAND =&gt; 'SET NAMES utf8'); try { //Is this required?? // $db = new PDO("mysql:host={$host};dbname={$dbname};charset=utf8", $username, $password, $options); mysql_connect('localhost','$username','$password') or die("Connection Error"); mysql_select_db($dbname) or die("no db found"); } catch(PDOException $ex) { die("Failed to connect to Database!" +$ex.toString()); } /*header('Content-Type: text/html; charset=utf-8'); session_start();*/ ?&gt; And finally JSONParser class: public JSONObject makeHttpRequest(String url, String method, List&lt;NameValuePair&gt; params) { try { if (method == "POST") { DefaultHttpClient httpClient = new DefaultHttpClient(); HttpPost httpPost = new HttpPost(url); httpPost.setEntity(new UrlEncodedFormEntity(params)); HttpResponse httpResponse = httpClient.execute(httpPost); HttpEntity httpEntity = httpResponse.getEntity(); is = httpEntity.ge…
has comment: http://stackoverflow.com/comment/34703562
accepted answer: http://stackoverflow.com/a/22764341
tagged with: php
downvote count: 1
type: AnsweredQuestion
has title: Parsing error! Can't parse Can't parse the stringorg.json.JSONException: Value <br of type java.lang.String cannot be converted to JSONObject
tagged with: java
tagged with: http://stackoverflow.com/tag/json

http://stackoverflow.com/q/22733322
has comment: http://stackoverflow.com/comment/34648606
answer count: 1
has answer: http://stackoverflow.com/a/29990079
downvote count: 0
favorite count: 0
tagged with: android
upvote count: 1
has comment: http://stackoverflow.com/comment/34648405
accepted answer: http://stackoverflow.com/a/29990079
tagged with: aidl
type: AnsweredQuestion
score: 1
tagged with: java
has title: AIDL file in Android project: strange "package" syntax error
has body: I create Android project with plugins. When I create simple AIDL file, the compilation breaks with strange errors and no interface class is generated. My AIDL file: package com.android.example.tryplugin interface IResPlugin { Bundle onClick( in int id, in int state ); } I have the following errors: syntax error don't know what to do with "package" syntax error don't know what to do with "com.android.example.tryplugin" syntax error don't know what to do with "package" I have also tried all advices from Google like "Try to clean and recompile", "Create new project with these files" etc. What is wrong with it?
type: Question

protected
tags question: http://stackoverflow.com/q/22789838
tag name: protected
tags question: http://stackoverflow.com/q/22808357
tags question: http://stackoverflow.com/q/22729492
type: Tag

http://stackoverflow.com/comment/39730740
type: Comment
has text: possible duplicate of [Loop doesn't see changed value without a print statement](http://stackoverflow.com/questions/25425130/loop-doesnt-see-changed-value-without-a-print-statement)
comment on: http://stackoverflow.com/q/22741878
score: 0
type: QuestionComment

http://stackoverflow.com/q/22734298
favorite count: 0
type: Question
tagged with: android
has body: I am designing a simple Android application (might be ported to iOS in the future) where I want to have real-time communication between multiple devices. The procedure is that one device(creator) makes a "lobby" that have certain ID, using this ID other devices should be able to join this "lobby" and wait for messages from the creator. Then clients connected to the "lobby" should be able to respond to the messages from the creator. The connection should only be active for couple of minutes and no need to store the messages on the server side. I am not sure what methods I should look into to archive this functionality. I have looked at comet, but I am not sure if that is the way to go for this project. Have anyone solved similar problem? And if so how did you do it and what libraries/frameworks did you use?
has comment: http://stackoverflow.com/comment/34653662
score: 0
upvote count: 1
tagged with: web-services
downvote count: 1
has title: Communication Between Multiple devices.
tagged with: java
has comment: http://stackoverflow.com/comment/34649504
answer count: 0
type: UnansweredQuestion

http://stackoverflow.com/comment/35520215
has text: If the Java code of your controller is being displayed, then that sounds like the web server does not support running the Java application. What is the web server hoster?
score: 0
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/22804085

http://stackoverflow.com/a/22801381
has comment: http://stackoverflow.com/comment/34776853
has comment: http://stackoverflow.com/comment/34777678
has comment: http://stackoverflow.com/comment/34778267
has comment: http://stackoverflow.com/comment/34779112
has comment: http://stackoverflow.com/comment/34770806
has comment: http://stackoverflow.com/comment/34778117
upvote count: 9
has body: Try this.. for (int i=0; i &lt; b.length; i++){ for (int j=0; j &lt; a.length(); j++){ if(!(a[j].equals(b[i]))){ //do something for not equals }else{ //do something for equals } } } Or ArrayList&lt;String&gt; A_arraylist = new ArrayList&lt;String&gt;(Arrays.asList(a)); ArrayList&lt;String&gt; B_arraylist = new ArrayList&lt;String&gt;(Arrays.asList(b)); for (int i=0; i &lt; A_arraylist.size(); i++){ if(B_arraylist.contains(A_arraylist.get(i))){ //do something for equals }else{ //do something for not equals int index = B_arraylist.indexOf(A_arraylist.get(i)); B_arraylist.remove(index); } } EDIT: B_arraylist.retainAll(A_arraylist);
has comment: http://stackoverflow.com/comment/34777604
has comment: http://stackoverflow.com/comment/34779315
score: 9
has comment: http://stackoverflow.com/comment/34778367
has comment: http://stackoverflow.com/comment/34778423
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/34778520
has comment: http://stackoverflow.com/comment/34779198
has comment: http://stackoverflow.com/comment/34779567
type: Answer
has comment: http://stackoverflow.com/comment/34779380
has comment: http://stackoverflow.com/comment/34779481
answers question: http://stackoverflow.com/q/22801321
has comment: http://stackoverflow.com/comment/34779002
accepted answer of: http://stackoverflow.com/q/22801321

http://stackoverflow.com/comment/34619564
comment on: http://stackoverflow.com/a/22716840
type: Comment
has text: @alwill: Please see edit to answer. My answer recommendations still apply, and if you use them, will likely solve your problem. I suggest that you try to do this now.
score: 0
type: AnswerComment

http://stackoverflow.com/a/22727543
upvote count: 3
score: 3
answers question: http://stackoverflow.com/q/22727422
accepted answer of: http://stackoverflow.com/q/22727422
type: AcceptedAnswer
downvote count: 0
type: Answer
has body: Arguments specified on the command line are not the same as information entered via standard input at the console. Reading from System.in will let you read input, and this is not related to command line parameters. The problem with your current, non-working code is that while you are checking to see if the argument was specified, you aren't actually using args[0] as the pathname, you're just going on to read user input regardless. Command line parameters are passed in via the String[] parameter to main. In your case it's the first parameter, so it would be in args[0]: public static void main (String[] args) { String pathname; if (args.length &gt; 0) { pathname = args[0]; // from the command line } else { // get pathname from somewhere else, e.g. read from System.in } } Or, more strict: public static void main (String[] args) { String pathname; if (args.length &gt; 1) { System.err.println("Error: Too many command line parameters."); System.exit(1); } else if (args.length &gt; 0) { pathname = args[0]; // from the command line } else { // get pathname from somewhere else, e.g. read from System.in } } Check out the official tutorial on command-line arguments for more information. By the way, I noticed you have this in your if condition: java.lang.Character.isWhitespace(args[0].charAt(0)) Leading and trailing whitespace is automatically trimmed off of unquoted command line parameters, so that will always be false unless the user explicitly uses quotes and does something like: java ClassName " something" And even in that case, you may want to just accept it and use args[0].trim() to be more lenient.
has comment: http://stackoverflow.com/comment/34637618

http://stackoverflow.com/q/22778509
answer count: 4
tagged with: http://stackoverflow.com/tag/zip
has comment: http://stackoverflow.com/comment/68761467
downvote count: 2
possible better answer: http://stackoverflow.com/a/22778579
has answer: http://stackoverflow.com/a/22778579
has comment: http://stackoverflow.com/comment/34729786
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/25504883
upvote count: 3
score: 1
tagged with: java
has answer: http://stackoverflow.com/a/23151755
has title: How to Convert Binary Data to Zip file?
type: Question
linked to: http://stackoverflow.com/q/40757545
has answer: http://stackoverflow.com/a/62473761
has comment: http://stackoverflow.com/comment/34728995
tagged with: binary-data
accepted answer: http://stackoverflow.com/a/25504883
favorite count: 0
has body: Right now I am working on a task to convert binary data in to a zip file I am calling a url and getting a response from server like A@B�ArE⏾�7�ϫ���f�걺N�����Yg���o_M^�D�T�U X_���e?� hi\ � �ڂ(� �0 rm��'�ed���� �:6h�k�ڗ� ���fnp���7��)��:��N�U�viR�,) II����M��Np�M��7�� n�� !A!) )AAFAq)Q)�y y� ��.�����?��� ��֞��ͅ��Ɲ_�O�����nc��f��w��ʰ�6��3 2�ƢZZ��N0� O{� mC� ��$��,>���������� ���CW/)?�?٥��ߗ�d�=�R�J*E{2L���ח�W���ӑ_PRR�_@�_H��:������Ə�Ջ�J�^v�0wo��+�o��� �-Ä@�R6��P�(���0�WPj�k� C�E now I want to save this data to zip file i have searched a lot and find some links but not meet the goal. here i have done OutputStreamWriter osw = new OutputStreamWriter(openFileOutput( "products.zip", Context.MODE_PRIVATE)); osw.write(data); osw.close(); please guid me if you have any idea about this.
has comment: http://stackoverflow.com/comment/68740416
tagged with: android
has comment: http://stackoverflow.com/comment/68753486

http://stackoverflow.com/q/22689831
accepted answer: http://stackoverflow.com/a/22698423
answer count: 1
downvote count: 0
has body: I am using the following Class 'LoggerUtil' for logging to console and to a file 'logfile.log'. The logging to console is working fine. However, logging to 'logfile.log' file stops after few logs. Any suggestions in locating the bug would be welcome. I am attaching the code below: public class LoggerUtil { public static final String LOGGERNAME = "project.logging"; static { try { Logger.getLogger(LOGGERNAME).setUseParentHandlers(false); Handler ch = new ConsoleHandler(); Handler fh = new FileHandler("logfile.log"); SimpleFormatter sf = new SimpleFormatter(); fh.setFormatter(sf); Logger.getLogger(LOGGERNAME).addHandler(ch); Logger.getLogger(LOGGERNAME).addHandler(fh); setHandlersLevel(Level.ALL); } catch (IOException | SecurityException ex) { Logger.getLogger(LoggerUtil.class.getName()).log(Level.SEVERE, null, ex); } } public static void setHandlersLevel(Level level) { Handler[] handlers = Logger.getLogger(LOGGERNAME).getHandlers(); for (Handler h : handlers) { h.setLevel(level); } Logger.getLogger(LOGGERNAME).setLevel(level); } public static Logger getLogger() { return Logger.getLogger(LOGGERNAME); } } I call the following code from various places in my project to log: LoggerUtil.getLogger().log(Level.INFO, "Message to be logged"); Kindly note, my project is multithreaded. Various threads use the same file for logging. Could this be a concurrency issue or is that just a red herring!
favorite count: 0
upvote count: 2
tagged with: logging
score: 2
has answer: http://stackoverflow.com/a/22698423
type: AnsweredQuestion
tagged with: java
tagged with: multithreading
has title: Log File not being updated after few seconds while using Logger and FileHandler Class of Java.util
type: Question

http://stackoverflow.com/comment/34706716
score: 0
type: Comment
has text: @Baz added description for `Date.equals` to avoid confusion
comment on: http://stackoverflow.com/a/22765452
type: AnswerComment

http://stackoverflow.com/q/22780964
downvote count: 0
accepted answer: http://stackoverflow.com/a/22781293
tagged with: junit
answer count: 4
favorite count: 0
has answer: http://stackoverflow.com/a/23374467
has answer: http://stackoverflow.com/a/22782325
score: 6
has answer: http://stackoverflow.com/a/68956661
upvote count: 6
possible better answer: http://stackoverflow.com/a/22782325
tagged with: selenium-webdriver
type: AnsweredQuestion
has body: After much searching and reading, I'm still unclear as to the best way to handle a failed assertion using Webdriver. I would have thought this was a common and core piece of functionality. All I want to do is: look for an element if present - tell me if not present - tell me I want to present the results for a non technical audience, so having it throw 'NoSuchElementExceptions' with a full stack trace is not helpful. I simply want a nice message. My test: @Test public void isMyElementPresent(){ // WebElement myElement driver.findElement(By.cssSelector("#myElement")); if(driver.findElement(By.cssSelector("#myElement"))!=null){ System.out.println("My element was found on the page"); }else{ System.out.println("My Element was not found on the page"); } } I still get a NoSuchElementException thrown when I force a fail. Do I need a try/catch as well? Can I incorporate Junit assertions and/or Hamcrest to generate a more meaningful message without the need for a System.out.println?
has answer: http://stackoverflow.com/a/22781293
tagged with: java
has title: Selenium Webdriver: best practice to handle a NoSuchElementException
linked to: http://stackoverflow.com/q/21511901
type: Question

http://stackoverflow.com/comment/34620167
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/22717867
score: 0
has text: @crychair Check the Javadocs of the `String` class. They are built in methods.

http://stackoverflow.com/a/22749486
score: 1
type: Answer
upvote count: 1
has body: What you've provided doesn't really make sense, but based on the comments I'm guessing the answer you're looking for is something like the following: public void display(List&lt;DetailTom&gt; tomData) { for (DetailTom detail : tomData) { System.out.println(detail.getMk1()); } } I've renamed your class from detailTom to DetailTom as is the convention in Java: Names of class types should be descriptive nouns or noun phrases, not overly long, in mixed case with the first letter of each word capitalized.
accepted answer of: http://stackoverflow.com/q/22749336
has comment: http://stackoverflow.com/comment/34676659
answers question: http://stackoverflow.com/q/22749336
downvote count: 0
has comment: http://stackoverflow.com/comment/34676632
type: AcceptedAnswer

http://stackoverflow.com/q/22721584
tagged with: lucene
has title: source code of Eclipse JDT Core v3.4
score: 0
has comment: http://stackoverflow.com/comment/34628695
has comment: http://stackoverflow.com/comment/34626963
has comment: http://stackoverflow.com/comment/34649431
has comment: http://stackoverflow.com/comment/34651319
has comment: http://stackoverflow.com/comment/34631540
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/34633122
has comment: http://stackoverflow.com/comment/34650688
has comment: http://stackoverflow.com/comment/34631593
answer count: 0
has comment: http://stackoverflow.com/comment/34649511
tagged with: java
tagged with: eclipse
has comment: http://stackoverflow.com/comment/34653857
has comment: http://stackoverflow.com/comment/34650928
type: Question
has body: I need the source code of "Eclipse JDT Core" v3.4 . I tried this link: http://archive.eclipse.org/eclipse/downloads/drops/R-3.4-200806172000/ but it was confusing for me, there are many things which I couldn't distinguish. I also need the source code of "lucene" v 2.4.0 . I tried this link: http://archive.apache.org/dist/lucene/java/ but there were many things called 2.4.0. which one is the source code? Thanks...
has comment: http://stackoverflow.com/comment/34632241
has comment: http://stackoverflow.com/comment/34653498
has comment: http://stackoverflow.com/comment/34628542

http://stackoverflow.com/comment/34736990
has text: What do you mean by "computer has suspended"?
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/22782806

http://stackoverflow.com/a/22676719
score: 1
answers question: http://stackoverflow.com/q/22676071
has body: Your basic code in the ActionListener is overly complicated. Code invoked within a listener executes on the Event Dispatch Thread, so there is no need for the SwingUtilities.invokeLater() for the same reason you don't need the synchronize block. I would place all the code in the SwingWorker. That is, first you should delete the data from the database (since this is the functionality that is most likely to fail). If the deletete completes successfully then I would remove the row from the TableModel. So you could need to "publish" the row that you want to be deleted within the doInBackground() method. Then the code that executes in the process() method of the SwingWorker will automatically run on the EDT. See Tasks That Have Intermediate Results for more information.
downvote count: 0
has comment: http://stackoverflow.com/comment/34547721
type: Answer
upvote count: 1

http://stackoverflow.com/comment/34665882
type: Comment
type: AnswerComment
score: 0
has text: @W.K.S Yes I am trying to follow the MVC.
comment on: http://stackoverflow.com/a/22743707

http://stackoverflow.com/comment/138274365
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/22786841
has text: No it is not correct. HTTP 1.1 defines a ‘keep-alive’ whereby the server expects to receive multiple requests per connection.
score: 0

http://stackoverflow.com/comment/34595182
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/22703560
has text: @steve check in file explorer on this path : **//data/data/<Your-Application-Package-Name>/databases/<your-database-name>** if database is created then it must be there.

http://stackoverflow.com/comment/34496911
type: QuestionComment
has text: I'm not aware of any existing project that will do that for you, but the solution seems straight forward to me. Couldn't you just use a nested looping structure which compares the ids from each list. Then when you have a match, just remove the newValue from List<DogProp> after you copy the value over to List<Dog>.
comment on: http://stackoverflow.com/q/22649050
score: 0
type: Comment

fractions
type: Tag
tag name: fractions
tags question: http://stackoverflow.com/q/22650121

http://stackoverflow.com/q/22693405
tagged with: jsf-2
score: 0
answer count: 1
has title: JSF and Primefaces: sortyBy doesn't work (no arrows visible)
has answer: http://stackoverflow.com/a/22708920
has body: basically I don't know why, but those arrows next to row headers are not showing for "Oseba" column. Here is code where it's not working, where it is working and how it should look like. &lt;p:dataTable emptyMessage="Ni zapisov" id="dataTable" var="cont" value="#{contactsBean.contactDataModel}" paginator="true" rows="20" rowKey="#{cont.idContact}" paginatorPosition="bottom" rowsPerPageTemplate="10,20,30" paginatorTemplate="{CurrentPageReport} {FirstPageLink} {PreviousPageLink} {PageLinks} {NextPageLink} {LastPageLink} {RowsPerPageDropdown}" lazy="true" style="width:100%" sortBy="cont.firstName" sortOrder="ASCENDING" filterDelay="400"&gt; &lt;p:column headerText="Oseba" sortyBy="#{cont.cont.firstName}" filterBy="#{cont.fullName}" filterMatchMode="contains" &gt; &lt;h:outputText value="#{cont.firstName} #{cont.lastName}" /&gt; &lt;/p:column&gt; &lt;p:column headerText="Naslov" sortBy="#{cont.cont.address}" filterBy="#{cont.cont.address}" filterMatchMode="contains" &gt; &lt;h:outputText value="#{cont.address}" /&gt; &lt;/p:column&gt; &lt;p:column headerText="Pošta" sortBy="#{cont.cont.zip.name}" filterBy="#{cont.zipAddress}" filterMatchMode="contains" &gt; &lt;h:outputText value="#{cont.zip.name} #{cont.zip.zipId}" /&gt; &lt;/p:column&gt; &lt;p:column headerText="Telefon" sortBy="#{cont.cont.phoneNum}" filterBy="#{cont.cont.phoneNum}" filterMatchMode="contains" &gt; &lt;h:outputText value="#{cont.phoneNum}" /&gt; &lt;/p:column&gt; &lt;p:column headerText="Email" sortBy="#{cont.cont.EMail}" filterBy="#{cont.cont.EMail}" filterMatchMode="contains" &gt; &lt;h:outputText value="#{cont.EMail}" /&gt; &lt;/p:column&gt; &lt;p:column headerText="Arnes ID" sortBy="#{cont.cont.arnesId}" filterBy="#{cont.cont.arnesId}" filterMatchMode="contains"&gt; &lt;h:outputText value="#{cont.arnesId}" /&gt; &lt;/p:column&gt; &lt;p:column style="width:95px;" &gt; &lt;p:commandButton oncomplete="cDialog.show()" action="#{contactsBean.setSelectedContact(cont)}" icon="ui-icon-search" title="Podro…
type: AnsweredQuestion
tagged with: jsf
tagged with: java
type: Question
accepted answer: http://stackoverflow.com/a/22708920
tagged with: primefaces
has comment: http://stackoverflow.com/comment/34575483

http://stackoverflow.com/q/22738738
has title: My application with Spring Security don't go beyond login page
type: Question
upvote count: 2
answer count: 1
tagged with: spring-security
favorite count: 0
has comment: http://stackoverflow.com/comment/36682969
tagged with: spring
has answer: http://stackoverflow.com/a/22749230
accepted answer: http://stackoverflow.com/a/22749230
tagged with: spring-mvc
has body: I just started a project with uses Spring Security for authentication which uses Java configuration instead XML. That's my class SecurityConfig.java: @Configuration @EnableWebSecurity public class SecurityConfig extends WebSecurityConfigurerAdapter { @Autowired public void configure(AuthenticationManagerBuilder auth) throws Exception { auth .inMemoryAuthentication() .withUser("kleber") .password("123") .roles("USER"); } protected void configure(HttpSecurity http) throws Exception { http .csrf() .disable() .authorizeRequests() .antMatchers("/css/**", "/fonts/**", "/image/**", "/js/**").permitAll() .anyRequest().authenticated() .and() .formLogin() .loginPage("/spring/index").permitAll() .loginProcessingUrl("/spring/login").permitAll() .usernameParameter("login") .passwordParameter("senha") .defaultSuccessUrl("/spring/home") .failureUrl("/spring/erro-login") .and() .logout() .logoutUrl("/spring/logout") .logoutSuccessUrl("/spring/index").permitAll(); } } With this configuration, I can reach the login page, but after I inform my credencials (username and password) the system return to this same login page, despite the username and password informed are correct. All this URLs informed in the class SecurityConfig are mapped in this controller: @Controller @RequestMapping(value="spring") public class SpringController { @RequestMapping(value="index") public ModelAndView index() { ModelAndView mav = new ModelAndView(); mav.setViewName("index"); return mav; } @RequestMapping(value="home") public ModelAndView home() { ModelAndView mav = new ModelAndView(); mav.setViewName("home"); return mav; } @RequestMapping(value="doLogin", method=RequestMethod.POST) public void doLogin(HttpServletRequest request, HttpServletResponse response) { // } @RequestMapping(value="logout") public void logout(HttpServletRequest request, HttpServletResponse response) throws IOException { request.getSession().invalidate(); response.sendRedirect(request.getContextPath()); } } What I am doing wrong? -->…
type: AnsweredQuestion
score: 2
downvote count: 0
tagged with: java

http://stackoverflow.com/comment/34509443
type: AnswerComment
type: Comment
score: 0
has text: Wow! This solution seams to me way to complicated. Why a [VisitorPattern](http://en.wikipedia.org/wiki/Visitor_pattern) for such a simple problem?
comment on: http://stackoverflow.com/a/22656428

http://stackoverflow.com/q/22746108
type: UnansweredQuestion
tagged with: swing
has answer: http://stackoverflow.com/a/46698209
has answer: http://stackoverflow.com/a/22746217
tagged with: fonts
tagged with: java
type: Question
has title: Setting a custom font to a JLabel
score: 0
answer count: 2
tagged with: user-interface
has body: I'm doing a simple Pong game and wanted to add an 8-Bit font but can not figure how. This is the method I used for JLabels: public void drawScore() { player1 = "Player 1"; player2 = "Player 2"; JLabel leftScore = new JLabel(player1); JLabel rightScore = new JLabel(player2); leftScore.setForeground(Color.white); rightScore.setForeground(Color.white); leftScore.setLocation(20, 0); rightScore.setLocation(730, 0); leftScore.setSize(100, 40); rightScore.setSize(100, 40); add(leftScore); add(rightScore); } I tried solutions which I found on here and other web-sites and they didn't work out well either. There is a .TTF file in a folder called 'assets' -which I created- in Java Project Folder named Pong. It would be perfect if the right code not include try and catch blocks.
tagged with: jlabel

http://stackoverflow.com/comment/34693841
type: AnswerComment
has text: There's no reason you *have* to use Spring. You could also write your Web application in assembly language.
comment on: http://stackoverflow.com/a/22758559
type: Comment
score: 0

http://stackoverflow.com/comment/34826614
type: AnswerComment
score: 0
type: Comment
has text: Tien Nguyen didn't indicate if the system has a default config, so it's worth checking that. But you're right that if /bin is included in the config that I mentioned the servlet should work for POST requests.
comment on: http://stackoverflow.com/a/22806297

android-source
tags question: http://stackoverflow.com/q/22750854
tag name: android-source
type: Tag

http://stackoverflow.com/comment/34667119
has text: From the [JavaDoc for `StringTokenizer`](http://docs.oracle.com/javase/7/docs/api/java/util/StringTokenizer.html): _StringTokenizer is a legacy class that is retained for compatibility reasons although its use is discouraged in new code._ Moreover, yours does nothing...
type: Comment
comment on: http://stackoverflow.com/q/22744406
type: QuestionComment
score: 1

http://stackoverflow.com/comment/34623321
type: Comment
has text: do you want to sort your list?
comment on: http://stackoverflow.com/q/22719666
score: 0
type: QuestionComment

ksoap2
type: Tag
tags question: http://stackoverflow.com/q/22680533
tag name: ksoap2

http://stackoverflow.com/comment/34644455
comment on: http://stackoverflow.com/a/22731191
type: Comment
has text: oh sorry i'm wrong, it works fine, thanks very much :D
type: AnswerComment
score: 0

http://stackoverflow.com/comment/34781281
has text: when you do int[] arrayX = new int[20], it will allocate your array with 0s. both arrayX and arrayY will have 0s in them. I haven't looked a way of fixing your problem yet.
score: 0
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/22807607

http://stackoverflow.com/comment/34548040
has text: @Angelo Let's see it then!
score: 0
type: QuestionComment
comment on: http://stackoverflow.com/q/22677825
type: Comment

http://stackoverflow.com/q/22708047
has comment: http://stackoverflow.com/comment/34602347
has answer: http://stackoverflow.com/a/22708116
has body: I'm trying to make a 9 X 9 Sudoku random generated grid but I'm having a problem. Every time I run the program, it always freezes and only displays like more or less 5 rows of random generated numbers. I don't get problems with the 4 X 4 and 6 X 6 grids, only with the 9 X 9. I don't know why it keeps freezing. I hope someone can help me. Here is my code. public class Sudoku9x9 { public static void main(String[] args) { Random rand = new Random(); int[][] sudoku = new int[9][9]; int rnum = 0; for(int a = 0; a &lt; 9; a++) { for(int b = 0; b &lt; 9; b++) { boolean checkWhile = false; while(checkWhile == false) { rnum = rand.nextInt(9) + 1; if(CheckRow(a, b, sudoku, rnum) &amp;&amp; CheckCol(a, b, sudoku, rnum))) { sudoku[a][b] = rnum; checkWhile = true; } } System.out.print(rnum + " "); } System.out.println(""); } for(int a = 0; a &lt; 9; a++) { for(int b = 0; b &lt; 9; b++) { System.out.print(sudoku[a][b] + " "); } System.out.println(""); } } public static boolean CheckRow(int a, int b, int[][] sudoku, int rnum) { boolean check = true; for(int c = b; c &gt; 0; c--) { if(sudoku[a][c - 1] == rnum) { check = false; } } return check; } public static boolean CheckCol(int a, int b, int[][] sudoku, int rnum) { boolean check1 = true; for(int c = a; c &gt; 0; c--) { if(sudoku[c - 1][b] == rnum) { check1 = false; } } return check1; } }
tagged with: freeze
tagged with: sudoku
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/34602077
has title: For loop freezes my program
has answer: http://stackoverflow.com/a/22708426
tagged with: java
has comment: http://stackoverflow.com/comment/34602425
accepted answer: http://stackoverflow.com/a/22708426
has comment: http://stackoverflow.com/comment/34602092
type: Question
answer count: 2
tagged with: for-loop
possible better answer: http://stackoverflow.com/a/22708116
has comment: http://stackoverflow.com/comment/34602237
score: 0
has comment: http://stackoverflow.com/comment/34602451

http://stackoverflow.com/comment/34657695
type: QuestionComment
comment on: http://stackoverflow.com/q/22738820
score: 0
has text: yeah i see what you mean Jared. Now it makes sense why almost every example of linked list implementation involved a constructor with "No link-field parameters." I think by me changing my constructor up and setting my pointers to null like you said will make this less complicated for the simple structure that it is
type: Comment

http://stackoverflow.com/q/22749162
accepted answer: http://stackoverflow.com/a/22749515
has answer: http://stackoverflow.com/a/22749500
downvote count: 0
favorite count: 0
has answer: http://stackoverflow.com/a/22749383
tagged with: multithreading
type: AnsweredQuestion
possible better answer: http://stackoverflow.com/a/22749248
score: 1
has answer: http://stackoverflow.com/a/22749502
tagged with: java
has answer: http://stackoverflow.com/a/22749248
has body: Static method and variable: public class Singleton{ private static Singleton singleton = null; private Singleton(){ } public static synchronized Singleton getInstance(){ if(singletion == null) singleton = new Singletion(); return singleton; } } Second after Java 1.5 public class Singleton{ private static volatile Singleton singleton = null; private Singleton(){ } public static Singleton getInstance(){ if(singleton == null){ synchronized(this){ if(singleton == null){ singleton = new Singleton(); } } } return singleton; } } So what's the pros and cons for these two thread safe code and when should we use which?
upvote count: 1
has title: Two way of implementing singleton with thread safe lazy initialization
type: Question
has answer: http://stackoverflow.com/a/22749515
answer count: 6
has answer: http://stackoverflow.com/a/22749226

http://stackoverflow.com/comment/34582310
score: 1
type: AnswerComment
type: Comment
has text: If it helped you then mark it as answer so that it can also help others who will face same problem.
comment on: http://stackoverflow.com/a/22689402

http://stackoverflow.com/comment/34585659
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/22698501
has text: @MarcoAcierno & others: please see my edited question, I hope it's clearer now. It's really not private, it's just hidden API, as many things in Android are (hotspot comes to my mind).

http://stackoverflow.com/comment/34548935
type: Comment
type: QuestionComment
has text: Java introduced Future, see its tutorial
comment on: http://stackoverflow.com/q/22678556
score: 0

http://stackoverflow.com/q/22703648
tagged with: unicode
accepted answer: http://stackoverflow.com/a/22708584
favorite count: 0
score: 3
type: AnsweredQuestion
upvote count: 3
type: Question
tagged with: notepad++
has title: How do I find (Unicode: 0x1) using notepad++ (unicode to char range)
tagged with: java
tagged with: character-encoding
has answer: http://stackoverflow.com/a/22708584
has body: I keep getting this exception in the logs Parsing error, line 1230, uri null An invalid XML character (Unicode: 0x1) sadly I don't have access to the actual xml and the entire xml is printed in a single line as part of the stackchase how do I use notepad++ to search for Unicode 0x1 ? I read that one can search using notepad++ character range. and 0x1 can be convert to char range. Can someone explain to me how to conver it?
downvote count: 0
answer count: 1

http://stackoverflow.com/comment/34758742
type: QuestionComment
comment on: http://stackoverflow.com/q/22794924
has text: https://android.googlesource.com/platform/frameworks/native/+/jb-mr0-release/libs/utils/String8.cpp
score: 0
type: Comment

http://stackoverflow.com/comment/34757965
score: 2
type: AnswerComment
comment on: http://stackoverflow.com/a/22793997
type: Comment
has text: The "reason" (conjecture by me) why they chose immutable is that James Gosling wanted to avoid the common pitfalls of mutable types. Everything that came from the decision is a bonus/side effect.

http://stackoverflow.com/a/22805536
score: 0
answers question: http://stackoverflow.com/q/22805332
has body: You have to add the internet permission to you manifiest file: &lt;uses-permission android:name="android.permission.INTERNET" /&gt; And also Android wont let you do http connections in the main thread, for more info look up: http://developer.android.com/reference/android/os/AsyncTask.html
type: Answer

http://stackoverflow.com/comment/34694992
comment on: http://stackoverflow.com/a/22759136
type: Comment
has text: yes i know, just checked - nimbus was introduced in java 6
score: 0
type: AnswerComment

http://stackoverflow.com/comment/34564192
type: Comment
comment on: http://stackoverflow.com/q/22687504
has text: Try running your test in debug mode and step through your code to see where it goes wrong.
score: 0
type: QuestionComment

http://stackoverflow.com/q/22689261
has answer: http://stackoverflow.com/a/22696578
answer count: 1
has body: I have a scheduled task in Spring which executes every 24 hours which I can also trigger as an asychronous task at any point. When it fires, I get the following exception. org.exampletest.toa.data.error.DataAccessException: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'scopedTarget.interceptor': 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. at org.exampletest.toa.data.pool.implementations.UserService.getObjectFromOriginalDataSource(UserService.java:60) ~[helpsteps-core-1.0.2-SNAPSHOT.jar:na] at org.exampletest.toa.data.pool.implementations.UserService.getObjectFromOriginalDataSource(UserService.java:28) ~[helpsteps-core-1.0.2-SNAPSHOT.jar:na] at org.exampletest.toa.data.pool.ObjectPool.getObjectFromDataSource(ObjectPool.java:241) ~[helpsteps-core-1.0.2-SNAPSHOT.jar:na] at org.exampletest.toa.data.pool.ObjectPool.getCopy(ObjectPool.java:133) ~[helpsteps-core-1.0.2-SNAPSHOT.jar:na] at org.exampletest.toa.data.pool.implementations.UserService.getCopy(UserService.java:82) ~[helpsteps-core-1.0.2-SNAPSHOT.jar:na] at org.exampletest.toa.messaging.dispatch.MessageDispatcher.dispatch(MessageDispatcher.java:162) ~[helpsteps-core-1.0.2-SNAPSHOT.jar:na] at org.exampletest.toa.messaging.dispatch.MessageDispatcher.dispatchNightly(MessageDispatcher.java:82) ~[helpsteps-core-1.0.2-SNAPSHOT.jar:na] ... Caused by: org.springframework.beans.factory.BeanCreationException…
tagged with: spring
has title: Spring Circular Reference injection issues
type: AnsweredQuestion
tagged with: java
type: Question
accepted answer: http://stackoverflow.com/a/22696578
score: 0

http://stackoverflow.com/a/29851727
has body: For Android Studio 1.1.0, after right-clicking on the project: Select Open Module Settings Select SDK Location at top left Type text into JDK Location: box
upvote count: 3
answers question: http://stackoverflow.com/q/22749200
score: 3
downvote count: 0
type: Answer

http://stackoverflow.com/comment/34720194
has text: Hi. Asking people to spot errors in your code is not especially productive. You should use the debugger (or add print statements) to isolate the problem, by tracing the progress of your program, and comparing it to what you expect to happen. As soon as the two diverge, then you've found your problem. (And then if necessary, you should construct a [minimal test-case](http://sscce.org).)
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/22772724

http://stackoverflow.com/comment/58669405
comment on: http://stackoverflow.com/q/22793006
has text: @assylias I am voting to reopen this question because I don't think it is an exact duplicate of the linked question. The poster of the linked question wanted to get access to the index in the middle of stream processing, while the focus of this question is just to get the index in the (terminal) `forEach` method (basically to replace the traditional for loop in which index is manipulated manually). I think that we should not prevent more answers to be added here. Actually I would like to contribute with an answer which is suitable to this question, but not to the linked question.
score: 4
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/42550519
type: AnswerComment
comment on: http://stackoverflow.com/a/22743298
score: 1
type: Comment
has text: Didn't expect a comment on this after so long on this particular one, especially since the org. asker seems to have abandoned it (shame on you, Anass) but yeah, more info [here](http://lapo.it/asn1js/#A11B4F0CA000000077020805044944015007434E492D43534551021001)

http://stackoverflow.com/comment/34782345
has text: @NielsBechNielsen We are implementing an off-heap cache.
type: QuestionComment
comment on: http://stackoverflow.com/q/22807573
score: 0
type: Comment

http://stackoverflow.com/a/22782382
has body: Change your listview's id to @android:id/list So use this <?xml version="1.0" encoding="UTF-8"?> instead of <?xml version="1.0" encoding="UTF-8"?>
type: Answer
has comment: http://stackoverflow.com/comment/34735674
answers question: http://stackoverflow.com/q/22782347
score: 0
has comment: http://stackoverflow.com/comment/34735731

http://stackoverflow.com/comment/34756901
comment on: http://stackoverflow.com/q/22793315
score: 0
type: Comment
type: QuestionComment
has text: @JBNizet One last question then, hypothetical. If the Dates were originally saved as systemDefault() instead of UTC, then I should be using systemDefault() everywhere right?

http://stackoverflow.com/comment/34602359
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/22707936
has text: you probably meant `a` to be `String[]` - not `String`
score: 1

http://stackoverflow.com/comment/34769468
has text: Awesome Makoto I appreciate it
type: Comment
comment on: http://stackoverflow.com/a/22800955
score: 0
type: AnswerComment

rest
tags question: http://stackoverflow.com/q/22729740
tags question: http://stackoverflow.com/q/22652857
tags question: http://stackoverflow.com/q/22783935
tags question: http://stackoverflow.com/q/22761909
tags question: http://stackoverflow.com/q/22770261
tags question: http://stackoverflow.com/q/22662609
tags question: http://stackoverflow.com/q/22709822
tags question: http://stackoverflow.com/q/22698231
tags question: http://stackoverflow.com/q/22694602
tags question: http://stackoverflow.com/q/22758642
tags question: http://stackoverflow.com/q/22736688
tags question: http://stackoverflow.com/q/22736918
tags question: http://stackoverflow.com/q/22768655
tags question: http://stackoverflow.com/q/22669770
tags question: http://stackoverflow.com/q/22683007
tags question: http://stackoverflow.com/q/22649309
tags question: http://stackoverflow.com/q/22762071
tags question: http://stackoverflow.com/q/22782619
tags question: http://stackoverflow.com/q/22709891
tags question: http://stackoverflow.com/q/22682118
tags question: http://stackoverflow.com/q/22717171
tags question: http://stackoverflow.com/q/22705710
type: Tag
tags question: http://stackoverflow.com/q/22680376
tags question: http://stackoverflow.com/q/22775584
tags question: http://stackoverflow.com/q/22658330
tags question: http://stackoverflow.com/q/22657762
tags question: http://stackoverflow.com/q/22763813
tags question: http://stackoverflow.com/q/22672664
tags question: http://stackoverflow.com/q/22678588
tags question: http://stackoverflow.com/q/22691971
tags question: http://stackoverflow.com/q/22794945
tags question: http://stackoverflow.com/q/22713938
tags question: http://stackoverflow.com/q/22666009
tags question: http://stackoverflow.com/q/22674101
tag name: rest
tags question: http://stackoverflow.com/q/22740240
tags question: http://stackoverflow.com/q/22719799
tags question: http://stackoverflow.com/q/22772113
tags question: http://stackoverflow.com/q/22659012

http://stackoverflow.com/comment/34700392
type: Comment
score: 0
has text: I just create a new database from scratch with owner 'klebermo', with the same table from my previous one (who was created with owner 'postgres' and after changed to 'klebermo'), and still don't work
type: AnswerComment
comment on: http://stackoverflow.com/a/22761303

http://stackoverflow.com/a/66511510
accepted answer of: http://stackoverflow.com/q/22752240
downvote count: 0
answers question: http://stackoverflow.com/q/22752240
upvote count: 4
has body: I put Toolkit.getDefaultToolkit().sync(); in my render method which appears to fix it. However you should put only if it's Linux I used the code bellow to do that public static String getOsName() { String OS = null; if(OS == null) { OS = System.getProperty("os.name"); } return OS; } public static boolean isUnix() { return getOsName().startsWith("Linux"); }
type: AcceptedAnswer
score: 4
type: Answer

http://stackoverflow.com/comment/34686180
has text: The above example is just for understanding that two objects in real case scenarios can have same hashcode and are equal. So how can we retrieve the value of individual objects ? Is that possible ?
score: 0
comment on: http://stackoverflow.com/q/22754299
type: Comment
type: QuestionComment

http://stackoverflow.com/a/22691504
answers question: http://stackoverflow.com/q/22688127
has comment: http://stackoverflow.com/comment/34606042
accepted answer of: http://stackoverflow.com/q/22688127
has body: Possible causes are Selenium Server Standalone is NOT started on the remote machine Selenium Server Standalone is started BUT inside code wrong IP address is written Follow the steps written below in order to get things work: 1) Download Selenium Server Standalone JAR file : http://selenium-release.storage.googleapis.com/2.40/selenium-server-standalone-2.40.0.jar in the remote machine (IP address of remote machine let say: 192.168.10.100) 2) From remote machine, run the following command to start Server Standalone: java -jar selenium-server-standalone-2.40.0.jar 3) Ensure IEDriverServer path is also set in that machine. Information is avialble here: https://code.google.com/p/selenium/wiki/InternetExplorerDriver 4) After all the above setting done write following sample code to open IE in remote machine: public class IERemoteWebDriver { public static void main(String[] args) throws IOException { // Assuming Remote machine IP address '192.168.10.100' String remote_address = "http://192.168.10.100:4444/wd/hub"; URL remote_url = new URL(remote_address); DesiredCapabilities dc = DesiredCapabilities.internetExplorer(); WebDriver wbdv = new RemoteWebDriver(remote_url, dc); wbdv.navigate().to("https://www.google.com/"); } } This should work!
score: 0
type: AcceptedAnswer
type: Answer
has comment: http://stackoverflow.com/comment/34607726

http://stackoverflow.com/comment/34511957
has text: Also more info here: http://stackoverflow.com/questions/12070942/whats-the-point-of-using-labeled-statements-in-java
comment on: http://stackoverflow.com/q/22657783
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/34680852
type: Comment
type: AnswerComment
has text: Can you tell me how to use ArgumentCaptor in this scenario. Here I am using a list. Also if privateMethod() is called multiple times, what should be the verify value?
comment on: http://stackoverflow.com/a/22751597
score: 0

http://stackoverflow.com/comment/34531210
type: Comment
type: QuestionComment
has text: Ah oversight on desktop part!
comment on: http://stackoverflow.com/q/22664097
score: 0

http://stackoverflow.com/a/22798452
has comment: http://stackoverflow.com/comment/102456902
accepted answer of: http://stackoverflow.com/q/22787585
answers question: http://stackoverflow.com/q/22787585
type: AcceptedAnswer
downvote count: 0
has body: For general object types (String included) Retrofit is going to use its Converter to serialize the value. In this case, Gson is used by default to serialize the body as JSON. In order to upload Base64-encoded data you want to use TypedInput. This tells Retrofit that you will pass it the raw body which is already serialized and an associated Content-Type value. @PUT("/PhotoService/{PROPERTYID}/{WATERMARK}") String uploadPhoto( @Body TypedInput photo, @Path("PROPERTYID") String propertyId, @Path("WATERMARK") String watermark); I'm going to assume that b is a byte[] in your above example. Here I'm using an existing implementation of TypedInput: TypedByteArray TypedInput body = new TypedByteArray("application/x-www-form-urlencoded", b); service.uploadPhoto(body, "...", "...");
type: Answer
has comment: http://stackoverflow.com/comment/94044900
score: 24
upvote count: 24

http://stackoverflow.com/a/22732917
score: 0
has body: Your code : if(name[i].equals(name1)) Try This : if(name[i].equalsIgnoreCase(name1))
type: Answer
answers question: http://stackoverflow.com/q/22732808

http://stackoverflow.com/q/22683007
tagged with: spring-security
has body: I have some JAX-RS *RESTfull* application with Spring(JDBC,injections and AOP). I am trying to configure my application with Spring Security (authorization/authentication and users management). Have you any examples with good explanations how to config Spring Security with JAX-RS? Sorry for my poor english... Thanks.
score: 0
has title: spring security configuration for jax-rs RESTfull services
tagged with: rest
type: UnansweredQuestion
tagged with: web-services
tagged with: spring
type: Question
has answer: http://stackoverflow.com/a/22683204
tagged with: java
answer count: 1

http://stackoverflow.com/comment/34636728
type: Comment
has text: So...what's an `EventFactory`? It looks like you're trying to use one before it's defined...
comment on: http://stackoverflow.com/q/22726946
score: 0
type: QuestionComment

http://stackoverflow.com/comment/34706788
has text: java.net.SocketException: Connection reset by peer: socket write error at java.net.SocketOutputStream.socketWrite0(Native Method) at java.net.SocketOutputStream.socketWrite(Unknown Source) at java.net.SocketOutputStream.write(Unknown Source) at tcp.ServerSock.main(ServerSock.java:46)
type: Comment
comment on: http://stackoverflow.com/q/22766084
score: 0
type: QuestionComment

http://stackoverflow.com/q/22660173
has body: I am doing a POC with following requirement: I have two tables A and B in a database having same columns and column types. I am running the following query to get the differences between the two table viz. same key, different columns or row existing in one but not in another: SELECT MIN(TableName) as TableName, ID, COL1, COL2, COL3 ... FROM ( SELECT 'Table A' as TableName, A.ID, A.COL1, A.COL2, A.COL3, ... FROM A UNION ALL SELECT 'Table B' as TableName, B.ID, B.COL1, B.COl2, B.COL3, ... FROM B ) as tmp GROUP BY ID, COL1, COL2, COL3 ... HAVING COUNT(*) = 1 ORDER BY ID Once I get the difference rows in Java collection, I want to output them as a report. However, the requirement is that the output format should be configurable. For e.g. if the requirement is to generate PDF, output should be PDF. If the requirement is XLS, the output should be XLS. Now, I am exploring the possibility of generating a single JRXML file and compiling the same JRXML into a PDF or a XLS. Is it possible ? Can anyone please point me to a example where same JRXML is compiled into multiple output formats. Thanks for reading!
favorite count: 0
has answer: http://stackoverflow.com/a/22661274
has comment: http://stackoverflow.com/comment/34586343
has comment: http://stackoverflow.com/comment/34690721
has comment: http://stackoverflow.com/comment/34690686
possible better answer: http://stackoverflow.com/a/22684363
upvote count: 2
has answer: http://stackoverflow.com/a/22684363
downvote count: 1
accepted answer: http://stackoverflow.com/a/22661274
type: Question
type: AnsweredQuestion
score: 1
tagged with: java
has comment: http://stackoverflow.com/comment/34557166
has title: Jasper : Compiling same jrxml file into multiple output formats
tagged with: jasper-reports
answer count: 3
has answer: http://stackoverflow.com/a/22708813

onclicklistener
tag name: onclicklistener
tags question: http://stackoverflow.com/q/22699188
tags question: http://stackoverflow.com/q/22677169
tags question: http://stackoverflow.com/q/22793305
tags question: http://stackoverflow.com/q/22756968
tags question: http://stackoverflow.com/q/22737853
type: Tag
tags question: http://stackoverflow.com/q/22701266
tags question: http://stackoverflow.com/q/22720108

http://stackoverflow.com/a/22777058
downvote count: 0
answers question: http://stackoverflow.com/q/22776941
type: Answer
score: 1
has body: Go to window-&gt;Preferences-&gt;java-compiler Change compiler compliance level: to 1.7,1.6 etc which is compatible with report.
upvote count: 1

http://stackoverflow.com/q/22767573
type: Question
has comment: http://stackoverflow.com/comment/34709442
has comment: http://stackoverflow.com/comment/34709507
score: 0
tagged with: java
tagged with: hibernate
has answer: http://stackoverflow.com/a/22775091
answer count: 1
type: UnansweredQuestion
tagged with: dropwizard
has title: Class is not populated when extends from an abstract in Dropwizard
tagged with: persistence
has body: HI I have two classes in java, I'm using dropwizard framework. My class is extending from an abstract class, but the properties that are in the abstract class are not being populated. public abstract class Person(){ @Column( name = "name" ) protected String name; @Column( name = "lastname" ) protected String lastName; public void setName(String name){ this.name = name } public String getName(){ return this.name; } public void setLastName( String lastName ){ this.lastName = lastName; } public String getLastName(){ return this.lastName; } } And Here is my class @Entity @Table(name = "users" ) public class User extends Person(){ @Id @GeneratedValue( strategy = GenerationType.IDENTITY ) @Column( name = "idUser" ) protected Long Id; @Column( name = "username" ) protected String userName; @Column( name = "password" ) protected String password; public void setUserName( String userName){ this.userName = userName; } public String getUserName(){ return this.userName; } public void setPassword(String password){ this.password = password; } public String getPassword(){ return this.password; } } When I try to populate the class only populate the properties that are contained in User class the properties of Person are null. This is my DAO public class UsersDao extends AbstractDAO&lt;User&gt;{ @Inject public UsersDao(SessionFactory sessionFactory){ super(sessionFactory); } public List&lt;User&gt; fetchUsers(){ return list(criteria()); } } Any suggestion?

http://stackoverflow.com/q/22789218
score: 0
answer count: 2
has title: What is the Hibernate equivalent to this MySQL query?
has answer: http://stackoverflow.com/a/22789500
has answer: http://stackoverflow.com/a/22789485
favorite count: 0
possible better answer: http://stackoverflow.com/a/22789500
accepted answer: http://stackoverflow.com/a/22789485
linked to: http://stackoverflow.com/q/4450844
type: AnsweredQuestion
tagged with: java
tagged with: hibernate
tagged with: mysql
upvote count: 1
has body: There are two Models: Page &amp; Tag. One Page can have many Tags. Page: public class Page { @Id @GeneratedValue @Column(name="page_id") private Integer id; // TAGS @OneToMany(orphanRemoval=true, mappedBy="pageId", cascade = CascadeType.ALL, fetch = FetchType.EAGER) private Set&lt;Tag&gt; tag = new HashSet&lt;Tag&gt;(); } Tag: public class Tag { // GENERIC FIELDS @Id @GeneratedValue private Integer id; @Index(name = "tag") @Column private String tag; @ManyToOne(cascade = CascadeType.ALL, fetch = FetchType.EAGER) @JoinColumn(name="page_id") private Page pageId; } The task is now to select all Pages which have a specific Tag. With plain MySQL I would do (which works fine): SELECT * from Page join Tag on Page.page_id = Tag.page_id where Tag.tag = 'sport' But Hibernate complains if I do it like that: List&lt;Page&gt; pageList = (List&lt;Page&gt;) session.createQuery("from Page join Tag on Page.page_id = Tag.page_id where Tag.tag = 'sport'").list(); // ERROR: [QuerySyntaxException: unexpected token: on near line 1, column 27 [from models.Page join Tag on Page.page_id = Tag.page_id where tag = 'sport']] When I delete the "unexpected token" then Hibernate complains again: List&lt;Page&gt; pageList = (List&lt;Page&gt;) session.createQuery("from Page join Tag where tag = 'sport'").list(); [TypeMismatchException: left and right hand sides of a binary logic operator were incompatibile [java.util.Set(models.Page.tag) : string]] Problem with the second approach seems to be, that Page.tag is a Set and Hibernate seems unable to create it with the result from that query. So how can I solve this? Is there something wrong with the query or is there a way to solve the TypeMismatchException? BONUS QUESTION: I found the following solution which somehow works.. a lil bit at least: List&lt;Page&gt; pageList = (List&lt;Page&gt;) session.createQuery("from Page where id in (from Tag where tag = 'sport')").list(); It works.. but it only delivers half of the Pages which have the Tag "sport". C…
downvote count: 1
type: Question

http://stackoverflow.com/q/22715232
tagged with: file
type: Question
tagged with: encoding
has title: Reading files with invalid encoding in filename
has body: I have this code: File dir = new File("/home/user/somedir"); for (File child : dir.listFiles()) { System.out.println(child.getName()); if(!child.isDirectory()){ readLines(child.getPath()); //do something with this file } } And i get this output: cestino arabika wkurwi�%87_si�%99 java.io.FileNotFoundException: /home/user/somedir/wkurwi�%87_si�%99 (No such file or directory) child.renameTo() also doesn't work. new FileReader(child) instead of child.getPath() doesn't work too: java.io.FileNotFoundException: /home/user/somedir/wkurwi�%87_si�%99 (No such file or directory) at java.io.FileInputStream.open(Native Method) at java.io.FileInputStream.&lt;init&gt;(FileInputStream.java:138) at java.io.FileReader.&lt;init&gt;(FileReader.java:72) I know if I manually change file name then file can be easliy read. But why this file is listed by listFiles method but i can't read file using this name? Is there any solution? I have a lot of this files with wrong encoding so I cant change all names manually :) But if there is some automatic method to change their names, even file1, file2 is good.
score: 2
downvote count: 0
has comment: http://stackoverflow.com/comment/34616321
favorite count: 0
upvote count: 2
linked to: http://stackoverflow.com/q/1545625
type: UnansweredQuestion
duplicate of: http://stackoverflow.com/q/1545625
has comment: http://stackoverflow.com/comment/34616056
answer count: 0
tagged with: java

http://stackoverflow.com/a/22799046
has comment: http://stackoverflow.com/comment/34912967
downvote count: 1
answers question: http://stackoverflow.com/q/22795931
score: 2
has comment: http://stackoverflow.com/comment/34811510
has comment: http://stackoverflow.com/comment/34850486
has comment: http://stackoverflow.com/comment/34893503
type: Answer
has comment: http://stackoverflow.com/comment/34912882
has body: You need to update the value you have in your dispercher-servlet.xml Use the following value for session context. thread thread is short for org.hibernate.context.internal.ThreadLocalSessionContext Please check this link for more detailed information. http://docs.jboss.org/hibernate/orm/4.1/manual/en-US/html_single/#architecture-current-session
has comment: http://stackoverflow.com/comment/34893785
upvote count: 3
has comment: http://stackoverflow.com/comment/34858800
has comment: http://stackoverflow.com/comment/34912918

http://stackoverflow.com/comment/34741513
type: Comment
has text: This logic is potentially wrong if the list of dates passed in is not sorted. (nevermind.. see comments below)
type: QuestionComment
score: 1
comment on: http://stackoverflow.com/q/22785597

http://stackoverflow.com/comment/34562713
type: QuestionComment
has text: I have downloaded the libstemmer_java from the site you have provided but I dont know how to add it in the NetBeans in libraries.It isn't a jar file.Please tell me how to add it in the libraries in NetBeans.
score: 0
comment on: http://stackoverflow.com/q/22681798
type: Comment

http://stackoverflow.com/a/22755729
upvote count: 6
has body: This doesn't have to be a threading problem. Look at the sequence of calls again: // check that the list has at least 1 element if (ISTA.size() &gt; 0) { // remove 1 element LISTA.remove(0); // list might have 0 elements at this point LISTA.get(0); } Here you check that the list has at least 1 element, then remove an element, then try to retrieve another. This will throw an exception if the list's size was 1. That's assuming that ISTA/LIST/LISTA are all the same thing and those are just typos. (Otherwise, if they are different, then you are checking the size of the wrong list...) The snippet is too small to tell what the right way to fix it is and it should frankly be trivial for you to solve. You either need to: Check that the list has at least 2 things in it before accessing those 2 things. Check that the has at least 1 thing and only access 1 thing.
answers question: http://stackoverflow.com/q/22755667
downvote count: 0
score: 6
type: Answer

http://stackoverflow.com/a/22973052
accepted answer of: http://stackoverflow.com/q/22655567
type: AcceptedAnswer
type: Answer
upvote count: 2
score: 1
downvote count: 1
has body: The short answer is 'no'. The details are going to be vendor specific. You could do an snmpwalk of multiple different printers and compare the data to see if there is any common attributes you wanted to report on. Each printer should have a printer specific MIB that will list all the details that you can query on the printer - so rather that starting with specific MIB values, if you scanned the MIB and searched for the interesting values you could find the right OID to poll for each platform. At the start you could poll for the sysDescr mib entry, and determine if the device is a brother/epson/canon/hp printer etc.
answers question: http://stackoverflow.com/q/22655567

http://stackoverflow.com/comment/39326720
comment on: http://stackoverflow.com/q/22755953
score: 0
type: Comment
type: QuestionComment
has text: An SO question that has slipped my research and answers my question exactly is [here](http://stackoverflow.com/questions/15799487/parallel-image-detection-and-camera-preview-opencv-android).

http://stackoverflow.com/comment/34758815
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/22794924
has text: Uh, OK, doesn't tell much; in the meanwhile [this](http://fgaliegue.blogspot.fr/2014/03/strings-characters-bytes-and-character.html) may help you for understanding the Java side of things

http://stackoverflow.com/q/22737974
has title: Java Swing adding images code in MigLayout does not seem to be working?
tagged with: java
tagged with: image
possible better answer: http://stackoverflow.com/a/44272712
answer count: 2
downvote count: 0
accepted answer: http://stackoverflow.com/a/22737993
favorite count: 0
has body: So I have my own custom JFrame, and in it I am trying to create an auto-resizing image to be contained in my JFrame's content JPanel, frameContent. My layout manager for the JPanel is MigLayout, so I figured I would create a child of JPanel again, called ImagePanel. Here is what my ImagePanel class ended up looking like: class ImagePanel extends JPanel{ private static final long serialVersionUID = -5602032021645365870L; private BufferedImage image; public ImagePanel() { try { image = ImageIO.read(new File(getClass().getResource("../res/Title.png").toURI())); } catch (Exception e) { e.printStackTrace(); } } @Override protected void paintComponent(Graphics g) { super.paintComponent(g); g.drawImage(image, getWidth(), getHeight(), null); } } Now for some reason it doesn't seem like it's actually 'working'. When I am setting up my main JFrame's content, I call: framecontent.add(new ImagePanel(), "pos 5% 5% 95% 45%"); It's not that it's not adding the component, as with this code I'm able to get the following screen: Notice how it outlines the area against the gray background, meaning the paintComponent(g) method is being run, and the program also isn't outputting any errors, which is strange, so that means it is finding my image, just not placing it. Here is what my file hierarchy looks like: Project Folder &gt; src &gt; res &gt; Title.png (Picture I want to retrieve) guiwork &gt; Working.class (Class that is running instructions/ main) Got it all fixed up, here is the auto-resizing result:
upvote count: 3
tagged with: swing
has answer: http://stackoverflow.com/a/22737993
tagged with: javax.imageio
type: Question
tagged with: miglayout
type: AnsweredQuestion
score: 3
has answer: http://stackoverflow.com/a/44272712

http://stackoverflow.com/a/22726104
score: 1
answers question: http://stackoverflow.com/q/22658385
upvote count: 1
type: Answer
downvote count: 0
has body: If you do not override the public boolean equals(Object) method, the version in Object.class will be called: public boolean equals(Object obj) { return (this == obj); } Just compare the references(If they are exactly the same object)! So, you have to implement your own equals(Object) in the School.class. Compare these fields: private String name; // use String.equals(String) private int id; // use == private boolean isOpen; // use ==

http://stackoverflow.com/comment/34518338
type: AnswerComment
comment on: http://stackoverflow.com/a/22651390
has text: Good.No Problem.GladToHelpYou. :)
type: Comment
score: 0

libvirt
tag name: libvirt
tags question: http://stackoverflow.com/q/22762025
type: Tag

http://stackoverflow.com/comment/34659994
type: Comment
comment on: http://stackoverflow.com/a/22731400
has text: [exec] java.lang.NoSuchMethodError: org.codehaus.groovy.ast.ModuleNode.addImportPackage(Ljava/lang/String;)[Ljava/lang/String;
score: 0
type: AnswerComment

http://stackoverflow.com/comment/34608661
score: 0
comment on: http://stackoverflow.com/a/22710948
type: AnswerComment
type: Comment
has text: Are you positive you would write it that way in Python? Quite apart from the pirate rr: `import calendar` `calendar.isleap(yearr)`

http://stackoverflow.com/comment/34509574
comment on: http://stackoverflow.com/q/22656237
score: 0
has text: @JGeo But that's a very "web" related thing. If we're talking about a stand alone application with no web interface then you still have to rebuild the GUI Scene and render the image again -- so what you say may apply there.
type: QuestionComment
type: Comment

http://stackoverflow.com/comment/34648124
type: Comment
comment on: http://stackoverflow.com/a/22732770
score: 0
has text: @Craig Otis That first approach you suggest isn't acceptable, it's best case comp. complexity is o(n^2) and worst case it will actually never finish executing.
type: AnswerComment

http://stackoverflow.com/comment/34709296
score: 0
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/22722399
has text: @CodeChimp Thank you. How do I do that?

http://stackoverflow.com/comment/34767896
type: Comment
has text: Thanks! Sheesh it's always something so simple. I was driving myself crazy trying to find where to put the SOP statement. Completely overlooked that. Much appreciated, sir!
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/22799952

http://stackoverflow.com/comment/34688115
type: QuestionComment
comment on: http://stackoverflow.com/q/22755312
has text: I wonder what the initial value of variable x is, whether it is initialised to zero just like the tutorial code or not.
score: 0
type: Comment

http://stackoverflow.com/comment/34555461
comment on: http://stackoverflow.com/q/22682384
type: Comment
score: 0
has text: That exception is thrown because file.txt is not there. On your class loader you do not have that file.
type: QuestionComment

math
tags question: http://stackoverflow.com/q/22719345
tags question: http://stackoverflow.com/q/22748315
type: Tag
tags question: http://stackoverflow.com/q/22793988
tags question: http://stackoverflow.com/q/22750373
tags question: http://stackoverflow.com/q/22691690
tags question: http://stackoverflow.com/q/22805989
tags question: http://stackoverflow.com/q/22715839
tags question: http://stackoverflow.com/q/22752198
tags question: http://stackoverflow.com/q/22797175
tags question: http://stackoverflow.com/q/22658848
tags question: http://stackoverflow.com/q/22734776
tags question: http://stackoverflow.com/q/22682936
tags question: http://stackoverflow.com/q/22668884
tags question: http://stackoverflow.com/q/22787203
tag name: math
tags question: http://stackoverflow.com/q/22805261

http://stackoverflow.com/comment/34685353
comment on: http://stackoverflow.com/q/22754319
type: Comment
type: QuestionComment
has text: possible duplicate of [R.java file not getting generated](http://stackoverflow.com/questions/11869307/r-java-file-not-getting-generated)
score: 0

http://stackoverflow.com/a/22710299
answers question: http://stackoverflow.com/q/22709822
has body: The java standard regarding Web services and RESTful are JAX-WS and JAX-RS in order. You can use any library that supports the above standards regardless of the server implementation technology. Apache CXF, Jersey are few of the libraries that supports the above standards. Apache CXF has wsdl2java tool which generates client for you. Netbeans, eclipse like IDEs have some Web service wizards which may create you the client in few clicks.
score: 0
type: AcceptedAnswer
type: Answer
accepted answer of: http://stackoverflow.com/q/22709822

http://stackoverflow.com/a/22792350
has comment: http://stackoverflow.com/comment/34754433
score: 6
has comment: http://stackoverflow.com/comment/34754336
has body: you need use: eText.getText().toString() instead of: eText.getText() do this for all EditText value getText return editable not value on EditText you need cast that to String i think it's very good to change EditText object while changing widget, you use eText for three EditText widget on: eText = (EditText) findViewById(R.id.editText1); session.put("Name", eText.getText()); // Get what project working on eText = (EditText) findViewById(R.id.editText2); session.put("Project", eText.getText()); // Get gps location /*eText = (EditText) findViewById(R.id.editText3); session.put()*/ you can use something like: EditText eText1 , eText2 , eText3; and in code eText1 = (EditText) findViewById(R.id.editText1); session.put("Name", eText.getText()); // Get what project working on eText2 = (EditText) findViewById(R.id.editText2); session.put("Project", eText.getText()); // Get gps location /*eText3 = (EditText) findViewById(R.id.editText3); session.put()*/
type: AcceptedAnswer
downvote count: 0
answers question: http://stackoverflow.com/q/22792272
type: Answer
accepted answer of: http://stackoverflow.com/q/22792272
upvote count: 6
has comment: http://stackoverflow.com/comment/34755233

http://stackoverflow.com/comment/34713917
comment on: http://stackoverflow.com/q/22769904
has text: How do you mean? [Compositing](http://en.wikipedia.org/wiki/Compositing)?
score: 1
type: Comment
type: QuestionComment

http://stackoverflow.com/q/22688220
has answer: http://stackoverflow.com/a/22688560
has comment: http://stackoverflow.com/comment/34565555
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/22688560
type: Question
tagged with: android
score: 0
tagged with: java
answer count: 1
tagged with: http
tagged with: loopj
has title: SocketTimeoutException on first HTTP call
has body: I am getting java.net.SocketTimeoutException when I invoke the HTTP get, put, post or delete. But then when I click the button again to make another HTTP call, then it is successful. It seems that the AsyncTask/doInBackground doesn't fail like this. But the first HTTP call fails made using the LoopJ HTTP library. A button is hooked to invoke the below method. On my first click, I get the above exception, but when I click again, it is successful. Below is the log cat. private void updateStatus(View view) { final int currentItemPosition = listView.getPositionForView(view); RadioButton radioButton = (RadioButton) view; System.out.println("radioButton.getText(): " + radioButton.getText()); System.out.println("currentItemPosition: " + currentItemPosition); status.set(currentItemPosition, radioButton.getText().toString()); String url = "http://taskmgr-api.herokuapp.com/tasks/" + id.get(currentItemPosition); String contentType = "application/json"; JSONObject jsonObject = new JSONObject(); try { jsonObject.put("description", description.get(currentItemPosition)); jsonObject.put("status", status.get(currentItemPosition)); jsonObject.put("priority", priority.get(currentItemPosition)); jsonObject.put("duedate", dueDate.get(currentItemPosition)); jsonObject.put("id", id.get(currentItemPosition)); } catch (JSONException e) { e.printStackTrace(); } System.out.println("json String: " + jsonObject.toString()); StringEntity entity = null; try { entity = new StringEntity(jsonObject.toString()); } catch (UnsupportedEncodingException e) { e.printStackTrace(); } AsyncHttpClient client = new AsyncHttpClient(); client.setTimeout(7000); client.put(context, url, entity, contentType, new AsyncHttpResponseHandler() { @Override public void onSuccess(String response) { System.out.println("response: " + response); } @Override public void onFailure(int statusCode, Header[] headers, byte[] responseBody, Throwable error) { error.printStackTrace(); } }); } 03-27 08:23:06.181: W/System.err(4979): ja…

http://stackoverflow.com/q/22802772
has comment: http://stackoverflow.com/comment/34776445
has comment: http://stackoverflow.com/comment/34803684
upvote count: 1
tagged with: graphics2d
has comment: http://stackoverflow.com/comment/34802959
favorite count: 0
has comment: http://stackoverflow.com/comment/34801986
has comment: http://stackoverflow.com/comment/34795797
has comment: http://stackoverflow.com/comment/34795204
has comment: http://stackoverflow.com/comment/34799129
has body: Java2D Game Running 20-30 FPS I am writing a java2D game that as of now has an almost perfect memory footprint running only at around 2% of about a 4GB usable RAM space. The problem is the game only is running at around 20-30 fps just from rendering the character and the surrounding environment. I read already something about utilizing the GraphicsConfiguration, but when I tried that my fps soared right up to 120-130 fps while my memory increased to 70-80% and the frame was frozen in one place even if i moved the character. At this point I am stuck. I assume it has something to do with how many times i call g2d.fillRect() because after removing an area that's being referenced the game seems to speed up. The game seems to run smoothly at 20-30 fps, but I need to fix this otherwise my viewable gameobject painter loop will reduce my game to nothing but lag. Rendering Method With Clipping Areas private void renderEnvironment(Graphics2D g2d){ for(int paint_index = 0; paint_index &lt; paint_textures.size(); paint_index++){ TexturePaint current_paint = paint_textures.get(paint_index); //Area a = new Area(new Rectangle(0, 0, host_frame.getWidth(), host_frame.getHeight())); //a.intersect(new Area(AffineTransform.getTranslateInstance(CamX, CamY).createTransformedShape(paint_regions.get(current_paint)))); g2d.setPaint(new TexturePaint(current_paint.getImage(), new Rectangle(CamX, CamY, current_paint.getImage().getWidth(), current_paint.getImage().getHeight()))); g2d.setClip(AffineTransform.getTranslateInstance(CamX, CamY).createTransformedShape(paint_regions.get(current_paint))); //g2d.fill(a); g2d.fillRect(0, 0, host_frame.getWidth(), host_frame.getHeight()); } for(int paint_index = 0; paint_index &lt; animated_textures.size(); paint_index++){ TextureAnimation current_paint = animated_textures.get(paint_index); //Area a = new Area(new Rectangle(0, 0, host_frame.getWidth(), host_frame.getHeight())); //a.intersect(new Area(AffineTransform.getTranslateInstance(CamX, CamY).create…
has comment: http://stackoverflow.com/comment/34777525
has title: Java2D Unacceptable Frame Rate
has comment: http://stackoverflow.com/comment/34804208
has comment: http://stackoverflow.com/comment/34799551
has comment: http://stackoverflow.com/comment/34800916
tagged with: java-2d
answer count: 0
downvote count: 0
has comment: http://stackoverflow.com/comment/34797790
tagged with: frame-rate
type: UnansweredQuestion
score: 1
tagged with: java
linked to: http://stackoverflow.com/q/196890
type: Question
has comment: http://stackoverflow.com/comment/34802110
tagged with: performance
has comment: http://stackoverflow.com/comment/34803263
has comment: http://stackoverflow.com/comment/34805727

http://stackoverflow.com/q/22662194
type: Question
linked to: http://stackoverflow.com/q/8459878
has body: Java since 1.6 allows the creation of TrayIcon http://docs.oracle.com/javase/8/docs/api/java/awt/SystemTray.html What I am trying to do is create a simple app, that just shows dialogs, but because I don't have an actual main application, I don't see anything on the task bar when I do jfilechooser.showOpenDialog(null); JOptionPane.showOptionDialog(null, ... JOptionPane.showMessageDialog(null, ... because I don't actually have a parent component. What I wanted to do was make a tray icon to represent the parent component without too much hassle to bring up the dialogs when I click on it, but TrayIcon does not implement Component.
score: 0
has title: How do you make Java TrayIcon a Component to associate dialogs with?
answer count: 1
type: UnansweredQuestion
linked to: http://stackoverflow.com/q/12707401
tagged with: swing
has answer: http://stackoverflow.com/a/22662258
tagged with: system-tray
tagged with: java

http://stackoverflow.com/a/22701387
type: Answer
has body: Looks like your Button was pointing to null when you tried setting listener here: add.setOnClickListener(new View.OnClickListener() { make sure that there exists a Button with the id Badd in your activity_main.xml, otherwise findViewById will return null: add = (Button) findViewById(R.id.Badd);
answers question: http://stackoverflow.com/q/22701266
score: 0

http://stackoverflow.com/a/33632479
has comment: http://stackoverflow.com/comment/93868680
score: 67
answers question: http://stackoverflow.com/q/22756153
downvote count: 0
has comment: http://stackoverflow.com/comment/138882776
type: Answer
upvote count: 67
has body: For an Ant project: Make sure, you have servlet-api.jar in the lib folder. For a Maven project: Make sure, you have the dependency added in POM.xml. javax.servlet javax.servlet-api 3.1.0 provided Another way to do it is: Update the project facets to pick up the right server. Check this box in this location: Project → Properties → Target Runtimes → Apache Tomcat (any server)

http://stackoverflow.com/comment/34769053
type: QuestionComment
score: 0
has text: yup it run w/o wrapper. it will stay running until i force close it
comment on: http://stackoverflow.com/q/22776382
type: Comment

http://stackoverflow.com/q/22684800
tagged with: java
has body: I checked other answers but I could not find a proper answer to my question. I want to create a copy of my ArrayList&lt;ArrayList&gt;, since I need the original one somewhere else. I used the .clone() method in different ways: public class WordChecker { private ArrayList&lt;ArrayList&gt; copyOfList = new ArrayList&lt;ArrayList&gt;(); public WordChecker(ArrayList&lt;ArrayList&gt; list) { for (int i = 0; i &lt; list.size(); i++) for (int j = 0; j &lt; 7; j++) copyOfList = (ArrayList&lt;ArrayList&gt;) list.clone(); // without error // copyOfList = list.clone();cannot convert from Object to // ArrayList&lt;ArrayList&gt; // copyOfList = list.get(i).clone();cannot convert from Object to // ArrayList&lt;ArrayList&gt; // copyOfList = list.get(i).get(j).clone(); } but still my main ArrayList changes as I work on its copy. Could anybody tell me how I should get a deep copy in this case? Answer: I put the copying mechanism in my class constructor: private ArrayList&lt;List&gt; checkedTags = new ArrayList&lt;List&gt;(); public WordChecker(ArrayList&lt;ArrayList&gt; list) { for (ArrayList word: list) copyOfList.add((ArrayList) word.clone()); } the only problem is that this is not applicable to copy from ArrayList which made me to go through a for loop use .get() method.I feel they are basically the same at the end.
accepted answer: http://stackoverflow.com/a/22684902
has title: Deep copy of an ArrayList<Arraylist> in JAVA
has comment: http://stackoverflow.com/comment/34559462
answer count: 1
favorite count: 0
tagged with: arraylist
tagged with: deep-copy
has comment: http://stackoverflow.com/comment/34559413
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/22684902
score: 0
linked to: http://stackoverflow.com/q/715650
upvote count: 1
downvote count: 1
has comment: http://stackoverflow.com/comment/34560724
type: Question

http://stackoverflow.com/q/22733888
downvote count: 0
score: 1
type: AnsweredQuestion
has title: Spika-Android: "Can't connect to server"
tagged with: java
has answer: http://stackoverflow.com/a/22735452
accepted answer: http://stackoverflow.com/a/22735452
type: Question
upvote count: 1
answer count: 1
favorite count: 0
has body: I'm am attempting to run Spika-Android and when I try to sign up I get this error. Even if the app let me select the Server, it says that it can't connect to server. I've set this in the admin panel: This is my Server Constant code: public class ConstServer { /* Change to your server adress */ public static final String BASE_URL = "http://192.168.1.68:1232/Spika-Server-master/wwwroot/api/"; public static final String SERVER_URL = "http://192.168.1.68:1232/Spika-Server-master/wwwroot"; public static final String INFORMATION_URL = "http://192.168.1.68:1232/Spika-Server-master/wwwroot/page/information/"; public static final String LIST_SERVERS_URL = SERVER_URL + "/" + Const.API_FOLDER + "servers"; } Can someone help me, please? Thanks!
tagged with: android
tagged with: connection

http://stackoverflow.com/a/22702595
has comment: http://stackoverflow.com/comment/34592875
type: Answer
has comment: http://stackoverflow.com/comment/34592979
has comment: http://stackoverflow.com/comment/34592873
downvote count: 0
answers question: http://stackoverflow.com/q/22702568
score: 6
has comment: http://stackoverflow.com/comment/34592841
has body: Yes that is possible. The path in @RequestMapping on the method is relative to the path on the class annotation. With your current setup, loginRoot() will handle requests to localhost:8080/projectname/login/ Assuming you don't have anything else in your configuration preventing this.
has comment: http://stackoverflow.com/comment/34592925
upvote count: 6
has comment: http://stackoverflow.com/comment/34592948
has comment: http://stackoverflow.com/comment/34592892

http://stackoverflow.com/q/22658169
upvote count: 2
type: UnansweredQuestion
tagged with: spring
tagged with: spring-mvc
tagged with: model-view-controller
score: 2
linked to: http://stackoverflow.com/q/20759737
tagged with: java
type: Question
has answer: http://stackoverflow.com/a/22659825
tagged with: jakarta-ee
answer count: 2
has title: PropertyPlaceholderConfigurer and ResourceBundleMessageSource
has answer: http://stackoverflow.com/a/22658239
downvote count: 0
has body: Can somebody explain to me the difference between PropertyPlaceholderConfigurer and ResourceBundleMessageSource ? When to use the first one and when to use the latter one?
has comment: http://stackoverflow.com/comment/34512476
favorite count: 0

http://stackoverflow.com/a/22764754
score: 0
has body: As indicated above by peter.petrov add a validation before the declaration of boolean found. //declare variable boolean found = false; //verify that all elements are not null (and maybe not empty - it applies to getText() property) if(itemObjUserName != null &amp;&amp; itemObjUserName.getUserName() != null &amp;&amp; txtUsername != null &amp;&amp; txtUsername.getText() != null &amp;&amp; itemObjUserName.getPassword() != null &amp;&amp; txtPassword != null &amp;&amp; txtPassword.getText() != null) { found = ... }
type: Answer
answers question: http://stackoverflow.com/q/22757051

http://stackoverflow.com/comment/34761723
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/22790826
has text: Generate textures as usual, then use glTexCoordPointer() to specify the texture coordinates.
score: 0

http://stackoverflow.com/comment/34623802
type: Comment
comment on: http://stackoverflow.com/q/22719218
score: 0
has text: Also, if you give your variables names that have meaning, your code will be a whole lot easier for others (and your future self) to understand. jButton4 has no meaning to us, but closeWindowButton does.
type: QuestionComment

http://stackoverflow.com/q/22653440
has answer: http://stackoverflow.com/a/22653966
answer count: 1
has comment: http://stackoverflow.com/comment/34504633
has body: I am developing an android application. for doing it i need to connect to oracle database. i created a connection class as in Java. but when i try to run it nothing happens. i heard that a middle ware is needed to do this task. and also something about host. i didn’t get any clear ideas of what i should do. i have checked so many blogs and googling. but none helped. will somebody explain it to me in steps what all steps should i do to create my application? please gys i am stuck here, any blogs, posts will do /*imports*/ public class ConnectionClass { public Connection connectToDB(){ Connection con=null; try{ Class.forName("oracle.jdbc.driver.OracleDriver"); con=DriverManager.getConnection( "jdbc:oracle:thin:@blablabla:1521:bla","usr","pass"); }catch(Exception e){ System.out.println(e);} return con; } public static void main(String arg[]) { try { ConnectionClass conDB=new ConnectionClass(); System.out.println("connection*&amp;% "+conDB ); } catch(Exception e) { System.out.println(e); } } } it is compiling in javac and result is obtained correctly
has comment: http://stackoverflow.com/comment/34504345
has comment: http://stackoverflow.com/comment/34504804
has comment: http://stackoverflow.com/comment/34504339
tagged with: oracle-database
tagged with: android
favorite count: 0
has comment: http://stackoverflow.com/comment/34504293
type: UnansweredQuestion
downvote count: 2
has comment: http://stackoverflow.com/comment/34505053
upvote count: 1
has comment: http://stackoverflow.com/comment/34504250
has title: steps to do to connect to oracle database from my android application
linked to: http://stackoverflow.com/q/5727857
tagged with: java
score: -1
has comment: http://stackoverflow.com/comment/34504465
has comment: http://stackoverflow.com/comment/34505377
type: Question

http://stackoverflow.com/comment/34756995
comment on: http://stackoverflow.com/a/22793997
score: 1
type: AnswerComment
has text: Integer.valueOf(int) is always returning new Integer instance. it is not sharing like String Pool
type: Comment

http://stackoverflow.com/q/22774259
type: AnsweredQuestion
has body: I have a batch file for setting up the environment variables as follows @echo off echo -- Setting Environment variables -- set "TH=D:\apache-tomcat-7.0.37\"; set "WEB-INF=%TH%webapps\ROOT\WEB-INF"; set "CLASSES_HOME=%WEB-INF%\classes"; set "CONFIG=%WEB-INF%\config-files"; set "JARS=%TH%webapps\ROOT\WEB-INF\lib"; set "JAVA_HOME=C:\Program Files\Java\jdk1.7.0_45"; set "_JAVA_OPTIONS=-Djava.net.preferIPv4Stack=true"; set "path=%path%;%JAVA_HOME%\bin;%WEB-INF%;%JARS%\jacob"; setLocal EnableDelayedExpansion set "CLASSPATH=.;C:\WINNT\system32;%CLASSES_HOME%;%CONFIG%"; for %%a in ("%TH%lib\*.jar") do ( set CLASSPATH=!CLASSPATH!;%%a ) for %%a in ("%CONFIG%\*.lic") do ( set CLASSPATH=!CLASSPATH!;%%a ) for %%a in ("%JARS%\*.jar") do ( set CLASSPATH=!CLASSPATH!;%%a ) set CLASSPATH=!CLASSPATH! echo %CLASSPATH% echo %path% Now I have a second batch file which invokes the first batch file to set up the environment variables and then a java class as follows call D:\myFolder\setEnvironmentvaribales.bat java -Xms256m -Xmx1024m com.myproject.java.runBatchToDelete This is throwing an exception stating that main method cannot be found. I know for a fact that there is no issue with the java class as I can run this program directly. I believe for some reason the classpath and path setting in the setEnvironmentvaribales.bat is not getting set properly. Any help to resolve the issue would be greatly appreciated.
has title: Issue with setting environment variable through bat file to execute a java program
score: 1
tagged with: java
possible better answer: http://stackoverflow.com/a/22774924
upvote count: 1
has answer: http://stackoverflow.com/a/22774924
type: Question
tagged with: batch-file
answer count: 2
has comment: http://stackoverflow.com/comment/34722924
downvote count: 0
has comment: http://stackoverflow.com/comment/34721793
favorite count: 0
has answer: http://stackoverflow.com/a/22775012
accepted answer: http://stackoverflow.com/a/22775012

http://stackoverflow.com/comment/34504869
type: Comment
score: 0
type: AnswerComment
has text: same log appeared after mail.debug.quote when set true
comment on: http://stackoverflow.com/a/22653794

http://stackoverflow.com/q/22757112
type: AnsweredQuestion
tagged with: java
has comment: http://stackoverflow.com/comment/34690430
has comment: http://stackoverflow.com/comment/34690397
possible better answer: http://stackoverflow.com/a/22757690
type: Question
has comment: http://stackoverflow.com/comment/34690690
answer count: 2
has answer: http://stackoverflow.com/a/22757780
accepted answer: http://stackoverflow.com/a/22757780
has comment: http://stackoverflow.com/comment/34690872
tagged with: arraylist
score: 0
has title: value change in ith element influences value in the 0th element for ArrayList
has body: I have the following code to set value by iteration. for (int i=0; i&lt;list.size(); i++){ QuestionaireResult item = list.get(i); List&lt;QuestionaireResultDetail&gt; rsDetails = item.getQuestionaireResultDetails(); List&lt;QuestionaireResultDetail&gt; filledList = fillList2(rs.getQuestionaireResultDetails(), rsDetails); item.setQuestionaireResultDetails(insertCommentObj3(insertCommentObj3(filledList, "C"), "B")); QuestionaireResultDetail qr2 = new QuestionaireResultDetail(); qr2.setAnswerDesc(item.getRemark()); item.getQuestionaireResultDetails().add(qr2); list.set(i, item); } however, I find I make change in the ith element, the 0th element also changes its value as the ith element, but I don't think I change that. Could someone give me advice about why that happen? Thanks first.
has answer: http://stackoverflow.com/a/22757690
has comment: http://stackoverflow.com/comment/34690433

http://stackoverflow.com/comment/34621906
has text: Well, you can't really delete an element from an array, like you said. Best you can hope for is to give the removed element a null value instead. Thus leaving it empty. Or, you could alternatively, make a new array with length-1 elements and copy all desired elements to that array.
comment on: http://stackoverflow.com/q/22718898
type: Comment
score: 1
type: QuestionComment

http://stackoverflow.com/a/22733759
type: Answer
upvote count: 1
answers question: http://stackoverflow.com/q/22729894
score: 1
has body: You could use the Compound Icon, which allows you to combine two or more Icons into one. Or, just create a JPanel (using an appropriate layout manager) and add two JLabels to the panel. also want to write some text on that j label See: Image Background and Text Alignment for 4 ways to do this.
downvote count: 0

http://stackoverflow.com/a/36591677
downvote count: 0
has body: Replying since I had this question too and got an answer. There is a JPS program in JDK which shows java processes. I am not 100% sure (don't want to dive deep into jconsole code) but 99% sure jconsole uses the same mechanism as jps: http://grepcode.com/file/repository.grepcode.com/java/root/jdk/openjdk/8u40-b25/sun/tools/jps/Jps.java?av=f HostIdentifier hostId = arguments.hostId(); MonitoredHost monitoredHost = MonitoredHost.getMonitoredHost(hostId); // get the set active JVMs on the specified host. Set&lt;Integer&gt; jvms = monitoredHost.activeVms(); These class are part of tools.jar, you need to include it in the project's classpath. If we go deeper (I do not expose all the intermediate steps) - finally we'll know that active VMs list is populated from hsperfdata files in temporary directories: http://grepcode.com/file/repository.grepcode.com/java/root/jdk/openjdk/8u40-b25/sun/jvmstat/perfdata/monitor/protocol/local/PerfDataFile.java Here is a link to know more: java hsperfdata directory At last, here is a code snippet allowing you to get the java processes ids: sun.jvmstat.monitor.MonitoredHost host = sun.jvmstat.monitor.MonitoredHost.getMonitoredHost(new sun.jvmstat.monitor.HostIdentifier((String) null)); System.out.println(host.activeVms()); P.S. Then you can use Attach API (as kostya mentioned) to discover the rest of needed things.
answers question: http://stackoverflow.com/q/22776481
type: Answer
upvote count: 1
score: 1

http://stackoverflow.com/comment/34585711
comment on: http://stackoverflow.com/q/22696126
score: 0
has text: I just found out, that the second call of encode, does not apply (even though i thought i have checked it). So far, thanks for all suggestions! I will try to figure out why it doesnt.
type: Comment
type: QuestionComment

http://stackoverflow.com/a/22708721
downvote count: 0
type: Answer
score: 1
upvote count: 1
answers question: http://stackoverflow.com/q/22685243
has body: This came up as a bug in Apache Tomcat a little while ago. The short version of that bug report is: Section 17.13.3 of the HTML specification (v4.01) titled "Processing form data", clearly states that "control names/values are listed in the order they appear in the document." The Servlet specification does defer to W3C for all HTML matters. Strictly, 17.13.3 applies to how the client presents the data to the server That said, it seems reasonable to expect Servlet containers to retain this order when presenting parameters. This has been fixed in Tomcat 8.0.x for 8.0.0-RC4 onwards and in 7.0.x for 7.0.45 onwards.

http://stackoverflow.com/comment/34586756
has text: No, DijkstraShortesPath is JUNG class.
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/22695017

rate-limiting
tags question: http://stackoverflow.com/q/22699930
type: Tag
tag name: rate-limiting

http://stackoverflow.com/comment/34574613
type: Comment
comment on: http://stackoverflow.com/a/22692892
score: 2
type: AnswerComment
has text: OP asked basically if the left k++ will be executed before the right k++ and if that's guaranteed. Not sure where you address this.

http://stackoverflow.com/q/22669614
favorite count: 0
has title: Java JGrapht Bipartite graph
accepted answer: http://stackoverflow.com/a/22674888
tagged with: jgrapht
tagged with: bipartite
score: 2
has comment: http://stackoverflow.com/comment/34533311
upvote count: 2
has body: I seen examples of jgraph and jgrapht and there easy to follow but now sure how I would go about using the CompleteBipartiteGraph? How is the syntax to be used to instantiate the graph? http://jgrapht.org/javadoc/ http://jgrapht.org/javadoc/org/jgrapht/generate/CompleteBipartiteGraphGenerator.html
type: AnsweredQuestion
tagged with: java
has comment: http://stackoverflow.com/comment/34541801
has comment: http://stackoverflow.com/comment/47546794
has answer: http://stackoverflow.com/a/22674888
has comment: http://stackoverflow.com/comment/34535300
tagged with: jgraph
type: Question
has comment: http://stackoverflow.com/comment/34536692
answer count: 1
downvote count: 0

http://stackoverflow.com/a/22649721
type: Answer
accepted answer of: http://stackoverflow.com/q/22649659
score: 2
answers question: http://stackoverflow.com/q/22649659
upvote count: 2
type: AcceptedAnswer
downvote count: 0
has body: You need to loop over the rest of the data to find the minimum, not all the data, i.e. j should start from i+1, not 0, otherwise you just end up putting the minimum into the first position, then moving it to the second, then the third and so on, leaving the array completely unsorted, except that the minimum will be at the end. And using DataManager.getArraySizeExcludingNull(stringArray) is probably wrong for this problem (judging by the name of the function), as you're treating max as the last index, not the number of non-null values. You need to simply use stringArray.length and/or change your function appropriately.

http://stackoverflow.com/a/22715107
type: Answer
answers question: http://stackoverflow.com/q/22714915
score: 0
has comment: http://stackoverflow.com/comment/34615363
has body: Check out the custom annotations guide HERE It also shows you how to use reflection to get info from the annotated elements, you could easily use this to fetch the method name and verify whether it meets your convention and take appropriate actions etc...

http://stackoverflow.com/comment/34715688
score: 1
has text: @JHollanti No. `sleep` is a `static` method.
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/22771005

http://stackoverflow.com/a/22667795
score: 0
has body: JAR files are a collection of compiled java files (.class), if you want the source code to open in eclipse just copy over the .java files
type: Answer
answers question: http://stackoverflow.com/q/22667237

http://stackoverflow.com/a/22732723
type: Answer
downvote count: 0
score: 21
accepted answer of: http://stackoverflow.com/q/22732013
upvote count: 21
type: AcceptedAnswer
answers question: http://stackoverflow.com/q/22732013
has body: This is closer, but not great: textCol.setCellFactory(new Callback&lt;TableColumn&lt;Status, String&gt;, TableCell&lt;String, String&gt;&gt;() { @Override public TableCell&lt;Status, String&gt; call( TableColumn&lt;Status, String&gt; param) { TableCell&lt;Status, String&gt; cell = new TableCell&lt;&gt;(); Text text = new Text(); cell.setGraphic(text); cell.setPrefHeight(Control.USE_COMPUTED_SIZE); text.wrappingWidthProperty().bind(cell.widthProperty()); text.textProperty().bind(cell.itemProperty()); return cell ; } }); In 2.2 this displays the wrong height when you add new items to the table, then on resize the cells are sized correctly. In 8 it's almost perfect, just seems to fail after the first item is added (at least in my mock-up). As noted in the comments, textCol.setCellFactory(tc -&gt; { TableCell&lt;Status, String&gt; cell = new TableCell&lt;&gt;(); Text text = new Text(); cell.setGraphic(text); cell.setPrefHeight(Control.USE_COMPUTED_SIZE); text.wrappingWidthProperty().bind(textCol.widthProperty()); text.textProperty().bind(cell.itemProperty()); return cell ; }); appears to work better.
has comment: http://stackoverflow.com/comment/138422230
has comment: http://stackoverflow.com/comment/53117710

http://stackoverflow.com/comment/34670114
type: Comment
has text: My making the `i` field non-static you have specified that each instance should have it's own value. BTW synchronized only protects the code inside the block. When you print `i` there is no guarantees.
score: 0
comment on: http://stackoverflow.com/q/22745989
type: QuestionComment

http://stackoverflow.com/q/22745700
tagged with: java
upvote count: 1
has answer: http://stackoverflow.com/a/22776685
type: Question
has body: Reading the docs for Flickrj 1.2 http://flickrj.sourceforge.net/api/com/aetrion/flickr/people/PeopleInterface.html#getPublicGroups(java.lang.String) I'm trying to the public groups for users but it seems the return type is java.util.Collection public java.util.Collection getPublicGroups(java.lang.String userId) And I'm stumped as to how I can get the group names for a user. If I print the output for people.getPublicGroups(userID); I get: [com.aetrion.flickr.groups.Group@3f1179, com.aetrion.flickr.groups.Group@945b95.... etc It's not what I'm after and I'm stuck.
downvote count: 0
tagged with: flickr
answer count: 1
score: 1
favorite count: 0
has title: Flickrj - getPublicGroups uncommon return type
type: UnansweredQuestion
tagged with: flickrj

http://stackoverflow.com/q/22680262
has comment: http://stackoverflow.com/comment/34552531
answer count: 5
possible better answer: http://stackoverflow.com/a/22680356
tagged with: immutability
type: AnsweredQuestion
tagged with: return-value
score: 1
linked to: http://stackoverflow.com/q/2670982
tagged with: java
has comment: http://stackoverflow.com/comment/34552933
has answer: http://stackoverflow.com/a/22680415
type: Question
accepted answer: http://stackoverflow.com/a/22680415
has comment: http://stackoverflow.com/comment/34552122
tagged with: arrays
has answer: http://stackoverflow.com/a/22680356
has answer: http://stackoverflow.com/a/51630263
has answer: http://stackoverflow.com/a/22680362
has comment: http://stackoverflow.com/comment/34551824
has comment: http://stackoverflow.com/comment/34552311
has title: Java: best way to return two "immutable" integers?
upvote count: 1
has answer: http://stackoverflow.com/a/22680373
downvote count: 0
has body: 1) When Java encounters int[], does it actually understand it as Integer[], I mean array can only hold references, not primitives ? 2) When it comes to return two immutable integers from a function, are those two ways equivalent? int a, b; ... int[] returnVal = {a, b}; return(returnVal); vs. Integer a, b; ... Integer[] returnVal = {a, b}; return(returnVal); 3) What is the standard practice to return two immutable integers? Edits: I'm wondering if "immutable" is actually the correct term to use as my question is about how to return safely a pair of integer values to a caller and at the same time preventing the caller to change the original values without using unnecessary clone(). By trying different pieces of code, the short answer to point #2 seems to be that you can safely return the values as int[] or Integer[]. The caller may change the elements of the returned array, but not the initial values. Answers below provide explanations for that, and valuable clues for points #1 and #3. As I cannot select multiple answers as correct, I've selected the most useful for me, but I thank everyone for their assistance.
favorite count: 0

http://stackoverflow.com/q/22665942
accepted answer: http://stackoverflow.com/a/22666508
type: Question
type: AnsweredQuestion
tagged with: sql
score: 1
has title: Increasing performances : storing more in memory, less in database?
favorite count: 0
has body: I'm on a project asking for high performances... And I was told to use as a few database calls as possible, and to use more objects in the JVM memory. Right. So... It didn't shock me at first, but now I'm questioning the approach. How can I know which is best ? On the one hand I would have : - static Map &lt;id1, id2&gt; - static Map &lt;id2, ObjectX&gt; Object X - id2 - map &lt;id1, ObjectY&gt; Object Y - id1 So basically, this data structure would help me to get an ObjectY from an id1. And I would be able to send back the whole ObjectX as well when needed. You gotta know that the structure is filled by a service call (A). Then, updates to objects ObjectY can happen through another service (B). Finally, another service can send back an ObjectX (C). Which makes three services using the data. On the other hand, I could have : - db table for ObjectY T1 - db join table associating id1s and id2s T2 - db table for Object X T3 Service A would make an insert in the tables. Service B would make an update in table T1 Service C would make a join between T2 and T1 to get all ObjectY objects for an ObjectX In my opinion, the db version is more flexible... I am unsure about the performances, but I would say the db version shouldn't be slower than the "memory" version. Finally, hasn't the "memory" version got some risks ? I hope it seems obvious to some of you I should choose one version and why... I'm hoping this not to be a debate. I'm looking for ways to know what's quicker...
possible better answer: http://stackoverflow.com/a/22666410
answer count: 2
has answer: http://stackoverflow.com/a/22666410
upvote count: 1
has answer: http://stackoverflow.com/a/22666508
tagged with: performance
tagged with: java
linked to: http://stackoverflow.com/q/4087280
downvote count: 0
tagged with: database

http://stackoverflow.com/comment/34627660
comment on: http://stackoverflow.com/q/22720966
score: 0
type: Comment
type: QuestionComment
has text: I've done it, but it's not working.

http://stackoverflow.com/q/22769904
type: Question
has answer: http://stackoverflow.com/a/22770738
answer count: 2
has answer: http://stackoverflow.com/a/22771059
tagged with: awt
has body: I'm in a situation where I'm not allowed to use AWT libraries on a server but need to merge two images. I know only of one method in Java which is using java.awt.Graphics.drawImage and java.awt.image.BufferedImage. Is it possible to merge two images not using AWT? AWT-based example code: try { BufferedImage image = ImageIO.read(new File("a.png")); BufferedImage overlay = ImageIO.read(new File("b.png")); int width = Math.max(image.getWidth(), overlay.getWidth()); int height = Math.max(image.getHeight(), overlay.getHeight()); BufferedImage combination = new BufferedImage(width, height, BufferedImage.TYPE_INT_ARGB); Graphics g = combination.getGraphics(); g.drawImage(image, 0, 0, null); g.drawImage(overlay, 0, 0, null); ImageIO.write(combination, "png", new File("c.png")); } catch (IOException ioe) { }
score: 0
has comment: http://stackoverflow.com/comment/34715319
accepted answer: http://stackoverflow.com/a/22771059
linked to: http://stackoverflow.com/q/7358775
has comment: http://stackoverflow.com/comment/34713917
has title: Merging two images without using AWT
has comment: http://stackoverflow.com/comment/34714450
type: AnsweredQuestion
tagged with: java
has comment: http://stackoverflow.com/comment/34727824
possible better answer: http://stackoverflow.com/a/22770738

http://stackoverflow.com/q/22769428
type: Question
has comment: http://stackoverflow.com/comment/34713257
tagged with: game-engine
has body: I've just started developing a 2d side-scrolling plane shooter. For a couple of days now i've had a problem with the movement of the plane. For some reason, every second or so, the sprite seems to stutter. It's almost as if it jumped back a frame or something, and then continued from where it left off. I have had no luck finding what is causing this. Any thoughts? The entire project can be found here: http://www.upload.ee/files/3975636/planes.zip.html Main class: package planes; import javax.swing.JFrame; import planes.Entities.Player; public class Game extends JFrame{ private static final long serialVersionUID = 1L; private boolean isRunning = true; public static int fps = 60; private Frame frame; private InputHandler input; public static Player player; public static void main(String[] args) { Game game = new Game(); game.run(); System.exit(0); } public void update() { player.update(); } public void draw() { frame.draw(); } public void initialize() { Sprites.init(); frame = new Frame(); input = new InputHandler(frame); player = new Player(0, 0, Sprites.player, input); } public void run() { initialize(); while (isRunning) { long time = System.currentTimeMillis(); update(); draw(); time = (1000 / fps) - (System.currentTimeMillis() - time); if (time &gt; 0) { try { Thread.sleep(time); } catch (Exception e) { e.printStackTrace(); } } } setVisible(false); } } Frame class: package planes; import java.awt.Color; import java.awt.Graphics; import java.awt.Graphics2D; import java.awt.Insets; import java.awt.RenderingHints; import java.awt.image.BufferedImage; import java.awt.image.ImageObserver; import javax.swing.JFrame; public class Frame extends JFrame{ private Insets insets; private BufferedImage backBuffer; Frame(){ setTitle("Planes"); setSize(Const.windowWidth, Const.windowHeight); setResizable(false); setDefaultCloseOperation(EXIT_ON_CLOSE); setLocationRelativeTo(null); setVisible(true); insets = getInsets(); setSize(insets.left + Const.windowWidth + insets.right, ins…
accepted answer: http://stackoverflow.com/a/22769699
score: 0
has comment: http://stackoverflow.com/comment/34713253
answer count: 1
has title: Java game stuttering
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/22769699
tagged with: java

http://stackoverflow.com/comment/40859308
type: AnswerComment
comment on: http://stackoverflow.com/a/22662022
score: 0
type: Comment
has text: It's not only JAX-WS. There are more APIs that are not included in non-JEE containers. EJB3, for example.

http://stackoverflow.com/a/22783143
score: 1
upvote count: 1
has body: during serialization if you do not want to store any variable then you can declare that using transient keyword
type: Answer
answers question: http://stackoverflow.com/q/22783078
downvote count: 0

http://stackoverflow.com/q/22698405
has comment: http://stackoverflow.com/comment/34585079
has comment: http://stackoverflow.com/comment/34629520
type: AnsweredQuestion
score: 3
has body: I'm using JPA with hibernate as provider. There are two entities: @Entity @Table(name = "PROYECTOS") public class Proyecto { @Id private Long id; ... @OneToMany(mappedBy = "proyecto", cascade = CascadeType.PERSIST, orphanRemoval = true) private List&lt;Incidencia&gt; incidencias; ... } @Entity @Table(name = "INCIDENCIAS") public class Incidencia { @Id private Long id; ... @ManyToOne(cascade = CascadeType.PERSIST, optional = false) @JoinColumn(name = "ID_PROYECTO", nullable = false) @NotNull private Proyecto proyecto; ... public Incidencia(Proyecto proyecto, Usuario usuario, String descripcion, Date fechaYHora) { super(); this.proyecto = proyecto; this.usuario = usuario; this.descripcion = descripcion; this.fechaYHora = fechaYHora; } ... } When I execute a test method and try to persist "Incidencia" class ("Proyecto" was persisted before): ... entityManager.persist(proyecto); entityManager.flush(); ... Incidencia incidencia = new Incidencia(proyectoFind, usuario, "1ª incidencia del proyecto", new Date()); proyecto.getIncidencias().add(incidencia); entityManager.persist(proyecto); entityManager.flush(); ... An exception is thrown from the last flush: ... 35 more Caused by: org.h2.jdbc.JdbcBatchUpdateException: La columna "PROYECTO" no permite valores nulos (NULL) NULL not allowed for column "PROYECTO"; SQL statement: insert into INCIDENCIAS (DESCRIPCION, FECHA_Y_HORA, ID_PROYECTO, ID_USUARIO, ID) values (?, ?, ?, ?, ?) [23502-175] at org.h2.jdbc.JdbcPreparedStatement.executeBatch(JdbcPreparedStatement.java:1167) at org.hibernate.jdbc.BatchingBatcher.doExecuteBatch(BatchingBatcher.java:70) at org.hibernate.jdbc.AbstractBatcher.executeBatch(AbstractBatcher.java:268) ... 41 more I'm sure that "proyecto" is set in "Incidencia" because in its constructor: this.proyecto = proyecto; So, I can't understand why this exception is thrown. Any help is greatly appreciated.
upvote count: 3
has title: JPA OneToMany and ManyToOne: Error NULL not allowed for column
tagged with: java
tagged with: hibernate
possible better answer: http://stackoverflow.com/a/22698882
has comment: http://stackoverflow.com/comment/34627324
has answer: http://stackoverflow.com/a/22698882
type: Question
accepted answer: http://stackoverflow.com/a/22767942
downvote count: 0
answer count: 2
has comment: http://stackoverflow.com/comment/34632705
has comment: http://stackoverflow.com/comment/34642931
has comment: http://stackoverflow.com/comment/34604587
has comment: http://stackoverflow.com/comment/34584908
tagged with: jpa
favorite count: 0
tagged with: one-to-many
tagged with: many-to-one
has answer: http://stackoverflow.com/a/22767942

http://stackoverflow.com/a/22752968
score: 1
has body: Try this: import java.util.Scanner; public class Math { public static void main(String[] args) { Scanner scan = new Scanner(System.in); System.out.print("Type the length of your pendulum: "); double L = scan.nextDouble(); final double G = 9.8, PI = 3.14159; double period = 2*PI*java.lang.Math.sqrt(L/G); System.out.println("The period of the pendulum is " +period+ " per second"); scan.close(); } } Yours has several issues with it. &gt; { &gt; public static void main (String[] args) throws java.lang.Exception { // main() should go after class declaration; why are you throwing an Exception? &gt; import java.util.Scanner; // import statements go at the very beginning (before class declaration) &gt; Public class Math // move before the main method &gt; Scanner scan = new scanner(system.in); // Upcase second scanner (needs to match the type "Scanner"; 'system' -&gt; 'System' &gt; System.out.print("Type the length of your pendulum: "); &gt; double pendulum length = keyboard.nextdouble(); // where did you get "keyboard"?. Remove space from variable name &gt; final double G = 9.8 meters per second,pi = 3.14159; // meters per second doesn't belong; comment it out &gt; double powerTerm = Math.pow(pendulumLength, G, pi); // what is powerTerm used for? You never call it anywhere &gt; double periodOfpendulum = 2*pi*Math.sqrt(L/G); // rename class, or use java.lang.Math to disambiguate your class from the java.lang.Math class &gt; System.out.println("The period of the pendulum is " +period+ " per second"); // be consistent with variable names - periodOfpendulum not period. Not a syntactical issue, but shouldn't it be "period seconds" not "period per second"? &gt; scan.close(); &gt; &gt; } } The main method cannot go before: public class Math Place all your imports at the very beginning. I would recommend calling your class something other than "Math", since that is already an existing Java library, and when calling methods like Math.pow, you would need to specify java.lang.Math.po…
upvote count: 1
type: Answer
downvote count: 0
answers question: http://stackoverflow.com/q/22752834

http://stackoverflow.com/comment/34597447
type: AnswerComment
comment on: http://stackoverflow.com/a/22705225
score: 0
type: Comment
has text: I checked that code but did't solve a issue.. Is there a issue in code to abort message ?

http://stackoverflow.com/comment/34694103
score: 0
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/22758862
has text: Just take the try-catch from the comment and paste it to the end of your main, so yes. But alter the `f` to your variable containing your Frame.

http://stackoverflow.com/a/22757808
has comment: http://stackoverflow.com/comment/75760396
upvote count: 2
has comment: http://stackoverflow.com/comment/75842046
answers question: http://stackoverflow.com/q/22757434
type: Answer
has body: You will try this one to execute the task with the delay Handler handler = new Handler(); handler.postDelayed(new Runnable() { @Override public void run() { //Your task it will execute at 1 time only... } }, 5000);//5 seconds delay and you can change the delay time... It will execute the thread at ever 10 seconds like as a loop function... Timer timer = new Timer(); timer.scheduleAtFixedRate(new TimerTask() { @Override public void run() { //Your logic it will repeating you task ever 10 seconds.... } }, 5000, 5000);
score: 2
downvote count: 0

http://stackoverflow.com/comment/34736740
type: QuestionComment
type: Comment
score: 0
comment on: http://stackoverflow.com/q/22783010
has text: Ah, so I should just add 3 and 9 decimals. I see. Thought they had a different meaning than the realtime ones.

http://stackoverflow.com/comment/34532634
comment on: http://stackoverflow.com/a/22665276
type: Comment
has text: i have done all these points just now, it is giving the same error.
score: 0
type: AnswerComment

http://stackoverflow.com/q/22660096
tagged with: java
has body: I have got a problem while uploading files on my server, when i am trying to upload files using Internet Protocol of my server. It is working fine but when i am trying to upload same files from my domain name. It is not working. my application is deployed on Apache tomcat 7.0 on Linux machine. Server.xml &lt;Connector port="8080" protocol="HTTP/1.1" connectionUploadTimeout="36000000" disableUploadTimeout="false" connectionTimeout="6000000" maxPostSize="0" redirectPort="8443" /&gt; ** org.apache.commons.fileupload.FileUploadBase$IOFileUploadException: Processing of multipart/form-data request failed. Stream ended unexpectedly at org.apache.commons.fileupload.FileUploadBase.parseRequest(FileUploadBase.java:367) at org.apache.struts2.dispatcher.multipart.JakartaMultiPartRequest.parseRequest(JakartaMultiPartRequest.java:145) at org.apache.struts2.dispatcher.multipart.JakartaMultiPartRequest.processUpload(JakartaMultiPartRequest.java:88) at org.apache.struts2.dispatcher.multipart.JakartaMultiPartRequest.parse(JakartaMultiPartRequest.java:80) at org.apache.struts2.dispatcher.multipart.MultiPartRequestWrapper.&lt;init&gt;(MultiPartRequestWrapper.java:75) at org.apache.struts2.dispatcher.Dispatcher.wrapRequest(Dispatcher.java:709) at org.apache.struts2.dispatcher.ng.PrepareOperations.wrapRequest(PrepareOperations.java:131) at org.apache.struts2.dispatcher.ng.filter.StrutsPrepareAndExecuteFilter.doFilter(StrutsPrepareAndExecuteFilter.java:83) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:243) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210) at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:222) at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:123) at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:502) at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:171) at …
has comment: http://stackoverflow.com/comment/34516214
linked to: http://stackoverflow.com/q/646189
type: Question
has comment: http://stackoverflow.com/comment/34516072
has answer: http://stackoverflow.com/a/22660644
tagged with: apache
answer count: 1
has comment: http://stackoverflow.com/comment/34515904
score: 0
has comment: http://stackoverflow.com/comment/34515593
tagged with: file-upload
has title: files uploading via server ip but not from domain name
has comment: http://stackoverflow.com/comment/34515649
linked to: http://stackoverflow.com/q/3263809
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/34516331
has comment: http://stackoverflow.com/comment/34515771
has comment: http://stackoverflow.com/comment/34515737
has comment: http://stackoverflow.com/comment/34516307

hadoop
tags question: http://stackoverflow.com/q/22759795
tags question: http://stackoverflow.com/q/22764262
tags question: http://stackoverflow.com/q/22672075
tag name: hadoop
tags question: http://stackoverflow.com/q/22680433
tags question: http://stackoverflow.com/q/22731868
type: Tag
tags question: http://stackoverflow.com/q/22661978
tags question: http://stackoverflow.com/q/22779874
tags question: http://stackoverflow.com/q/22804296
tags question: http://stackoverflow.com/q/22731176
tags question: http://stackoverflow.com/q/22688545
tags question: http://stackoverflow.com/q/22702947
tags question: http://stackoverflow.com/q/22706566
tags question: http://stackoverflow.com/q/22740007
tags question: http://stackoverflow.com/q/22793191
tags question: http://stackoverflow.com/q/22729865
tags question: http://stackoverflow.com/q/22781275
tags question: http://stackoverflow.com/q/22803542
tags question: http://stackoverflow.com/q/22752394
tags question: http://stackoverflow.com/q/22661071
tags question: http://stackoverflow.com/q/22786511
tags question: http://stackoverflow.com/q/22693020
tags question: http://stackoverflow.com/q/22782304
tags question: http://stackoverflow.com/q/22750148
tags question: http://stackoverflow.com/q/22751680
tags question: http://stackoverflow.com/q/22755912
tags question: http://stackoverflow.com/q/22678748

http://stackoverflow.com/comment/34525688
score: 0
comment on: http://stackoverflow.com/q/22665571
type: Comment
type: QuestionComment
has text: you can put in respective `res/values/styles.xml`

http://stackoverflow.com/q/22718104
has body: Is their something wrong if i write this code in jsp ? &lt;%String namee=rs.getString(2);%&gt; &lt;input name="IndUserName" type="hidden" value=namee/&gt; Am i wrong in assigning value to this input?
has title: Assigning value to hidden input type
answer count: 2
has answer: http://stackoverflow.com/a/22718338
tagged with: jsp
possible better answer: http://stackoverflow.com/a/22718338
has answer: http://stackoverflow.com/a/22718373
has comment: http://stackoverflow.com/comment/34620424
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/22718373
score: 0
tagged with: java
has comment: http://stackoverflow.com/comment/34620420
type: Question
tagged with: jakarta-ee

http://stackoverflow.com/comment/62194593
type: Comment
has text: No, actually its even better for the cliënt. Chromecast can pull the html of a server so the cliënt can just send a url. The custom receiver is needed because google deceided that chromecast by default only accepts media.
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/29496709

http://stackoverflow.com/a/22960299
answers question: http://stackoverflow.com/q/22695829
type: Answer
score: 2
has body: in fact there is a solution for you to use C#, VB.NET or F# code via JNA in Java (and nothing else)! and it is also very easy to use: https://www.nuget.org/packages/UnmanagedExports with this package all you need to do is, add [RGiesecke.DllExport.DllExport] to your methods like that: C# .dll Project: [RGiesecke.DllExport.DllExport] public static String yourFunction(String yourParameter) { return "CSharp String"; } Java Project: public interface jna extends Library { jna INSTANCE = (jna) Native.loadLibrary("yourCSharpProject.dll", jna.class); public String yourFunction(String yourParameter); } use it in the code: System.out.println(jna.INSTANCE.yourFunction("nothingImportant")); Viola! As already mentioned it works very easy, but this solution has some limitations: only available for simple datatypes as parameter &amp; return values no MethodOverloading available. yourFunction(String yourParameter) and yourFunction(String yourParameter, String yourSecondParameter) does not work! you have to name them differently Use arrays as parameter or return values. (JNA offers StringArray, but I am not able to use them in C#) (maybe there is a solution, but I couldn't come up with one so far!) if you export a method you can't call it internally in your C# code (simple to bypass that by the following: . [RGiesecke.DllExport.DllExport] public static Boolean externalAvailable(String yourParameter) { return yourInternalFunction(yourParameter); } With C# it works great, with VB.NET and F# I have no experience. hope this helps!
upvote count: 2
has comment: http://stackoverflow.com/comment/35246356
has comment: http://stackoverflow.com/comment/35277104
downvote count: 0

http://stackoverflow.com/q/22739343
linked to: http://stackoverflow.com/q/16914628
score: 0
tagged with: java
tagged with: jaxb
answer count: 1
has title: JAXB: unmarshal from XML subtree?
type: UnansweredQuestion
tagged with: gpx
has body: My JAVA program uses an internal class hierarchy which resembles GPX 1.1, but is not identical. since rewriting it to conform 1:1 to GPX is a huge effort, I'd like to change it bit by bit, i.e. reading the subtree into the Class MetadataType as generated with xjc from the XSD file the remaining GPX file is parsed with DOM, until shows up: private void parseMetadata(MetadataType metadata, Element element) throws JAXBException { try { System.out.println(element.getNodeName()); // output: metadata JAXBContext context = JAXBContext.newInstance(MetadataType.class); javax.xml.bind.Unmarshaller u = context.createUnmarshaller(); JAXBElement<MetadataType> meta = u.unmarshal(element, MetadataType.class); metadata = meta.getValue(); } catch (Exception e) { e.printStackTrace(); } System.out.println(metadata.getName()); // NULL System.out.println(metadata.getAuthor().getName()); // NULL } throws javax.xml.bind.UnmarshalException: unexpected element (uri:"", local:"metadata"). Expected elements are <{http://www.topografix.com/GPX/1/1}gpx> at com.sun.xml.internal.bind.v2.runtime.unmarshaller.UnmarshallingContext.handleEvent(UnmarshallingContext.java:647) the class looks like this: @XmlAccessorType(XmlAccessType.FIELD) @XmlType(name = "metadataType", propOrder = { "name", "desc", "author", "copyright", "link", "time", "keywords", "bounds", "extensions" }) @XmlRootElement(name = "metadata") public class MetadataType { protected String name = ""; protected String desc = ""; protected PersonType author; protected CopyrightType copyright = new CopyrightType(); protected List<LinkType> link = new ArrayList<LinkType>(); @XmlSchemaType(name = "Date") protected Date time; protected String keywords = ""; protected BoundsType bounds = new BoundsType(); protected ExtensionsType extensions = new ExtensionsType(); [...] } is it possible to unmarshal from an XML subtree; and if yes, what am I doing wrong? UPDATE/1: thanks to lexicore, I'm a step further: element definitely contains the metadata …
type: Question
has answer: http://stackoverflow.com/a/22741127

http://stackoverflow.com/q/22705107
tagged with: jsp
upvote count: 1
accepted answer: http://stackoverflow.com/a/22705145
favorite count: 0
has title: How to iterate the map by using jstl?
has body: Could anyone please explain me about How to iterate this map separately department and reporting to in the below example using jstl. Map&lt;String, List&lt;Object&gt;&gt; map = new HashMap&lt;String, List&lt;Object&gt;&gt;(); List&lt;EmployeeDeparment&gt; department = Emp.getEmployeeDepartment(EmployeeId); map.put("department", department); map.put("allreportingTo", allreportingTo); map.put("alldepartments", alldepartments); request.setAttribute("map", map);
has answer: http://stackoverflow.com/a/22705145
has answer: http://stackoverflow.com/a/22705369
tagged with: spring
tagged with: dictionary
answer count: 4
type: AnsweredQuestion
downvote count: 0
score: 1
tagged with: java
possible better answer: http://stackoverflow.com/a/22705369
type: Question
tagged with: jstl
has answer: http://stackoverflow.com/a/22705654
has answer: http://stackoverflow.com/a/22705782

multithreading
tags question: http://stackoverflow.com/q/22694833
tags question: http://stackoverflow.com/q/22733620
tags question: http://stackoverflow.com/q/22776125
tags question: http://stackoverflow.com/q/22797274
tags question: http://stackoverflow.com/q/22800319
tags question: http://stackoverflow.com/q/22671923
tags question: http://stackoverflow.com/q/22686107
tags question: http://stackoverflow.com/q/22759590
tags question: http://stackoverflow.com/q/22741878
type: Tag
tags question: http://stackoverflow.com/q/22752421
tags question: http://stackoverflow.com/q/22668286
tags question: http://stackoverflow.com/q/22808393
tags question: http://stackoverflow.com/q/22689831
tags question: http://stackoverflow.com/q/22744941
tags question: http://stackoverflow.com/q/22709661
tags question: http://stackoverflow.com/q/22679726
tags question: http://stackoverflow.com/q/22655734
tags question: http://stackoverflow.com/q/22657019
tags question: http://stackoverflow.com/q/22723506
tags question: http://stackoverflow.com/q/22807330
tags question: http://stackoverflow.com/q/22712458
tags question: http://stackoverflow.com/q/22768787
tags question: http://stackoverflow.com/q/22782836
tags question: http://stackoverflow.com/q/22660225
tags question: http://stackoverflow.com/q/22804359
tags question: http://stackoverflow.com/q/22717156
tags question: http://stackoverflow.com/q/22787482
tags question: http://stackoverflow.com/q/22674497
tags question: http://stackoverflow.com/q/22805909
tags question: http://stackoverflow.com/q/22659193
tags question: http://stackoverflow.com/q/22793454
tags question: http://stackoverflow.com/q/22664200
tags question: http://stackoverflow.com/q/22715833
tags question: http://stackoverflow.com/q/22712564
tags question: http://stackoverflow.com/q/22648721
tags question: http://stackoverflow.com/q/22793003
tags question: http://stackoverflow.com/q/22709634
tags question: http://stackoverflow.com/q/22718849
tags question: http://stackoverflow.com/q/22748273
tags question: http://stackoverflow.com/q/22743223
tags question: http://stackoverflow.com/q/22732416
tags question: http://stackoverflow.com/q/22779540
tags question: http://stackoverflow.com/q/22696499
tags question: http://stackoverflow.com/q/22747601
tags question: http://stackoverflow.com/q/22779772
tags question: http://stackoverflow.com/q/22687786
tags question: http://stackoverflow.com/q/22674712
tags question: http://stackoverflow.com/q/22710531
tags question: http://stackoverflow.com/q/22731462
tags question: http://stackoverflow.com/q/22661660
tags question: http://stackoverflow.com/q/22742089
tags question: http://stackoverflow.com/q/22727925
tags question: http://stackoverflow.com/q/22755886
tags question: http://stackoverflow.com/q/22703530
tags question: http://stackoverflow.com/q/22716685
tags question: http://stackoverflow.com/q/22677362
tags question: http://stackoverflow.com/q/22755997
tags question: http://stackoverflow.com/q/22710886
tags question: http://stackoverflow.com/q/22686920
tags question: http://stackoverflow.com/q/22662957
tags question: http://stackoverflow.com/q/22754261
tags question: http://stackoverflow.com/q/22798873
tags question: http://stackoverflow.com/q/22732175
tags question: http://stackoverflow.com/q/22742612
tags question: http://stackoverflow.com/q/22756940
tags question: http://stackoverflow.com/q/22759281
tags question: http://stackoverflow.com/q/22720411
tags question: http://stackoverflow.com/q/22781940
tags question: http://stackoverflow.com/q/22651383
tags question: http://stackoverflow.com/q/22730138
tags question: http://stackoverflow.com/q/22794383
tags question: http://stackoverflow.com/q/22739707
tags question: http://stackoverflow.com/q/22736170
tags question: http://stackoverflow.com/q/22805176
tags question: http://stackoverflow.com/q/22738570
tags question: http://stackoverflow.com/q/22743179
tags question: http://stackoverflow.com/q/22690009
tags question: http://stackoverflow.com/q/22650465
tags question: http://stackoverflow.com/q/22770278

http://stackoverflow.com/comment/34534177
type: QuestionComment
has text: Check https://issues.jboss.org/browse/JBAS-6429 also check http://stackoverflow.com/questions/9410545/jboss-5-0-starting-error
type: Comment
comment on: http://stackoverflow.com/q/22669879
score: 0

http://stackoverflow.com/a/22695943
has comment: http://stackoverflow.com/comment/34583002
upvote count: 1
has comment: http://stackoverflow.com/comment/34580736
has comment: http://stackoverflow.com/comment/42341235
has body: There's no such thing as a framework being more or less RESTful than the others. This is like saying the materials used to build a house make it more or less fitting to a particular architectural style. What will say if your application is more or less RESTful is how you design it, and how your clients access it. You can have a RESTful application using no framework at all, as long as it fills the REST constraints. And you can make an application that isn't RESTful at all if you disregard those. What will dictate if your application is more or less REST than others isn't the framework you're using, it's: Being stateless. Being cacheable. Clients don't require out-of-band information (HATEOAS). Respecting the standards of the underlying protocol. Respecting the client-server architecture. Be aware that REST isn't an adequate solution to most problems people have. What most people call REST is simply any HTTP API that isn't SOAP, and your colleagues are probably just trying to appeal to REST as an authority in order to give weight to their personal preferences.
answers question: http://stackoverflow.com/q/22694602
type: Answer
downvote count: 0
score: 1
has comment: http://stackoverflow.com/comment/34587966

http://stackoverflow.com/comment/34577303
type: Comment
has text: Use `Overflow.VISIBLE` property `.getElement().getStyle().setOverflow(Overflow.VISIBLE)`
comment on: http://stackoverflow.com/a/22670624
type: AnswerComment
score: 0

http://stackoverflow.com/q/22720268
answer count: 2
has body: I'm making classes for shapes, just a quick question on the attributes of them. The first shape is: Triangle -sides:int = 3 When it says '-sides:int = 3' is it telling me there are three sides or is it saying each side has a value of 3? The second shape is: Rectangle -sides = 4; Again is it 4 sides or each side is the value of 4? Sorry this is a stupid question and as I think about it more it's probably the number of sides but if somebody could just clarify this for me it would be much appreciated. Thank you.
has comment: http://stackoverflow.com/comment/34624508
upvote count: 1
tagged with: java
tagged with: uml
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/34624560
downvote count: 0
has title: I need some clarification concerning UML diagrams
favorite count: 0
type: Question
score: 1
has answer: http://stackoverflow.com/a/24075231
has answer: http://stackoverflow.com/a/24075074

http://stackoverflow.com/comment/34648463
has text: @RyanHosford please see in the gen folder of your project, under the package name you should see R.java. do you see it?
score: 0
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/22733515

http://stackoverflow.com/q/22717249
type: AnsweredQuestion
tagged with: activemq-classic
score: 0
tagged with: java
has answer: http://stackoverflow.com/a/22717539
type: Question
has answer: http://stackoverflow.com/a/22727971
possible better answer: http://stackoverflow.com/a/22717539
tagged with: apache-camel
answer count: 3
has body: We have a requirement where we are trying to send a huge xml payload from an activemq queue to an oracle aq queue using Camel. The payload is more than 4000 bytes. So, Camel cannot send this message across as Oracleaq tried to convert this message to a VARCHAR which has a limit of 4000 charecters. So, how do we pass these huge payloads to Oracle. Do I have to set something in camel so that message is handed over to oracle as a 'CLOB' instead of a 'VARCHAR'? or is it something that needs to be done on oracle's side?
tagged with: jms
accepted answer: http://stackoverflow.com/a/22727971
has answer: http://stackoverflow.com/a/22737989
tagged with: oracle-database
has title: Camel sending messages to OracleAQ issues

http://stackoverflow.com/a/22695470
has comment: http://stackoverflow.com/comment/34579357
answers question: http://stackoverflow.com/q/22695408
has body: Make your Module variable an instance variable in your test class, instead of a local variable in a method. Then the @Before method will just initialize the variable, not declare it too. Then it will be in scope in any @Test method. Incidentally, compare your string contents with String's equals method, not ==.
has comment: http://stackoverflow.com/comment/34579152
type: Answer
upvote count: 2
score: 1
downvote count: 1

http://stackoverflow.com/a/22791312
downvote count: 0
has body: Autoboxing here means that int x = obj; is actually: int x = obj.intValue(); and hence the NullPointerException, as obj is null.
type: Answer
answers question: http://stackoverflow.com/q/22791257
score: 3
upvote count: 3

http://stackoverflow.com/q/22762473
has body: Here I created a return type of class Point. Also What do I write after "return" statement class Point{ int x=2; int y=4; } class TwoPoint{ public static void main(String args[]){ Point obj1=new Point(); Point obj2=new Point(); System.out.println(obj1.x); System.out.println(obj2.y); } public Point newFunction(int a,int b){ } }
has comment: http://stackoverflow.com/comment/34700186
downvote count: 2
score: -2
answer count: 1
has comment: http://stackoverflow.com/comment/34700518
has comment: http://stackoverflow.com/comment/34700659
has comment: http://stackoverflow.com/comment/34700381
favorite count: 0
upvote count: 0
has answer: http://stackoverflow.com/a/22763142
accepted answer: http://stackoverflow.com/a/22763142
has comment: http://stackoverflow.com/comment/34700253
type: Question
type: AnsweredQuestion
has title: What would be returned if a method return type is of a self created class?
has comment: http://stackoverflow.com/comment/34700183
tagged with: java
has comment: http://stackoverflow.com/comment/34700448

http://stackoverflow.com/q/22648226
favorite count: 0
has comment: http://stackoverflow.com/comment/34495637
has comment: http://stackoverflow.com/comment/34495712
type: Question
answer count: 2
upvote count: 1
has title: How to call a method that deals with arrays
has answer: http://stackoverflow.com/a/22648264
tagged with: java
has answer: http://stackoverflow.com/a/22648419
tagged with: methods
linked to: http://stackoverflow.com/q/7795303
tagged with: arrays
has comment: http://stackoverflow.com/comment/34495203
type: UnansweredQuestion
score: -3
has body: Prompt: Write a method that reverses the sequence of elements in an array. For example, if you call the method with the array 1 4 9 16 9 7 4 9 11 then the array is changed to 11 9 4 7 9 16 9 4 1 Here's what I have so far. I have no idea on how to call the method... public static void main(String[] args) { int [] array = {1,4,9,16,9,7,4,9,11}; System.out.println(reverse(array[])); } public static void reverse (int[]a){ for (int i = 0; i &lt; a.length/2; i++){ double temp = a[i]; a[i] = a[a.length - i -1]; temp = a[a.length - i - 1]; } }
downvote count: 4

http://stackoverflow.com/comment/34539853
has text: So,when I try basically the same as the code above findViewById always returns null, what could I be doing wrong?
score: 0
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/22662711

http://stackoverflow.com/comment/34542161
score: 0
has text: Gotcha. Well one issue I have personally run into with GridView resizing is when items are added dynamically, the height get set such that it only shows one row. [This solution](http://stackoverflow.com/questions/6005245/how-to-have-a-gridview-that-adapts-its-height-when-items-are-added) fixed my problem but am not sure if this will help your problem
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/22674183

http://stackoverflow.com/comment/34717496
has text: @JimGarrison Thanks. I guess it wasn't a great answer in its original form. I took it for granted that "references" were understood. I've added some explanation.
comment on: http://stackoverflow.com/a/22771521
type: Comment
score: 0
type: AnswerComment

http://stackoverflow.com/a/22780366
score: 5
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/34732239
type: Answer
has comment: http://stackoverflow.com/comment/34732215
answers question: http://stackoverflow.com/q/22780293
accepted answer of: http://stackoverflow.com/q/22780293
has comment: http://stackoverflow.com/comment/34732148
upvote count: 5
has body: You have to use equals to compare Object equality. != or == compare references. BigInteger b0 = new BigInteger("0"); BigInteger b1 = new BigInteger("0"); System.out.println(b0 != b1); System.out.println(!b0.equals(b1)); Output true false

http://stackoverflow.com/comment/34548077
score: 0
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/22678078
has text: I followed what you said until "Then check the second part (zero based index) to retrieve the service category and add the value in the third part to the relevant total." That made so little sense to me, would you be so kind as to elaborate in simpler terms please. :|

http://stackoverflow.com/comment/34705667
comment on: http://stackoverflow.com/q/22761663
has text: Thanks @CeilingGecko will definetely try this one out.
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/q/22725122
tagged with: android
accepted answer: http://stackoverflow.com/a/22725169
score: -1
type: AnsweredQuestion
has body: I have just started learning how to make an android app, and for my first try by myself, I decided to make a Tic Tac Toe game. Unfortunately, whenever i try to run the app on the emulator, it crashes. I checked the logcat, and i have narrowed the crash down to this error : 03-28 19:23:45.385: E/AndroidRuntime(1095): Caused by:android.content.res.Resources$NotFoundException: String resource ID #0x0 The only problem is, that i can't find where this error is coming from. Code is: public class Main extends ActionBarActivity { TextView compChoice, highscore; Button rock, paper, scissors; int scoreCount = 0; boolean win = false; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.fragment_main); compChoice = (TextView) findViewById(R.id.compChoice); highscore = (TextView) findViewById(R.id.highscore); rock = (Button) findViewById(R.id.rock); paper = (Button) findViewById(R.id.paper); scissors = (Button) findViewById(R.id.scissors); rock.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { boolean won = roll(0); if (won) { scoreCount++; } else{ scoreCount = 0; } } }); paper.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { boolean won=roll(1); if (won) { scoreCount++; } else{ scoreCount = 0; } } }); scissors.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { boolean won= roll(2); if (won) { scoreCount++; } else{ scoreCount = 0; } } }); highscore.setText(scoreCount); } public boolean roll(int choice) { int comp = (int) (Math.random()*3); if(choice == 0 &amp;&amp; comp == 2){ win = true; compChoice.setText("Scissors"); } if(choice == 1 &amp;&amp; comp == 0){ win = true; compChoice.setText("Rock"); } if(choice == 2 &amp;&amp; comp == 1){ win = true; compChoice.setText("Paper"); } if (choice == 0 &amp;&amp;comp==1) { win=false; compChoice.setText("Paper"); } if (choice == 1 &amp;&amp;comp==2) { win=…
has title: Android app development getting resourceNotFoundException
downvote count: 1
tagged with: resources
type: Question
tagged with: java
has answer: http://stackoverflow.com/a/22725169
tagged with: eclipse
upvote count: 0
tagged with: adk
answer count: 1
favorite count: 0

http://stackoverflow.com/a/22733739
upvote count: 1
downvote count: 0
answers question: http://stackoverflow.com/q/22731018
has body: Check out Darryl's Stretch Icon which will grow/shrink the Icon based on the space available in the label.
type: Answer
score: 1

http://stackoverflow.com/comment/34651957
comment on: http://stackoverflow.com/a/22735732
score: 0
type: AnswerComment
has text: compare using "compareTo" method char c1 = 'x'; char c2 = 'y'; c1.compareTo(c2) and dont initialize array as null
type: Comment

http://stackoverflow.com/a/22713609
has comment: http://stackoverflow.com/comment/34616970
has comment: http://stackoverflow.com/comment/34614975
has comment: http://stackoverflow.com/comment/34612383
score: 0
answers question: http://stackoverflow.com/q/22713208
has body: @Thomas gave nice response, but I dont agree with one thing. According to Javadoc for Error class, you should never try to catch Error or any Subclass. Make sure you will never end up here and IF YOU EXPECT ERROR = BAD DESIGN/ALGORITHM
has comment: http://stackoverflow.com/comment/34612281
type: Answer

http://stackoverflow.com/comment/34676202
has text: You do realize that they delay between the first keyPressed and the second (and repeated key events) is different and os specific...
type: Comment
comment on: http://stackoverflow.com/a/22749229
score: 0
type: AnswerComment

http://stackoverflow.com/comment/34581681
comment on: http://stackoverflow.com/q/22672460
score: 0
type: Comment
has text: Yayy! :D Happy coding my friend.
type: QuestionComment

http://stackoverflow.com/comment/34579101
comment on: http://stackoverflow.com/q/22693792
has text: @PeterMmm I specifically said "disk"
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/q/22770785
tagged with: android
has body: I'm using OS X Mavericks. I've installed apple's Java and JDK 8 and 7 from Oracle. Downloaded Android ADT. When I run eclipse, it shows me this error on build. I couldn't use eclipse. Do you have any idea about that problem? An internal error occurred during: "Building workspace". posix_spawn is not a supported process launch mechanism on this platform. java.lang.Error: posix_spawn is not a supported process launch mechanism on this platform. at java.lang.UNIXProcess$1.run(UNIXProcess.java:105) at java.lang.UNIXProcess$1.run(UNIXProcess.java:94) at java.security.AccessController.doPrivileged(Native Method) at java.lang.UNIXProcess.&lt;clinit&gt;(UNIXProcess.java:92) at java.lang.ProcessImpl.start(ProcessImpl.java:130) at java.lang.ProcessBuilder.start(ProcessBuilder.java:1023) at java.lang.Runtime.exec(Runtime.java:620) at java.lang.Runtime.exec(Runtime.java:485) at com.android.ide.eclipse.adt.internal.build.builders.PreCompilerBuilder.execAapt(PreCompilerBuilder.java:1225) at com.android.ide.eclipse.adt.internal.build.builders.PreCompilerBuilder.handleResources(PreCompilerBuilder.java:1123) at com.android.ide.eclipse.adt.internal.build.builders.PreCompilerBuilder.build(PreCompilerBuilder.java:720) at org.eclipse.core.internal.events.BuildManager$2.run(BuildManager.java:733) at org.eclipse.core.runtime.SafeRunner.run(SafeRunner.java:42) at org.eclipse.core.internal.events.BuildManager.basicBuild(BuildManager.java:206) at org.eclipse.core.internal.events.BuildManager.basicBuild(BuildManager.java:246) at org.eclipse.core.internal.events.BuildManager$1.run(BuildManager.java:299) at org.eclipse.core.runtime.SafeRunner.run(SafeRunner.java:42) at org.eclipse.core.internal.events.BuildManager.basicBuild(BuildManager.java:302) at org.eclipse.core.internal.events.BuildManager.basicBuildLoop(BuildManager.java:358) at org.eclipse.core.internal.events.BuildManager.build(BuildManager.java:381) at org.eclipse.core.internal.events.AutoBuildJob.doBuild(AutoBuildJob.java:143) at org…
has answer: http://stackoverflow.com/a/28474254
has answer: http://stackoverflow.com/a/24293960
score: 2
tagged with: osx-mavericks
tagged with: java
has answer: http://stackoverflow.com/a/42168283
tagged with: eclipse
type: Question
downvote count: 0
answer count: 6
has answer: http://stackoverflow.com/a/23953667
has answer: http://stackoverflow.com/a/26930835
has answer: http://stackoverflow.com/a/26910316
tagged with: macos
favorite count: 0
has comment: http://stackoverflow.com/comment/34716949
has title: Eclipse Error on Mavericks: posix_spawn is not a supported process launch mechanism on this platform
upvote count: 2
type: UnansweredQuestion

http://stackoverflow.com/comment/34590321
type: QuestionComment
has text: That makes sense. I was thinking Java in which object assignment is always pointers. Moreover I'd also have to consider retain/release/... Thanks
comment on: http://stackoverflow.com/q/22675395
score: 0
type: Comment

http://stackoverflow.com/a/22784733
has comment: http://stackoverflow.com/comment/34740072
type: Answer
accepted answer of: http://stackoverflow.com/q/22784617
has comment: http://stackoverflow.com/comment/34740391
upvote count: 2
has comment: http://stackoverflow.com/comment/34740544
score: 2
has body: Key data actually contains JSONArray of JSONObjects, so at first you should get the needed item, then get the value at the key. Replace this: json.get("totalTradedVolume") with this: json.getJsonArray("data").getJsonObject(0).getString("totalTradedVolume") Please note, that your example contains only one item in JSONArray, but if you have multiple items inside it, you may want to iterate over them.
has comment: http://stackoverflow.com/comment/34739816
type: AcceptedAnswer
downvote count: 0
answers question: http://stackoverflow.com/q/22784617
has comment: http://stackoverflow.com/comment/34739875

http://stackoverflow.com/comment/34757824
has text: Hi Ashish, can you let me know any tutorial that i can follow for this?
comment on: http://stackoverflow.com/q/22787345
type: Comment
type: QuestionComment
score: 0

http://stackoverflow.com/a/22701572
answers question: http://stackoverflow.com/q/22701148
type: Answer
has body: In the Run Configuration dialog, check the Before Launch pane. You can run an external tool or a Maven goal (if it's a Maven project) by clicking the + button. That should give you lots of flexibility.
downvote count: 0
score: 1
has comment: http://stackoverflow.com/comment/34591700
has comment: http://stackoverflow.com/comment/34603512
upvote count: 1
accepted answer of: http://stackoverflow.com/q/22701148
type: AcceptedAnswer

http://stackoverflow.com/q/22701467
score: 0
tagged with: java
type: Question
has title: Storing raw xml data with stax without parsing
has body: Can anyone provide me information on how to store raw xml with java stax? Their is plenty of information available on how to parse the xml with stax, but is it possible to capture the actual xml data based on a tag name or root element? For example, if the below xml comes in, how can I store it in as a string exactly how it came in? Bob
answer count: 1
has answer: http://stackoverflow.com/a/22701655
tagged with: stax
type: UnansweredQuestion
tagged with: http://stackoverflow.com/tag/xml

http://stackoverflow.com/comment/72481756
comment on: http://stackoverflow.com/a/22703215
has text: @StevenVascellaro I think you might have misunderstood my answer :P I actually said the opposite i.e. if it's a GUI based application, you can simply double click it. Otherwise, you'll need to run it via the terminal :)
type: AnswerComment
score: 0
type: Comment

http://stackoverflow.com/q/22685930
has comment: http://stackoverflow.com/comment/34561544
favorite count: 0
tagged with: interface
upvote count: 76
has body: Suppose I have two interfaces: public interface I1 { default String getGreeting() { return "Good Morning!"; } } public interface I2 { default String getGreeting() { return "Good Afternoon!"; } } If I want to implement both of them, what implementation will be used? public class C1 implements I1, I2 { public static void main(String[] args) { System.out.println(new C1().getGreeting()); } }
has comment: http://stackoverflow.com/comment/34713115
tagged with: java-8
has comment: http://stackoverflow.com/comment/34561976
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/71795225
has answer: http://stackoverflow.com/a/64184120
has answer: http://stackoverflow.com/a/49525476
tagged with: java
has answer: http://stackoverflow.com/a/25870578
type: Question
has comment: http://stackoverflow.com/comment/34562108
has answer: http://stackoverflow.com/a/22685931
accepted answer: http://stackoverflow.com/a/22685931
has comment: http://stackoverflow.com/comment/136683508
has answer: http://stackoverflow.com/a/22686386
has title: Implementing two interfaces with two default methods of the same signature in Java 8
has answer: http://stackoverflow.com/a/23454932
possible better answer: http://stackoverflow.com/a/22686386
linked to: http://stackoverflow.com/q/19976487
downvote count: 1
answer count: 7
score: 75

http://stackoverflow.com/comment/34643438
has text: You will have do something like children.clear(); List list1 = values.subList(indexNum, values.size()); List list2 = values.subList(0, indexNum -1); children.addAll(list1); children.addAll(list2);
score: 0
comment on: http://stackoverflow.com/a/22730770
type: AnswerComment
type: Comment

http://stackoverflow.com/comment/34739139
type: AnswerComment
score: 0
type: Comment
comment on: http://stackoverflow.com/a/22783919
has text: thanks for your reply but I can not make it work. Can you help me modify the method doInBackground?

http://stackoverflow.com/comment/34769443
type: Comment
comment on: http://stackoverflow.com/a/22800955
type: AnswerComment
score: 0
has text: null check pls `public int compareTo(PostalCodes other) { return other==null ? 1 : city.compareTo(other.getLocation()); }`

http://stackoverflow.com/comment/34543120
has text: Does your study guide actually say `new Manager;` without any parentheses? The Java compiler will spit that out. If it does, please let us know who the publisher is so we can send them a nasty letter :) :) :) :)
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/22675026

http://stackoverflow.com/q/22790417
type: Question
has body: public class X { public void close() { // ... } public class XInputStream extends InputStream { public void f() { close(); // are we calling close() on InputStream or X?? } } } The compiler is fine with this sort of thing, so obviously it knows which method to call. What exactly is the rule in the language spec for resolving this? Other than renaming my close() method, are there any steps I could take to make this code more readable?
answer count: 2
accepted answer: http://stackoverflow.com/a/22790501
score: 0
possible better answer: http://stackoverflow.com/a/22790617
has answer: http://stackoverflow.com/a/22790617
type: AnsweredQuestion
has title: Resolving method name from inner class
tagged with: java
has answer: http://stackoverflow.com/a/22790501

http://stackoverflow.com/comment/34712850
type: AnswerComment
has text: In getWeatherCounts, you are returning tally in 2 different places. Delete the first one.
type: Comment
comment on: http://stackoverflow.com/a/22768699
score: 0

http://stackoverflow.com/comment/34521087
comment on: http://stackoverflow.com/q/22663078
type: Comment
type: QuestionComment
has text: If you simply call containsValue(null) on the map, you didn't gain anything. You still have no entry point for deleting anything. The algorithm should be "Iterate over all entries in the map. With each entry, check if value == null. If yes, delete the entry." Are you able to transfer that into a code snippet?
score: 0

http://stackoverflow.com/a/22680573
accepted answer of: http://stackoverflow.com/q/22679717
type: Answer
has body: BufferedImage img = ImageIO.read(...); Image scaled = img.getScaledInstance(500, 500, Image.SCALE_SMOOTH); ImageIcon icon = new ImageIcon(scaled); Beware, that this will scale the image so that it is square. Take a look at Java: maintaining aspect ratio of JPanel background image which discusses maintaining the aspect ratio of the image when scaled. Also, you should read The Perils of Image.getScaledInstance() and have a look at Scale the ImageIcon automatically to label size which uses a divide and conqure scaling algorithim and Quality of Image after resize very low -- Java which demonstrates the issues of doing a one step scale...
answers question: http://stackoverflow.com/q/22679717
score: 2
downvote count: 0
upvote count: 2
type: AcceptedAnswer

http://stackoverflow.com/q/22757505
tagged with: focus
has body: Hey I have a panel class in which there are two panels, one of the panels have text field. I want to perform an action when it gets focused. The panel is added on the main frame.
type: AnsweredQuestion
score: 1
possible better answer: http://stackoverflow.com/a/22757551
tagged with: focuslistener
tagged with: swing
has title: How to find which component is focused?
has answer: http://stackoverflow.com/a/33118448
type: Question
tagged with: java
answer count: 3
upvote count: 1
has answer: http://stackoverflow.com/a/22757551
downvote count: 0
tagged with: awt
favorite count: 0
has answer: http://stackoverflow.com/a/22757559
accepted answer: http://stackoverflow.com/a/22757559

http://stackoverflow.com/q/22774660
has body: I have to keep it in the case 'A' Format i just don't understand what I should have in the (char c) because that seems to be where the error is coming from. If anyone has any suggestions it would be greatly appreciated. public class PhoneNumber { private int areacode; private int number; private int ext; PhoneNumber() { areacode = 0; number = 0; ext = 0; } PhoneNumber(int newnumber) { areacode = 216; number = newnumber; ext = 0; } PhoneNumber(int newarea, int newnumber, int newext) { areacode = newarea; number = newnumber; ext = newext; } PhoneNumber(String newnumber) { String areacode = str[0]; String number = str[1]; String[] str = newnumber.split("-"); String[] number = newnumber; boolean b1, b2; int i = 0; int place = 0; for (int x: newnumber){ newnumber.charAt[i] = place; b1 = Character.isDigit(place); if (b1 == true){ number = place; i++; } else { b2 = Character.isLetter(place); } if (b2 == true) { number = decode(place); i++; } else { System.out.print("invalid phone number!"); } } System.out.print(areacode.concat(number)); return newnumber; } private String decode(place) { switch (c) { case 'A': case 'B': case 'C': return "2"; case 'D': case 'E': case 'F': return "3"; case 'G': case 'H': case 'I': return "4"; case 'J': case 'K': case 'L': return "5"; case 'M': case 'N': case 'O': return "6"; case 'P': case 'Q': case 'R': case 'S': return "7"; case 'T': case 'U': case 'V': return "8"; case 'W': case 'X': case 'Y': case 'z': return "9"; default: return ""; } } public boolean equals(PhoneNumber pn) { //not complete } public String toString() { //not complete } } Here is the error: G:\CIS260\Assignments&gt;javac PhoneNumber.java PhoneNumber.java:53: error: &lt;identifier&gt; expected private String decode(place) { ^ 1 error
has comment: http://stackoverflow.com/comment/34722888
has title: Syntax error on boolean declaration
has comment: http://stackoverflow.com/comment/34722482
type: AnsweredQuestion
tagged with: java
downvote count: 1
type: Question
upvote count: 0
score: -1
has answer: http://stackoverflow.com/a/22774894
tagged with: class
has comment: http://stackoverflow.com/comment/34722931
tagged with: char
answer count: 1
has comment: http://stackoverflow.com/comment/34722374
favorite count: 0
has comment: http://stackoverflow.com/comment/34722437
has comment: http://stackoverflow.com/comment/34722305
has comment: http://stackoverflow.com/comment/34722874
has comment: http://stackoverflow.com/comment/34722810
accepted answer: http://stackoverflow.com/a/22774894

http://stackoverflow.com/comment/34566266
comment on: http://stackoverflow.com/q/22688688
type: Comment
type: QuestionComment
has text: Good God, why?!
score: 11

http://stackoverflow.com/comment/34659455
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/22740056
has text: I didn't quite follow your explanation, but just by looking at the fact that your code has 3 nested loops, I can tell it won't work for string lengths greater than 3. A better way to generate permutations, without duplicates, is to try putting each of the characters in position 1, and for each possibility, *calling the routine recursively to find a list of all the permutations of the remaining characters*. You then just append each such sub-permutation to your current first character.

http://stackoverflow.com/a/22703293
has comment: http://stackoverflow.com/comment/34678529
answers question: http://stackoverflow.com/q/22701853
has comment: http://stackoverflow.com/comment/34621583
score: 0
has body: It looks like your eclipse "run as web application" setting is using Jetty instead of tomcat, and somehow that result in different classpath configuration. By the look of it you're likely to miss some jars (camel related) on jetty. This normally happen if you don't use dependency management like maven, ie: you have to consciously manage what path is / not included in your classpath at which environment. An easier approach is to use the same container for both production and development, and ensure additional jar you need is included in WEB-INF/lib by declaring it in maven pom.
type: Answer

http://stackoverflow.com/comment/34769460
type: Comment
score: 0
has text: Technically correct on the null check, but that's implementation specific - if `city` is guaranteed to be never null, then there's no need. That, and having no null check here early on highlights places in which that assumption may be invalid.
comment on: http://stackoverflow.com/a/22800955
type: AnswerComment

http://stackoverflow.com/q/22784209
has answer: http://stackoverflow.com/a/22784942
possible better answer: http://stackoverflow.com/a/22784333
answer count: 3
tagged with: locking
downvote count: 0
has body: Attached the code.. what does this mean, synchronized(m)..?? why we should use that..?? What's the difference between synchronized(this) &amp; synchronized(m)..?? class Waiter implements Runnable { Message m; public Waiter(Message m) { this.m = m; } @Override public void run() { String name = Thread.currentThread().getName(); synchronized (m) { try { System.out.println("Waiting to get notified at time " +System.currentTimeMillis()); m.wait(); } catch (InterruptedException ex) { ex.printStackTrace(); } System.out.println("Waiter thread notified at time "+System.currentTimeMillis()); System.out.println("Message processed "); } } }
tagged with: synchronized
favorite count: 0
has comment: http://stackoverflow.com/comment/34740056
accepted answer: http://stackoverflow.com/a/22784942
has comment: http://stackoverflow.com/comment/34738938
type: AnsweredQuestion
score: 1
tagged with: multithreading
has comment: http://stackoverflow.com/comment/34738878
upvote count: 1
type: Question
tagged with: object
has answer: http://stackoverflow.com/a/22784626
has answer: http://stackoverflow.com/a/22784333
has title: what does it mean when we say synchronized(instance field)..?
tagged with: java

http://stackoverflow.com/comment/44857913
has text: Stackoverflow is not a code generating site.
score: 0
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/22766210

http://stackoverflow.com/comment/34629998
score: 0
has text: @isnot2bad : If I want the objects to continue in a standard "speed" and sacrifice the animation, what is the better way? I feel that if the render loop starts taking a long time, it won't effect my update thread which means that my objects will continue to "move" at the right speed. (even if it isn't drawn as often) What is the solution to that with only one thread? Also, I have tried wrapping "synchronized" around my LinkedList and Object instance with no luck.
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/22720411

http://stackoverflow.com/q/22734660
has comment: http://stackoverflow.com/comment/34650153
score: 17
has answer: http://stackoverflow.com/a/22734750
has answer: http://stackoverflow.com/a/51802435
has comment: http://stackoverflow.com/comment/34650167
downvote count: 0
has answer: http://stackoverflow.com/a/22734856
has answer: http://stackoverflow.com/a/43012870
favorite count: 0
has title: Why is Optional<T> declared as a final class?
possible better answer: http://stackoverflow.com/a/43012870
answer count: 4
type: AnsweredQuestion
linked to: http://stackoverflow.com/q/22725537
has comment: http://stackoverflow.com/comment/34650143
accepted answer: http://stackoverflow.com/a/22734856
tagged with: java-8
upvote count: 17
type: Question
has body: I was playing with the following question: Using Java 8&#39;s Optional with Stream::flatMap and wanted to add a method to a custom Optional&lt;T&gt; and then check if it worked. More precise, I wanted to add a stream() to my CustomOptional&lt;T&gt; that returns an empty stream if no value is present, or a stream with a single element if it is present. However, I came to the conclusion that Optional&lt;T&gt; is declared as final. Why is this so? There are loads of classes that are not declared as final, and I personally do not see a reason here to declare Optional&lt;T&gt; final. As a second question, why can not all methods be final, if the worry is that they would be overridden, and leave the class non-final?
tagged with: java

http://stackoverflow.com/q/22673772
type: UnansweredQuestion
has title: NullPointerException error in Main
tagged with: java
downvote count: 1
type: Question
has body: Trying to read a file when the user enters the file name into the console. The program compiles and runs with no errors. Once you enter the file name and press enter, you get this error. Can't figure out why. Any help would be appreciated. Exception in thread "main" java.lang.NullPointerException at java.io.Writer.&lt;init&gt;(Writer.java:88) at java.io.PrintWriter.&lt;init&gt;(PrintWriter.java:113) at java.io.PrintWriter.&lt;init&gt;(PrintWriter.java:100) at propertylistings.propertylistings.main(propertylistings.java:34) import java.io.BufferedWriter; import java.io.File; import java.io.FileNotFoundException; import java.io.FileWriter; import java.io.IOException; import java.io.PrintWriter; import java.util.Scanner; import java.util.Set; import java.util.SortedMap; import java.util.TreeMap; import java.util.TreeSet; public class propertylistings { public static void main(String[] args) throws FileNotFoundException { // Prompt for the input file name Scanner console = new Scanner(System.in); System.out.print("Input file: "); String inputFileName = console.next(); BufferedWriter pwfo = null; try { pwfo = new BufferedWriter(new FileWriter("C:\\agentReport.txt", true)); } catch (IOException e) { } //next line is LINE 34 PrintWriter pwo = new PrintWriter(pwfo); // Construct property type treeSet Set&lt;String&gt; propertyTypes = pTypes(inputFileName); // Print property types from treeSet for (String type : propertyTypes) { System.out.println(type); pwo.println(type); } // Construct agent ids and values treeSet Set&lt;String&gt; agentRpt = agentValue(inputFileName); // Print agent Ids and values from key set for (String tail : agentRpt) { { System.out.println(tail); pwo.println(tail); } } pwo.flush(); pwo.close(); } // Reads the input file. // @return the alphabetized property types in uppercase. public static Set&lt;String&gt; pTypes(String inputFileName) throws FileNotFoundException // Construct a tree set to return property types { Set&lt;String&gt; type = new TreeSe…
score: -1
has answer: http://stackoverflow.com/a/22673876
upvote count: 0
answer count: 1
has comment: http://stackoverflow.com/comment/34540636
favorite count: 0
tagged with: nullpointerexception

http://stackoverflow.com/q/22670646
tagged with: spring-security
favorite count: 0
has comment: http://stackoverflow.com/comment/139400861
has title: Where do I define `springSecurityFilterChain` bean?
accepted answer: http://stackoverflow.com/a/22677012
tagged with: spring
upvote count: 11
type: AnsweredQuestion
has body: When I place the bean definition for springSecurityFilterChain in web.xml, I get an error indicating that Tomcat 7 will not start because there is a duplicate bean definition for springSecurityFilterChain. I uploaded the entire stack trace to a file sharing site, which you can read by clicking on this link. However, when I the comment out the springSecurityFilterChain bean definition in web.xml and try to restart the server, I get a different error message indicating that there is no bean definition for springSecurityFilterChain. You can read the second stack trace at the file sharing site by clicking on this link. So where should I put the bean definition for springSecurityFilterChain, and what should its syntax be? I think the problem might be that the spring petclinic sample app, which I am using to test this approach, has its own way of using a clinicservice and its own xml config files to handle application startup and the management of resources. You can view the entire code for the spring petclinic app at this link. The changes I made to the petclinic app are as follows: I added the following to pom.xml: org.springframework.security spring-security-core 3.2.2.RELEASE org.springframework.security spring-security-web 3.2.2.RELEASE org.springframework.security spring-security-config 3.2.2.RELEASE I added the following to web.xml: springSecurityFilterChain org.springframework.web.filter.DelegatingFilterProxy springSecurityFilterChain /* I added a package named org.springframework.security.samples.knowledgemanager.config to src/main/java in Java Resources, and then I added the following two classes to it: MessageSecurityWebApplicationInitializer.java: @Order(2) public class MessageSecurityWebApplicationInitializer extends AbstractSecurityWebApplicationInitializer {} SecurityConfig.java: @Configuration @EnableWebMvcSecurity public class SecurityConfig extends WebSecurityConfigurerAdapter { @Autowired private DataSource dataSource; @Autowired private UserDetailsServ…
has comment: http://stackoverflow.com/comment/40797154
downvote count: 1
type: Question
tagged with: spring-mvc
tagged with: java
score: 10
answer count: 1
has answer: http://stackoverflow.com/a/22677012
linked to: http://stackoverflow.com/q/22750241

http://stackoverflow.com/comment/34716599
score: 0
type: AnswerComment
has text: The getPlaceArmiesMove method actually has more than 600 lines of Fors and Ifs,so i don't think the "trust the function" will help me, i'll try the thread thingy. If you have a good tutorial or guide about threads in java, i'll take it!Thanks a lot for your answer
comment on: http://stackoverflow.com/a/22765945
type: Comment

http://stackoverflow.com/a/22673786
type: Answer
has body: It's linear time; it does the copy, and copies take linear time. (The constant factor might be quite low, but it's still linear overall.)
downvote count: 0
score: 3
upvote count: 3
answers question: http://stackoverflow.com/q/22673776

http://stackoverflow.com/q/22750080
has comment: http://stackoverflow.com/comment/34677890
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/34703544
score: 1
tagged with: java
has comment: http://stackoverflow.com/comment/34677857
upvote count: 1
type: Question
has comment: http://stackoverflow.com/comment/34677817
accepted answer: http://stackoverflow.com/a/22765487
tagged with: android-date
has comment: http://stackoverflow.com/comment/34688978
has comment: http://stackoverflow.com/comment/36166544
has comment: http://stackoverflow.com/comment/34703908
has comment: http://stackoverflow.com/comment/34703793
downvote count: 0
answer count: 1
favorite count: 0
tagged with: date-format
tagged with: android
has answer: http://stackoverflow.com/a/22765487
has title: How can I set timezone UTC+2?
has body: I ve searched many times but I do not find really what I need, I write this to find UTC time zone : DateFormat df = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss"); df.setTimeZone(TimeZone.getTimeZone("Europe/Istanbul")); String gmtTime = df.format(new Date()); Date gmtTime_ =null; try { gmtTime_ = df.parse(gmtTime); } catch (ParseException e) { // TODO Auto-generated catch block e.printStackTrace(); } But I need UTC+2 timezone, How can I get that time zone?

http://stackoverflow.com/q/22766001
has title: Making 1 single JButton change panel background
has answer: http://stackoverflow.com/a/22766397
tagged with: java
tagged with: swing
tagged with: jbutton
type: Question
tagged with: actionlistener
has comment: http://stackoverflow.com/comment/34706694
score: 0
accepted answer: http://stackoverflow.com/a/22766397
has comment: http://stackoverflow.com/comment/34706604
tagged with: user-interface
answer count: 1
has body: Quick question how would you make 1 JButton change the color of the panel when clicked and displays what color it is I've done some tutorials having 3 JButtons color change when a different button is clicked but how you make just one JButton change the panel color for example yellow, green, and red. import javax.swing.*; import java.awt.event.*; public class ChangeButtonColor{ JButton button; public static void main(String[] args){ ChangeButtonColor cl = new ChangeButtonColor(); } public ChangeButtonColor(){ JFrame frame = new JFrame("Change JButton Color"); JPanel panel = new JPanel(); button = new JButton(); button.addActionListener(new MyAction()); frame.add(button); frame.setSize(400, 400); frame.setVisible(true); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); } public class MyAction implements ActionListener{ public void actionPerformed(ActionEvent e){ } } }
has comment: http://stackoverflow.com/comment/34706920
type: AnsweredQuestion

http://stackoverflow.com/q/22679106
has comment: http://stackoverflow.com/comment/34549931
has comment: http://stackoverflow.com/comment/34729748
tagged with: java
type: Question
has comment: http://stackoverflow.com/comment/34549958
has comment: http://stackoverflow.com/comment/34550240
score: 0
has title: Facebook developer running app now redirects to blank page
tagged with: facebook
has body: On my site there is a option to login with Facebook, for which we have integrated Facebook developer app with generated client id and secret Id. Earlier it was working fine but from last 3-4 it has stopped working. Now when I click on "Login with FB" button. It shows FB login page to fill credentials. Once I fill my id and password, it takes too much time to redirect and redirects to blank page. String url = "https://graph.facebook.com/oauth/access_token?client_id=" + client_id + "&amp;redirect_uri=" + request.getScheme() + "://" + (String) Utils.getValueFromVS(ActionConstants.APP_URL, InsightValueStack.SESSION) + "/user/fbLogin.do&amp;client_secret=" + secret_id + "&amp;code=" + code; URL url1 = new URL(url); connection = url1.openConnection(); connection.setDoOutput(true); BufferedReader reader = new BufferedReader(new InputStreamReader(connection.getInputStream())); String line; while ((line = reader.readLine()) != null) { resp_Access_token.append(line); } reader.close(); I have no idea why it is behaving like this.
tagged with: facebook-graph-api
has comment: http://stackoverflow.com/comment/34549913
answer count: 0
type: UnansweredQuestion

http://stackoverflow.com/comment/42629938
has text: So you can only have one eclipse process up at a time?
comment on: http://stackoverflow.com/a/25267720
type: AnswerComment
score: 0
type: Comment

http://stackoverflow.com/comment/34666393
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/22743969
type: Comment
has text: One more problem - you should check value of i inside synchronized block, otherwise it could be changed before entering synchronized block

http://stackoverflow.com/comment/34766889
has text: For the invalidate() call, it is saying something about 'only the original thread that created a view hierarchy can touch its views'. Does that mean that invalidate() is being called in the wrong place? Currently I have it being called at the end of drawTrail().
type: Comment
comment on: http://stackoverflow.com/a/22798758
score: 0
type: AnswerComment

http://stackoverflow.com/a/22722114
upvote count: 1
type: AcceptedAnswer
type: Answer
has comment: http://stackoverflow.com/comment/34655334
downvote count: 0
score: 1
has comment: http://stackoverflow.com/comment/34634297
has body: You will need to use one of the maven plugins available for Eclipse to initiate the run:jetty goal. There are a few available. One of them is Eclipse m2e. Install the plugin Create a new run configuration of type Maven Build Specify a goal of jetty:run
accepted answer of: http://stackoverflow.com/q/22721115
answers question: http://stackoverflow.com/q/22721115

http://stackoverflow.com/comment/41084022
has text: I did check, there is a simply a problem with the generation of the file (which is out of my control). If you look through the docs the method [create](https://poi.apache.org/apidocs/org/apache/poi/ss/usermodel/WorkbookFactory.html#create(java.io.File)) appropriately chooses the correct format. My question is aimed more towards seeing if the same error correction Excel exhibits could be replicated in some fashion for POI. Thanks for the suggestion though!
comment on: http://stackoverflow.com/a/26185462
score: 0
type: AnswerComment
type: Comment

http://stackoverflow.com/comment/34542559
comment on: http://stackoverflow.com/q/22674815
has text: look for inheritance and (for java also look into access specifiers )
type: Comment
type: QuestionComment
score: 0

http://stackoverflow.com/comment/34769448
has text: @JasonC Complex problem. Trying to find an optimal solution `:)`
comment on: http://stackoverflow.com/q/22800701
type: Comment
type: QuestionComment
score: 1

http://stackoverflow.com/comment/66741795
score: 8
has text: Added java 8 for the high rated answer: Arrays.stream(request.getCookies()).filter(t -> "cookieName".equals(t.getName())).findFirst().get()
type: AnswerComment
comment on: http://stackoverflow.com/a/22804563
type: Comment

http://stackoverflow.com/comment/44650337
type: Comment
comment on: http://stackoverflow.com/a/28126215
type: AnswerComment
has text: Thx for your answer, i will try it. I dont have expected getting an reply after nearly a year :)
score: 0

http://stackoverflow.com/q/22747612
accepted answer: http://stackoverflow.com/a/22751900
type: AnsweredQuestion
tagged with: java
tagged with: swing
has answer: http://stackoverflow.com/a/22748402
type: Question
has title: Java: Access applet fields from MouseListener class
possible better answer: http://stackoverflow.com/a/22748402
tagged with: mouse-listeners
has answer: http://stackoverflow.com/a/22751900
has comment: http://stackoverflow.com/comment/34673056
score: 0
answer count: 2
tagged with: japplet
has body: This is very, very stupid question. I'm supposed to implement mouse processing in seperate class and since I'm a total noob I have problems doing so the right way. This is my main applet class: public class MmmuhApplet extends JApplet { int x, y; // stuff (...) } And the additional class: public class MouseProcessing implements MouseListener, MouseMotionListener{ @Override public void mouseClicked(MouseEvent arg0) { // I want to pass arg0.getX() to variable x. How? } // other methods (...) } The only idea that comes to my mind is to store a reference to MmmuhApplet instance in MouseProcessing class and access x/y from there via said reference. Is it a good idea?

http://stackoverflow.com/comment/34768347
type: Comment
has text: @user102817 To print the first 3 elements of the array: `for (int i = 0; i < 3; i++) System.out.println(codesArray[i]);`
comment on: http://stackoverflow.com/a/22798597
type: AnswerComment
score: 0

http://stackoverflow.com/comment/34768546
has text: Are you referring to the TedSprite class having two mBitmapForTrails?
type: Comment
comment on: http://stackoverflow.com/a/22798758
score: 0
type: AnswerComment

http://stackoverflow.com/comment/34755882
comment on: http://stackoverflow.com/q/22773003
score: 0
type: Comment
type: QuestionComment
has text: @EdwinDalorzo His question is *why is the variable that is being defined considered already defined?*, and my comment was attempting to explain that.

http://stackoverflow.com/a/22732890
score: 1
answers question: http://stackoverflow.com/q/22732808
downvote count: 0
type: Answer
upvote count: 1
has body: You can add a boolean variable and keep there information if user has been found. Try this code: public static void main(String[] args) { Scanner kb = new Scanner(System.in); // array containing usernames String[] name = { "barry", "matty", "olly", "joey" }; // elements in // array System.out.println("Enter your name"); String name1 = kb.nextLine(); boolean b = true; for (int i = 0; i &lt; name.length; i++) { if (name[i].equals(name1)) { System.out.println("you are verified you may use the lift"); b = false; break; } } if (b) { System.out.println("Invalid entry"); } }

http://stackoverflow.com/a/22763343
has comment: http://stackoverflow.com/comment/34705235
has comment: http://stackoverflow.com/comment/34701771
has body: This may be one of those X/Y problems, where you think Y is a solution to X, so you ask for help with Y, but perhaps there is a better solution. Strictly speaking, to implement a singleton, all you need is a class whose only constructors are private, a static reference to an instance of the class as a class field, and a public getInstance method. Then create an instance method which returns the next number in line. public class MySingleton { private static MySingleton instance = new MySingleton(); private volatile int next = 0; private MySingleton() { // prevent external instantiation of a singleton. } public static MySingleton getInstance() { return instance; } public synchronized int getNextSequence() { return next++; } } There are many flaws with this solution to your problem, some are just basic OOP design and some are more systemic: A singleton that does not implement or extend any types is worthless. You could just use all static methods instead. Singletons are useful if you are writing a class that implements an interface and that interface is used by somebody else, but you only want a single instance as an implementation detail. This type of singleton is an attempt to make a global variable look like it is not a global variable. This will not survive application restarts. If these sequences are being used to identify data that is stored externally or shared, you will end up repeating the same numbers when the application is restarted. If you deploy multiple instances of the application who read and write to a common persistent storage, like a database, they will re-use the same numbers because the sequence is only tracked within the JVM. Databases are already exceptionally good at this. Trying to re-invent it in the application tier seems.... inappropriate.
answers question: http://stackoverflow.com/q/22763029
type: Answer
has comment: http://stackoverflow.com/comment/34705287
score: 4
upvote count: 4
has comment: http://stackoverflow.com/comment/34701872
has comment: http://stackoverflow.com/comment/34702502
type: AcceptedAnswer
downvote count: 0
accepted answer of: http://stackoverflow.com/q/22763029

http://stackoverflow.com/a/22697823
score: 0
type: Answer
answers question: http://stackoverflow.com/q/22697538
has body: When a method gets to a "return" statement it ends, in your case at the second if. Your total is initialized by 0 everytime the method runs, so you should consider making it global. Your method generates an exception if you try to use negative numbers as paramethers Try this: int total=0; public static int subDivByX(int n, int X) { if (n&gt;0 &amp;&amp; x&gt;0) { if (n%x==0){ total += n; } return sumDivByX(n-1,x); } else return -1; }

http://stackoverflow.com/comment/34619941
comment on: http://stackoverflow.com/q/22716581
score: 0
type: Comment
type: QuestionComment
has text: tried it just now, I changed p10kleft[i] = shiftp10kleft[i]; to p10kleft[i] = shiftp10kleft[0]; and p10kright[i] = shiftp10kright[i]; to p10kright[i] = shiftp10kright[0]; Unfortunately this was unsuccessful, the output given was Left: [1, 0, 1, 1, 1] Right: [0, 1, 0, 0, 1] Shift Left: [0, 1, 1, 1, 0] Shift Right: [1, 0, 0, 1, 1]

http://stackoverflow.com/a/22703226
score: 1
accepted answer of: http://stackoverflow.com/q/22703161
upvote count: 1
type: AcceptedAnswer
type: Answer
has body: You can actually ask spring to handle that for you using LocalContainerEntityManagerFactoryBean: &lt;bean class="org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean" id="entityManagerFactory"&gt; &lt;property name="persistenceUnitName" value="persistenceUnit"/&gt; &lt;property name="dataSource" ref="dataSource"/&gt; &lt;/bean&gt; Hence you don't need to rewrite your datasource config on persistence.xml. However this is normally used if you container do not already come with its own EntityManagerFactory (eg: tomcat, jetty). Some profiles of JBoss, Glassfish, Websphere have their own EntityManagerFactory. I have a blog post on setting up spring and jpa if you like to see more, however this is just one of many other method on how you can setup hibernate / JPA.
downvote count: 0
has comment: http://stackoverflow.com/comment/34723103
answers question: http://stackoverflow.com/q/22703161

http://stackoverflow.com/comment/34675703
has text: +1 I love Runnable#Thread & invokeLater, maybe there isn't reason for joint
type: AnswerComment
comment on: http://stackoverflow.com/a/22742721
score: 0
type: Comment

http://stackoverflow.com/q/22694767
linked to: http://stackoverflow.com/q/992019
has answer: http://stackoverflow.com/a/22695880
type: Question
tagged with: encryption
accepted answer: http://stackoverflow.com/a/22695880
score: 0
tagged with: java
answer count: 1
has title: How to read an encrypted file which was encrypted using AES algorithm and decrypt it?
type: AnsweredQuestion
has body: I am trying to read a normal text file and encrypt it using AES algorithm and then i am trying to read that encrypted file and decrypt it. Encryption is working fine.But while decrypting,i get an error saying "Input length must be multiple of 16 when decrypting with padded cipher". I dont know what i am doing wrong.Any suggestions would really help me. Thank You. import java.io.File; import java.io.FileWriter; import java.io.IOException; import java.nio.ByteBuffer; import java.nio.charset.Charset; import java.nio.charset.StandardCharsets; import java.nio.file.Files; import java.nio.file.Paths; import java.security.MessageDigest; import java.security.SecureRandom; import javax.crypto.Cipher; import javax.crypto.spec.IvParameterSpec; import javax.crypto.spec.SecretKeySpec; public class crypt { public static void main(String args[]) throws Exception { String keyString = "averylongtext!@$@#$#@$#&amp;(&amp;}{23432432432dsfsdf"; FileWriter fileWriter = null, fileWriter1 = null; File enc = new File("C:\\test\\encrypted.txt"); File dec = new File("C:\\test\\decrypted.txt"); String path = "C:\\test\\normal_file.txt"; String path2 = "C:\\test\\encrypted.txt"; fileWriter = new FileWriter(enc); fileWriter1 = new FileWriter(dec); String input = readFile(path, StandardCharsets.UTF_8); Cipher cipher = Cipher.getInstance("AES/CBC/PKCS5Padding"); byte[] iv = new byte[cipher.getBlockSize()]; new SecureRandom().nextBytes(iv); IvParameterSpec ivSpec = new IvParameterSpec(iv); MessageDigest digest = MessageDigest.getInstance("SHA-256"); digest.update(keyString.getBytes()); byte[] key = new byte[16]; System.arraycopy(digest.digest(), 0, key, 0, key.length); SecretKeySpec keySpec = new SecretKeySpec(key, "AES"); cipher.init(Cipher.ENCRYPT_MODE, keySpec, ivSpec); byte[] encrypted = cipher.doFinal(input.getBytes()); System.out.println(new String(encrypted)); //writing encrypted information to a new file encrypted.txt fileWriter.write(new String(encrypted)); fileWriter.close(); //reading enc…
linked to: http://stackoverflow.com/q/326390

http://stackoverflow.com/a/22708926
has comment: http://stackoverflow.com/comment/34606403
has comment: http://stackoverflow.com/comment/34604081
has body: You can use ".htaccess" file which will allow per-directory access control to your server directory. Create one .htaccess file with below code AddType video/mp4 .mp4 .m4v AddType video/ogg .ogv AddType video/webm .webm Upload that file in root directory. For refrence : http://httpd.apache.org/docs/current/howto/htaccess.html Hope it will help.
score: 0
type: Answer
answers question: http://stackoverflow.com/q/22706298

http://stackoverflow.com/q/22790965
tagged with: android
has comment: http://stackoverflow.com/comment/34753494
favorite count: 0
tagged with: android-asynctask
has answer: http://stackoverflow.com/a/22793510
upvote count: 2
answer count: 1
tagged with: java
accepted answer: http://stackoverflow.com/a/22793510
has comment: http://stackoverflow.com/comment/34751853
has comment: http://stackoverflow.com/comment/34753522
has comment: http://stackoverflow.com/comment/34751607
has comment: http://stackoverflow.com/comment/34752408
has title: I am trying to use the Wolfram Alpha API for an app in Java, but having problems with the Async class
score: 2
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/34755450
downvote count: 0
has comment: http://stackoverflow.com/comment/34752314
has comment: http://stackoverflow.com/comment/34751539
has body: I have all the necessary imports. If anyone could throw some light on perhaps why my InputStream is not being read that would be greatly appreciated. I believe it is this as my log returns a problem with the async class, but further in from that it seems to be (I could be wrong though) that the input stream is not being read as the given url. Thanks in advance. public class MainActivity extends Activity { String[] currency; EditText amount1; TextView answer; Spinner spin1; Spinner spin2; private InputStream OpenHttpConnection(String urlString) throws IOException { InputStream in = null; int response = -1; URL url = new URL(urlString); URLConnection conn = url.openConnection(); if(!(conn instanceof HttpURLConnection)) throw new IOException("Not an HTTP Connection"); try { HttpURLConnection httpConn = (HttpURLConnection) conn; httpConn.setAllowUserInteraction(false); httpConn.setInstanceFollowRedirects(true); httpConn.setRequestMethod("GET"); httpConn.connect(); response = httpConn.getResponseCode(); if(response == HttpURLConnection.HTTP_OK) { in = httpConn.getInputStream(); } } catch(Exception ex) { Log.d("Wolf Post", ex.getLocalizedMessage()); throw new IOException("Error Connecting"); } return in; } //method to send information and pull back xml format response private String wolframAnswer(int currencyVal, String firstSelect, String secondSelect) { //variables are assigned based of user select int pos1 = spin1.getSelectedItemPosition(); firstSelect = currency[pos1]; int pos2 = spin2.getSelectedItemPosition(); secondSelect = currency[pos2]; amount1 = (EditText)findViewById(R.id.editAmount1); answer = (TextView)findViewById(R.id.txtResult); InputStream in = null; String strWolfReturn = ""; try { in = OpenHttpConnection("http://www.wolframalpha.com/v2/input="+currencyVal+firstSelect+"-"+secondSelect+"&amp;appid=J6HA6V-YHRLHJ8A8Q"); Document doc = null; DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance(); DocumentBuilder db; try { db = dbf.newDocumentBuil…
tagged with: wolframalpha
type: Question
has comment: http://stackoverflow.com/comment/34752895
tagged with: http-get
has comment: http://stackoverflow.com/comment/34751425

http://stackoverflow.com/q/22710478
possible better answer: http://stackoverflow.com/a/22710650
score: 0
has answer: http://stackoverflow.com/a/22710645
has answer: http://stackoverflow.com/a/22710650
accepted answer: http://stackoverflow.com/a/22710645
type: AnsweredQuestion
tagged with: java
has title: Naming convention for homonymous classes in different libraries
has body: In any project with relatively big number of dependencies there are always a lot of commongly named classes in different libraries. For example, Configuration is very widely used: It slows down the programmer as he has to carefully pick the right class from the list. It is also very irritating if you have to use different configurations in one class, so they have to be prepended with full package name. I'm writing a library which also needs a Configuration class. Should I use this name? Or is it better to name it {Libname}Configuration? Is their any common way to avoid such problems?
type: Question
answer count: 2
tagged with: naming-conventions

http://stackoverflow.com/a/22740566
has body: I think you are seeing the different protection levels in Java. For the members and methods of a class, there are generally four protection levels: private, public, protected, package-private. If a method or object is not prefixed with one the keywords private, public, protected, then it is by default package-private. A method or class member which is private can only be referenced within the same class in which it is declared. A method or class member which is public can only be referenced from any class in any package. A method or class member which is protected can only be referenced from the same class and subclasses. A method or class member which is package-private can only be referenced from within the same package. If you are developing with the default package (that is, you have not declared a package), then your code will generally treat package-private exactly as it would treat public, since all classes are defaulted to the default package. Here is a reference and here is another question which explains the same ideas in less words.
answers question: http://stackoverflow.com/q/22740540
score: 0
type: Answer

http://stackoverflow.com/comment/34649839
type: AnswerComment
has text: just added try and catch statement. no error found also
type: Comment
score: 0
comment on: http://stackoverflow.com/a/22734304

http://stackoverflow.com/q/22794772
accepted answer: http://stackoverflow.com/a/22817514
type: AnsweredQuestion
tagged with: java
tagged with: http://stackoverflow.com/tag/json
tagged with: jaxb
type: Question
upvote count: 4
answer count: 2
downvote count: 0
score: 4
favorite count: 0
has title: Handling Invalid Enums with JAX-RS and MOXy
has answer: http://stackoverflow.com/a/22817514
linked to: http://stackoverflow.com/q/12147306
tagged with: moxy
has answer: http://stackoverflow.com/a/22797180
has body: I am currently attempting to unmarshal a JSON object provided via a REST PUT using Glassfish 4 (which uses Jersery 2.0 and EclipseLink 2.5). The JSON object consists of a several properties including a String value that gets mapped to a Java Enum. Everything is working as expected apart from when an invalid ENUM value is provided in the payload The JSON object: { "rating":"INVALID", ... } Is unmarshalled into: public RatingInfo { @ValidRating private Rating rating; ... public Rating getRating(){...} public void setRating(Rating rating){...} ... } public enum Rating { G, PG } If the value in the JSON payload is not a valid Rating it currently returns null which appears to be a result of JAXB ignoring the conversion error see Handling invalid enum values while doing JAXB Unmarshalling The problem is I need to distinguish between the case where Rating is actually null (which is valid use case) vs where the Rating value in the JSON is invalid so that I can return a 400 error in the REST response. What I can not figure out how to do is override the default behavior of ignoring conversion errors when using JAX-RS with MOXy as the default provider.
tagged with: glassfish-4
possible better answer: http://stackoverflow.com/a/22797180

http://stackoverflow.com/q/22703853
type: UnansweredQuestion
tagged with: playframework-2.0
score: 3
answer count: 0
upvote count: 3
tagged with: java
has comment: http://stackoverflow.com/comment/34604543
tagged with: annotations
has body: i am relatively new to Play! Framework and trying to get a hang of it. I am trying to find if there is a proper, easy to grasp documentation out there. I have few question like: Java annotation used in Play! How would @NotNull (This one is from Javax) differs with @Required from (play.data.validation.Constraints). What are other annotation (Play! specific) avaiable? and where can i get information about this?
has title: Play! Framework Java Annotation
type: Question
downvote count: 0
favorite count: 0

http://stackoverflow.com/q/22709634
answer count: 2
has body: I want to implement a multi-threaded client socket in JAVA which will connect with multiple servers.. For eg.. The client will accept an array of numbers and split that array into two.. The two arrays will be sent to two servers and the result from the servers will be combined by the client to get the Final sorted array.. Any help guys???
score: 0
has title: Connecting a Client to Multiple Servers Simultaneously in JAVA using Sockets
tagged with: sockets
tagged with: multithreading
possible better answer: http://stackoverflow.com/a/22709785
has answer: http://stackoverflow.com/a/22709785
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/22709937
tagged with: java
has comment: http://stackoverflow.com/comment/34605173
accepted answer: http://stackoverflow.com/a/22709937
type: Question

http://stackoverflow.com/q/22782483
has title: JTextPane and foreground color
tagged with: java
type: Question
has answer: http://stackoverflow.com/a/22783072
tagged with: foreground
score: 0
tagged with: colors
answer count: 3
has answer: http://stackoverflow.com/a/22783280
has body: want to have a JTextPane whose content can always be selected by the user. Therefore I created my own subclass of JTextPane and always return true in the method "isEnabled()". Additionally I introduce a new member m_enabled which is responsible for returning the correct foreground color (enabled/disabled). It works as expected, but if I set a default foreground color (e.g. Color.RED) and toggle between enabled and disabled, the foreground color won't be red anymore. Can you help me to solve this issue? public class StylesExample1 { public static final String text = "Lorem ipsum dolor..."; public static boolean m_enabled = true; public static void main(String[] args) throws BadLocationException { try { UIManager .setLookAndFeel("com.sun.java.swing.plaf.windows.WindowsLookAndFeel"); } catch (Exception evt) { } JFrame f = new JFrame("Frame"); final JTextPane pane = new MyPane(); pane.setText(text); pane.setPreferredSize(new Dimension(200, 200)); f.getContentPane().add(pane); JButton b = new JButton("Toggle Enabled state"); b.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { m_enabled = !m_enabled; System.err.println("setting textpane enabled to " + m_enabled); pane.setEnabled(m_enabled); } }); pane.setForeground(Color.red); f.getContentPane().add(b); f.getContentPane().setLayout(new FlowLayout()); f.setSize(400, 300); f.setVisible(true); } } class MyPane extends JTextPane { private static final long serialVersionUID = 1L; private boolean m_enabled = true; private Color defaultForegroundColor, disabledTextColor; public MyPane() { defaultForegroundColor = getForeground(); disabledTextColor = getDisabledTextColor(); } public void setEnabled(boolean enabled) { m_enabled = enabled; if (m_enabled) { setForeground(defaultForegroundColor); } else { setForeground(disabledTextColor); } } @Override public boolean isEnabled() { return true; } }
has answer: http://stackoverflow.com/a/22790494
type: UnansweredQuestion
tagged with: jtextpane
tagged with: swing

http://stackoverflow.com/q/22700642
has comment: http://stackoverflow.com/comment/34589245
tagged with: android
tagged with: http://stackoverflow.com/tag/xml
tagged with: netbeans
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/34589180
has comment: http://stackoverflow.com/comment/77213021
has comment: http://stackoverflow.com/comment/34589190
has comment: http://stackoverflow.com/comment/34588999
answer count: 0
tagged with: java
has title: build.xml:1: Premature end of file
type: Question
has body: I am new in Android development, and I wanna build some apps for myself. I have installed Android SDK last version, NetBeans IDE 7.4 and also the plugin for this. I wrote a simple code for Android to see if it works: package com.app; import android.app.Activity; import android.os.Bundle; import android.widget.TextView; public class MainActivity extends Activity { /** Called when the activity is first created. */ @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); TextView tv = new TextView(this); tv.setText("HelloWorld"); setContentView(tv); } } When I try to build and run with an emulator, I get this error: [path] \AndroidApplication1\build.xml:1: Premature end of file. When I go to the file (build.xml) I see that is empty. I should write to it? What should I do? Thanks in advance.
tagged with: android-ide
score: 0

task
type: Tag
tag name: task
tags question: http://stackoverflow.com/q/22754143

http://stackoverflow.com/a/22748723
score: 1
upvote count: 1
downvote count: 0
answers question: http://stackoverflow.com/q/22694972
has body: String all_vals = "617,618,456,1,234,5,5678,225"; String check_val= "5678"; int place = 1; String[] strings = all_vals.split(","); for (String str : strings) { if(str.equals(check_val)) { System.out.println("We have string in all_val on place: " + place); } place++; }
type: Answer

bluej
tags question: http://stackoverflow.com/q/22703039
tags question: http://stackoverflow.com/q/22696134
tag name: bluej
tags question: http://stackoverflow.com/q/22702209
tags question: http://stackoverflow.com/q/22707476
type: Tag

http://stackoverflow.com/comment/34709995
type: AnswerComment
score: 0
type: Comment
comment on: http://stackoverflow.com/a/22753260
has text: @user3478966 - And that brings us back to my original problem with your Question. I don't understand your requirements, and apparently nobody else does. Unless you can do something about that, I don't think I can be of any further help. Sorry.

http://stackoverflow.com/comment/34766435
type: QuestionComment
score: 1
has text: I'm not telling you not to use Struts, nor to abandon frameworks altogether. But from what I've seen by the questions on here, Struts seems way more complicated than Spring.
comment on: http://stackoverflow.com/q/22703079
type: Comment

http://stackoverflow.com/q/22663923
downvote count: 0
answer count: 1
favorite count: 0
has answer: http://stackoverflow.com/a/22680644
accepted answer: http://stackoverflow.com/a/22680644
tagged with: infinispan
type: AnsweredQuestion
score: 1
tagged with: java
tagged with: unit-testing
has title: Infinispan cache does not throw exception in pessimistic mode
type: Question
tagged with: pessimistic-locking
has body: I am running simple test case based on one of the Infinispan unit tests. In my test I expect to receive CacheException when replication timeouts in my cluster. I use pessimistic transaction locking and exception is not thrown in this case for some reason. If I comment pessimistic locking I get exception as expected. @Test(groups = "functional", testName = "replication.ReplicationExceptionTest") public class ReplicationExceptionTest extends MultipleCacheManagersTest { protected void createCacheManagers() { ConfigurationBuilder configuration = getDefaultClusteredCacheConfig(CacheMode.REPL_SYNC, true); configuration.locking() .lockAcquisitionTimeout(60000l) .transaction().transactionManagerLookup(new DummyTransactionManagerLookup()); // uncomment this line and exception is not thrown for some reason //.lockingMode(LockingMode.PESSIMISTIC); createClusteredCaches(2, configuration); waitForClusterToForm(); } @Test(groups = "functional", expectedExceptions = { CacheException.class }) public void testSyncReplTimeout() { AdvancedCache cache1 = cache(0).getAdvancedCache(); AdvancedCache cache2 = cache(1).getAdvancedCache(); cache2.addInterceptor(new CommandInterceptor() { @Override protected Object handleDefault(InvocationContext ctx, VisitableCommand cmd) throws Throwable { // Add a delay Thread.sleep(100); return super.handleDefault(ctx, cmd); } }, 0); cache1.getCacheConfiguration().clustering().sync().replTimeout(10); cache2.getCacheConfiguration().clustering().sync().replTimeout(10); TestingUtil.blockUntilViewsReceived(10000, cache1, cache2); cache1.put("k", "v"); } } Can someone help me understand why it is hiding exception with pessimistic locking enabled and how to fix that? Update: I am using Infinispan 5.3.0.Final.
upvote count: 1

http://stackoverflow.com/q/22699061
upvote count: 0
answer count: 1
favorite count: 0
has comment: http://stackoverflow.com/comment/34586262
has answer: http://stackoverflow.com/a/22699321
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/34586232
has comment: http://stackoverflow.com/comment/34586308
tagged with: loops
has body: I have wrote an algorithm for my game highscores, which is based on kill/death ratio. Obviously the biggest kill/death ratio will be #1. It works fine, until It reaches the lowest score, which is 0.0, and I have 100 more players with a 0.0 ratio. The algorithm simply will add the same name with the 0.0 score and will not add rest of the players with 0.0 score after it. I am not sure why it yet, I hardly remember that I've done there, I am trying to understand: @Override public ArrayList&lt;TempClient&gt; getResortedHighscores(ArrayList&lt;TempClient&gt; list) { ArrayList&lt;TempClient&gt; sorted = new ArrayList&lt;TempClient&gt;(); for (int i = 0; i &lt; list.size(); i++) { TempClient max = null; for (int j = 0; j &lt; list.size(); j++) { if (max != null) { if (list.get(j).getRatio() &gt; max.getRatio() &amp;&amp; !sorted.contains(list.get(j))) { max = list.get(j); } continue; } max = list.get(j); } sorted.add(max); } return sorted; } What did I do wrong? Thanks.
downvote count: 1
type: Question
tagged with: algorithm
has title: Highscores algorithm will continue adding same user if the next score equals to it
tagged with: java
accepted answer: http://stackoverflow.com/a/22699321
score: -1

http://stackoverflow.com/q/22796147
score: 5
has body: Is it possible to set the table schema name when using @DatabaseSetup annotation from Spring Test DBUnit? Currently I'm using it like this: @DatabaseSetup("user-data.xml") public class UserMapperTest { } user-data.xml: (I also tried to set the element name to user.system_user without any luck) &lt;dataset&gt; &lt;system_user ... /&gt; &lt;/dataset&gt; And here I'm creating my table with schema called user: create table "user".system_user (...); And this is the exception that I get when running test: org.h2.jdbc.JdbcSQLException: Table "SYSTEM_USER" not found; SQL statement: delete from SYSTEM_USER [42102-175]
downvote count: 0
favorite count: 0
answer count: 3
tagged with: spring-test-dbunit
type: UnansweredQuestion
tagged with: dbunit
has answer: http://stackoverflow.com/a/23760452
has answer: http://stackoverflow.com/a/24206114
has title: Spring Test DBUnit and table schema name
upvote count: 5
tagged with: java
has answer: http://stackoverflow.com/a/23905659
type: Question

http://stackoverflow.com/a/27477312
type: Answer
has comment: http://stackoverflow.com/comment/54645446
has comment: http://stackoverflow.com/comment/54640440
has comment: http://stackoverflow.com/comment/54725288
downvote count: 0
accepted answer of: http://stackoverflow.com/q/22718744
answers question: http://stackoverflow.com/q/22718744
score: 88
has body: The behavior of String.split (which calls Pattern.split) changes between Java 7 and Java 8. Documentation Comparing between the documentation of Pattern.split in Java 7 and Java 8, we observe the following clause being added: When there is a positive-width match at the beginning of the input sequence then an empty leading substring is included at the beginning of the resulting array. A zero-width match at the beginning however never produces such empty leading substring. The same clause is also added to String.split in Java 8, compared to Java 7. Reference implementation Let us compare the code of Pattern.split of the reference implemetation in Java 7 and Java 8. The code is retrieved from grepcode, for version 7u40-b43 and 8-b132. Java 7 public String[] split(CharSequence input, int limit) { int index = 0; boolean matchLimited = limit &gt; 0; ArrayList&lt;String&gt; matchList = new ArrayList&lt;&gt;(); Matcher m = matcher(input); // Add segments before each match found while(m.find()) { if (!matchLimited || matchList.size() &lt; limit - 1) { String match = input.subSequence(index, m.start()).toString(); matchList.add(match); index = m.end(); } else if (matchList.size() == limit - 1) { // last one String match = input.subSequence(index, input.length()).toString(); matchList.add(match); index = m.end(); } } // If no match was found, return this if (index == 0) return new String[] {input.toString()}; // Add remaining segment if (!matchLimited || matchList.size() &lt; limit) matchList.add(input.subSequence(index, input.length()).toString()); // Construct result int resultSize = matchList.size(); if (limit == 0) while (resultSize &gt; 0 &amp;&amp; matchList.get(resultSize-1).equals("")) resultSize--; String[] result = new String[resultSize]; return matchList.subList(0, resultSize).toArray(result); } Java 8 public String[] split(CharSequence input, int limit) { int index = 0; boolean matchLimited = limit &gt; 0; ArrayList&lt;String&gt; matchList = new ArrayList&lt;&gt;()…
has comment: http://stackoverflow.com/comment/54683588
upvote count: 88
type: AcceptedAnswer

http://stackoverflow.com/a/22743268
has comment: http://stackoverflow.com/comment/34674706
has comment: http://stackoverflow.com/comment/34674726
answers question: http://stackoverflow.com/q/22743179
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/34674428
has comment: http://stackoverflow.com/comment/34674598
has comment: http://stackoverflow.com/comment/34674235
has comment: http://stackoverflow.com/comment/34726593
type: Answer
has comment: http://stackoverflow.com/comment/34674094
has comment: http://stackoverflow.com/comment/34674746
score: 1
upvote count: 1
has comment: http://stackoverflow.com/comment/34674394
has comment: http://stackoverflow.com/comment/34674616
has comment: http://stackoverflow.com/comment/34717756
has body: You need to have these constructors Android Custom View Constructor public TimerView(Context context, AttributeSet attrs, int defStyle) { super(context, attrs, defStyle); } public TimerView (Context context) { super(context); } public TimerView (Context context, AttributeSet attrs) { super(context, attrs); } Also you have this.setText(milliSeconds + ":" + seconds + ":" + minutes); You cannot update ui from a non ui thread. Read http://developer.android.com/guide/components/processes-and-threads.html Edit: What you have public class Timer extends TextView{ Then in xml you have &lt;de.lipsksoft.apps.anwendung.t6student.TimerView // TimerView is not the same as Timer Edit 2: In Activity TimerView tv = (TimerView) this.findViewById(R.id.timer1); tv.start(); Then in xml My package name is different &lt;RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="fill_parent" android:layout_height="fill_parent" &gt; &lt;com.example.testall.TimerView android:id="@+id/timer1" android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="TimerView" /&gt; &lt;/RelativeLayout&gt; Then 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); //start(); } public TimerView(Context context, AttributeSet attrs) { super(context, attrs); //start(); } public TimerView(Context context, AttributeSet attrs, int defStyle){ super(context, attrs, defStyle); //start(); } 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 …
accepted answer of: http://stackoverflow.com/q/22743179

http://stackoverflow.com/comment/34508401
has text: You should implement the progress bar with a Swing Timer (or even a regular java.util.Timer) and then you won't have to resort to any hacks for stopping.
comment on: http://stackoverflow.com/q/22655734
score: 1
type: Comment
type: QuestionComment

http://stackoverflow.com/q/22778958
has comment: http://stackoverflow.com/comment/34730388
type: Question
tagged with: mongodb
has comment: http://stackoverflow.com/comment/34731324
tagged with: morphia
has body: How to get a list of Object, where the tla (three letter acronym) of an LoanboardEmployee equals the providedTla inside the list of borrowers inside the list of ActionStamps (preferably the last stamp)? I have the following classes: Object: @Id private String objectCode; @Embedded private List&lt;ActionStamp&gt; borrowingHistory; ... ActionStamp (used in Object) @Reference private LoanboardEmployee responsible; @Reference private List&lt;LoanboardEmployee&gt; borrowers; ... LoanboardEmployee (used in ActionStamp) @Id private short id; private String tla; ... Now I want to find all Object, where 1 of the tla's of the borrowers in the last ActionStamp equals a given tla. So far i have this: // Select only Object with type Object.class Query&lt;Object&gt; q = ds.createQuery(Object.class); // Query the Object only that have a borrowingHistory q.field("borrowingHistory").exists(); // Query the Object only that have borrowers in the borrowingHistory q.field("borrowingHistory.borrowers").exists(); // This is where I'm stuck q.field("borrowingHistory.borrowers.tla").hasThisOne(providedTla); I get the following Error: com.google.code.morphia.query.ValidationException: Can not use dot-notation past 'borrowers' could not be found in 'nl.technolution.loanboard.datamodel.entity.Object' while validating - borrowingHistory.borrowers.tla How should I solve this query?
has comment: http://stackoverflow.com/comment/34731155
has comment: http://stackoverflow.com/comment/34731926
has title: Advanced Query mongodb morphia List in List in Object
answer count: 0
type: UnansweredQuestion
score: 0
tagged with: java
has comment: http://stackoverflow.com/comment/38452340

http://stackoverflow.com/q/22802268
type: Question
has title: Java Default Method - get type of subclass
accepted answer: http://stackoverflow.com/a/22803216
downvote count: 0
linked to: http://stackoverflow.com/q/2801267
possible better answer: http://stackoverflow.com/a/22802876
answer count: 3
has answer: http://stackoverflow.com/a/22802876
upvote count: 6
tagged with: generics
favorite count: 0
has body: I have an interface in which I want to provide a default method to Serialize the inherited classes. I use a JsonSerializer&lt;T&gt; class to do serialization. The method looks like: public interface A { public default String write() { new JsonSerializer&lt;/*Inherited class type*/&gt;(); // I've tried new JsonSerializer&lt;this.getClass()&gt;(); - Doesn't work } } public class AX implements A { } So when I instantiate AX, I want to use the write method to serialize AX AX inst = new AX(); String instSerialized = inst.write(); I need to pass the type of AX to the write method in A. is this possible?
has answer: http://stackoverflow.com/a/22803216
score: 6
type: AnsweredQuestion
tagged with: default-method
tagged with: java
has answer: http://stackoverflow.com/a/22802912

http://stackoverflow.com/q/22744987
tagged with: android
has comment: http://stackoverflow.com/comment/34668136
score: 2
has body: I wrote a simple database helper class to make access to the DB from multiple activities more clean. Here's the class: public class DatabaseHandler extends SQLiteOpenHelper { private static final int DATABASE_VERSION = 1; private static final String DATABASE_NAME = "name"; private static final String TABLE_SCORES = "scores"; private static final String KEY_ID = "id"; private static final String KEY_SCORE = "score"; private static final String KEY_DATE = "date"; SQLiteDatabase database; public DatabaseHandler(Context context) { super(context, DATABASE_NAME, null, DATABASE_VERSION); database = this.getWritableDatabase(); } @Override public void onCreate(SQLiteDatabase database) { String CREATE_SCORES_TABLE = "CREATE TABLE " + TABLE_SCORES + "(" + KEY_ID + " INTEGER PRIMARY KEY," + KEY_SCORE + " INTEGER," + KEY_DATE + " TEXT" + ")"; database.execSQL(CREATE_SCORES_TABLE); } @Override public void onUpgrade(SQLiteDatabase database, int oldVersion, int newVersion) { database.execSQL("DROP TABLE IF EXISTS " + TABLE_SCORES); onCreate(database); } void addScore(int score){ SimpleDateFormat dateFormat = new SimpleDateFormat("dd.MM.yyyy", Locale.US); String currentDateandTime = dateFormat.format(new Date()); ContentValues values = new ContentValues(); values.put(KEY_SCORE, score); values.put(KEY_DATE, currentDateandTime); database.insert(TABLE_SCORES, null, values); //database.close(); } void delete(){ database.delete(TABLE_SCORES, null, null); } public List&lt;Score&gt; getAllScores(){ List&lt;Score&gt; scoresList = new ArrayList&lt;Score&gt;(); String selectQuery = "SELECT * FROM " + TABLE_SCORES + " ORDER BY " + KEY_SCORE +" DESC LIMIT 10"; Cursor cursor = database.rawQuery(selectQuery, null); if(cursor.moveToFirst()){ do{ Score score = new Score(); score.setId(Integer.parseInt(cursor.getString(0))); score.setScore(Integer.parseInt(cursor.getString(1))); score.setDate(cursor.getString(2)); scoresList.add(score); } while (cursor.moveToNext()); } return scoresList; } public in…
tagged with: database-connection
upvote count: 2
has answer: http://stackoverflow.com/a/72475855
tagged with: java
has title: Android SQLite helper - where should I close the connection?
type: Question
has comment: http://stackoverflow.com/comment/34668147
has comment: http://stackoverflow.com/comment/34668242
tagged with: sqlite
answer count: 1
has comment: http://stackoverflow.com/comment/34668204
downvote count: 0
has comment: http://stackoverflow.com/comment/34668180
favorite count: 0
type: UnansweredQuestion

http://stackoverflow.com/comment/34597699
type: QuestionComment
comment on: http://stackoverflow.com/q/22705426
has text: Are you adding Internet permissions in manifest?
score: 0
type: Comment

http://stackoverflow.com/q/22696988
accepted answer: http://stackoverflow.com/a/22697148
type: Question
tagged with: jstl
downvote count: 0
tagged with: jsp
has body: In jsp I'm have this: Order total: <fmt:formatNumber type="NUMBER" value="${order.total}"/> In html when open page: Order total: <fmt:formatNumber value="20.0" type="NUMBER"/> But I'm don't see number, see only Order total: full jsp: <jsp:output omit-xml-declaration="yes"/> <jsp:directive.page contentType="text/html;charset=UTF-8" /> Spizza Your order Deliver to: ${order.customer.name} ${order.customer.address} ${order.customer.city}, ${order.customer.state} ${order.customer.zipCode} ${order.customer.phoneNumber} Order total: <fmt:formatNumber type="NUMBER" value="${order.total}"/> Pizzas: <c:if test="${fn:length(order.pizzas) eq 0}"> No pizzas in this order. </c:if> <c:forEach items="${order.pizzas}" var="pizza"> ${pizza.size} : <c:forEach items="${pizza.toppings}" var="topping"> <c:out value="${topping}" />, </c:forEach> </c:forEach> <form:form> <c:if test="${fn:length(order.pizzas) gt 0}"> </c:if> </form:form>
has answer: http://stackoverflow.com/a/22697148
answer count: 1
has comment: http://stackoverflow.com/comment/34581965
favorite count: 0
has comment: http://stackoverflow.com/comment/34582043
upvote count: 1
tagged with: spring
has comment: http://stackoverflow.com/comment/34582066
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/34582179
score: 1
tagged with: java
has title: JSTL formatNumber show empty string

http://stackoverflow.com/q/22763914
tagged with: jax-ws
has comment: http://stackoverflow.com/comment/34783226
has title: PUT Method: Not able to send "fileName" form Data using Jersey API using java?
type: UnansweredQuestion
has body: following is the code I have written to PUT a image to a jersey server. byte[] img = image(file);// coverts file into byte strea FormDataMultiPart form = new FormDataMultiPart(); form.field("fileName", file); FormDataBodyPart fdp = new FormDataBodyPart("fileUpload", new ByteArrayInputStream(img), MediaType.APPLICATION_OCTET_STREAM_TYPE); form.bodyPart(fdp); ClientResponse rs = wr.type(MediaType.APPLICATION_FORM_URLENCODED).put( ClientResponse.class, form); When I am running the code, i am able to send the byte stream to the server, but its returning error that it is not able to find the filename i am providing in form.field, so returning a 400 bad request error? i am not able to understand what i am missing here?
has answer: http://stackoverflow.com/a/22838735
answer count: 1
tagged with: jersey-2.0
has comment: http://stackoverflow.com/comment/34786968
type: Question
tagged with: web-services
score: 0
tagged with: java

http://stackoverflow.com/q/22764387
has comment: http://stackoverflow.com/comment/34728505
has body: Before you downvote, let me say that I have searched at least 5 hours in different forums for solutions/hacks and those are the solutions I have tried so far: Calling showInfoWindow() to force the Marker to come to the front Order of addition of Markers to the Map Size of Drawables of Markers I know there is no Z-Axis values in MarkerOptions/Markers. The Question: Is there any hack/trick to order the Markers? (Even if we change Markers with clickable Overlays or so...) Thank you for your help. EDIT: An example would be: //Marker B MarkerOptions mBOptions = objB.getMarkerOptions(); //mBOptions has Pos = (1/0) and Icon has a radius 1 Marker markerA = mGoogleMap.addMarker(mBOptions); //Marker A MarkerOptions mAOptions = objA.getMarkerOptions(); //mAOptions has Pos = (0/0) and Icon has a radius 10 Marker markerB = mGoogleMap.addMarker(mAOptions); I want to force A to cover the Marker B no matter how I change the position of Marker A. I dont want Marker B to show on top of A.
type: Question
has answer: http://stackoverflow.com/a/23732566
accepted answer: http://stackoverflow.com/a/23732566
tagged with: google-maps
has title: Z-Ordering Markers in GoogleMap v2 Android
tagged with: marker
has comment: http://stackoverflow.com/comment/34714885
upvote count: 3
answer count: 1
favorite count: 0
has comment: http://stackoverflow.com/comment/34714624
has comment: http://stackoverflow.com/comment/35092272
has comment: http://stackoverflow.com/comment/34703766
tagged with: android
type: AnsweredQuestion
score: 3
downvote count: 0
tagged with: java

http://stackoverflow.com/a/22683340
upvote count: 2
has body: You can use SimpleDateFormat#format() to format a Date into a String in a certain pattern. String newstring = new SimpleDateFormat("yyyy-MM-dd").format(date); System.out.println(newstring); // 2011-01-18
has comment: http://stackoverflow.com/comment/34558453
accepted answer of: http://stackoverflow.com/q/22683284
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/34557005
type: Answer
answers question: http://stackoverflow.com/q/22683284
has comment: http://stackoverflow.com/comment/34557624
score: 2

http://stackoverflow.com/a/22725516
score: 1
upvote count: 1
answers question: http://stackoverflow.com/q/22725395
has body: Statement can't be used when supplying parameters to the query, use PreparedStatement. You may have to revise your code as below: String pubBooks = "select title_name " + "from publisher, title " + "where pub_name = ? " + "and publisher.pub_no = title.pub_no " + "order by title_name"; String pubss = "Irwin"; PreparedStatement pStmt = con.prepareStatement(pubBooks); pStmt.setString(1, pubss); ResultSet rS = pStmt.executeQuery(); //TODO: code to use resultset rS rS.close(); pstmt.close();
type: Answer
downvote count: 0

http://stackoverflow.com/q/22751385
has comment: http://stackoverflow.com/comment/34693388
tagged with: jndi
tagged with: java
tagged with: hibernate
has body: I have the following error when I execute a button from my web app: 01:25:04,191 WARNING [javax.enterprise.resource.webcontainer.jsf.lifecycle] (http--0.0.0.0-8180-1) #{login.verify}: java.lang.RuntimeException: javax.naming.NameNotFoundException: JpaFactory -- service jboss.naming.context.java.JpaFactory: javax.faces.FacesException: #{login.verify}: java.lang.RuntimeException: javax.naming.NameNotFoundException: JpaFactory -- service jboss.naming.context.java.JpaFactory at com.sun.faces.application.ActionListenerImpl.processAction(ActionListenerImpl.java:118) [jsf-impl-2.1.7-jbossorg-2.jar:] at javax.faces.component.UICommand.broadcast(UICommand.java:315) [jboss-jsf-api_2.1_spec-2.0.1.Final.jar:2.0.1.Final] at javax.faces.component.UIViewRoot.broadcastEvents(UIViewRoot.java:794) [jboss-jsf-api_2.1_spec-2.0.1.Final.jar:2.0.1.Final] at javax.faces.component.UIViewRoot.processApplication(UIViewRoot.java:1259) [jboss-jsf-api_2.1_spec-2.0.1.Final.jar:2.0.1.Final] at com.sun.faces.lifecycle.InvokeApplicationPhase.execute(InvokeApplicationPhase.java:81) [jsf-impl-2.1.7-jbossorg-2.jar:] at com.sun.faces.lifecycle.Phase.doPhase(Phase.java:101) [jsf-impl-2.1.7-jbossorg-2.jar:] at com.sun.faces.lifecycle.LifecycleImpl.execute(LifecycleImpl.java:118) [jsf-impl-2.1.7-jbossorg-2.jar:] at javax.faces.webapp.FacesServlet.service(FacesServlet.java:593) [jboss-jsf-api_2.1_spec-2.0.1.Final.jar:2.0.1.Final] at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:329) [jbossweb-7.0.13.Final.jar:] at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:248) [jbossweb-7.0.13.Final.jar:] at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:275) [jbossweb-7.0.13.Final.jar:] at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:161) [jbossweb-7.0.13.Final.jar:] at org.jboss.as.web.security.SecurityContextAssociationValve.invoke(SecurityContextAssociationValve.java…
score: 0
tagged with: jpa
answer count: 1
has comment: http://stackoverflow.com/comment/34686565
type: UnansweredQuestion
has title: javax.naming.NameNotFoundException: JpaFactory -- service jboss.naming.context.java.JpaFactory
tagged with: jsf
has answer: http://stackoverflow.com/a/22788547
type: Question

http://stackoverflow.com/q/22796699
answer count: 1
has answer: http://stackoverflow.com/a/22797479
score: 0
has title: Adding an instance and classify it in Weka 3.6.5+
tagged with: machine-learning
type: Question
type: AnsweredQuestion
tagged with: java
has body: I have a Train.arff file to which I want to add new instance (say "2,F,22222,1002-5,?") and then classify the last attributes. All my attributes are nominal. @attribute age {2,3,4,5,6} @attribute gender {F,M} @attribute zipcode {22222,33333,11111} @attribute race {1002-5,2028-9,2054-5,2076-8,2106-3} @attribute service {H0018,H2034,H0004,H0009,H0006} @data 2,F,22222,1002-5,H0018 Loaded Train.arff Adding Instance Instance inst = new Instance(10); inst.setValue(trainData.attribute(0), age); inst.setValue(trainData.attribute(1), administrativeGenderCode); inst.setValue(trainData.attribute(2), zipCode); inst.setValue(trainData.attribute(3), race); inst.setValue(trainData.attribute(4), "H2034"); // inst.setDataset(trainData); // add trainData.add(inst); Building Classifier public String buildAndClassify() { //build model Logistic model = new Logistic(); try { model.buildClassifier(trainData); &lt;-- fails Instances labeled = new Instances(trainData); double clsLabel = model.classifyInstance(trainData.lastInstance()); labeled.lastInstance().setClassValue(clsLabel); System.out.print(labeled.lastInstance().stringValue(7)); return labeled.lastInstance().stringValue(7); } catch (Exception e) { e.printStackTrace(); } return ""; } java.lang.NullPointerException at weka.filters.unsupervised.attribute.ReplaceMissingValues.batchFinished(ReplaceMissingValues.java:189) at weka.filters.Filter.useFilter(Filter.java:663) at weka.classifiers.functions.Logistic.buildClassifier(Logistic.java:546) at com.feisystems.bham.weka.LogisticRegression.buildAndClassify(LogisticRegression.java:70) at com.feisystems.bham.weka.LogisticRegression.(LogisticRegression.java:20) at com.feisystems.bham.weka.AttTest.main(AttTest.java:22) I am using Weka 3.7 and don't see any example to correctly add instance to an existing file and classify one attribute of the instance. As a work around I am currently creating another Test.arff file with all the matching attributes from Train.arff and adding instance to thos…
accepted answer: http://stackoverflow.com/a/22797479
tagged with: weka

http://stackoverflow.com/comment/34752976
type: Comment
has text: @Ali: Don't hurry. I slightly disagree with some things in your edit, but really only slightly. Let's look what we find out next week. I don't think HW can make such a big difference unless you're running some 286. The quality of the branch predictor doesn't matter as no smart algorithm can help (it's just random). And the pipeline is pretty deep.
comment on: http://stackoverflow.com/a/22755044
type: AnswerComment
score: 0

http://stackoverflow.com/a/22679255
has comment: http://stackoverflow.com/comment/34553850
has comment: http://stackoverflow.com/comment/34566798
type: Answer
answers question: http://stackoverflow.com/q/22661365
has body: This is bug which has been fixed in the latest drop. Try upgrading your extension version. If you have access to bug db, you should be able to get the exact version where this has been fixed. Arun
score: 0

http://stackoverflow.com/comment/34621501
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/22718256
has text: I meant explicitly extended.
score: 0

http://stackoverflow.com/q/22801392
type: Question
has comment: http://stackoverflow.com/comment/34770632
downvote count: 0
has comment: http://stackoverflow.com/comment/34772013
has title: Java - Manually reading bytes in bitmap file
score: 1
has body: I have seen how to read each individual pixel from an image with BufferedImage. However, the environment I am using has no java.nio, no javax.imageio, etc. All it really has is DataInputStream. I am using http://www.daubnet.com/en/file-format-bmp for the bitmap format. I tested reading just the width and height on a test 6x6 image, and it did not return the correct numbers. How can I manually read the file byte by byte and retrieve the width and height and color of each pixel? I have seen ByteBuffer used for byte manipulation; keep in mind that I cannot use that class as it is not supported in the environment I am working with.
has comment: http://stackoverflow.com/comment/34772203
favorite count: 0
answer count: 0
type: UnansweredQuestion
upvote count: 1
tagged with: bitmap
has comment: http://stackoverflow.com/comment/34772876
tagged with: java
has comment: http://stackoverflow.com/comment/34770559

http://stackoverflow.com/comment/34502914
type: Comment
comment on: http://stackoverflow.com/a/22652322
score: 0
type: AnswerComment
has text: It shows only NONE in dropdown

http://stackoverflow.com/q/22722652
type: UnansweredQuestion
score: 3
has comment: http://stackoverflow.com/comment/61672620
favorite count: 0
has body: What is the simplest way to remove exif data from an image and then move it to another folder? Same location, just in a folder. That way there are original copies. Thanks.
has answer: http://stackoverflow.com/a/47594690
type: Question
has answer: http://stackoverflow.com/a/72709187
has comment: http://stackoverflow.com/comment/34628927
tagged with: http://stackoverflow.com/tag/jpeg
tagged with: exif
has answer: http://stackoverflow.com/a/22726164
upvote count: 3
tagged with: java
has title: Remove Exif data from image in java?
linked to: http://stackoverflow.com/q/37062959
answer count: 4
has answer: http://stackoverflow.com/a/22724056
downvote count: 0
has comment: http://stackoverflow.com/comment/34629541

http://stackoverflow.com/a/22794854
has body: According to comments, as you asked @Trebor for determining DB type at runtime there is way to go through,visit thisJDBC connection also http://docs.oracle.com/javase/6/docs/api/java/sql/DatabaseMetaData.html getClientInfo() Entity Manager IN java http://tomee.apache.org/examples-trunk/injection-of-entitymanager/README.html this will definitely going to solve your issue .all the best .!
score: 0
type: Answer
answers question: http://stackoverflow.com/q/22766056

http://stackoverflow.com/comment/34518435
score: 2
type: Comment
has text: It seems that you want us to do your homework for you.
type: QuestionComment
comment on: http://stackoverflow.com/q/22661416

http://stackoverflow.com/comment/34562561
has text: There are other scenarios where you may want to use a JSON object in a response. AJAX responses happen to be a very common scenario. Populating a combo during page edit would be a very valid example.
type: AnswerComment
score: 0
type: Comment
comment on: http://stackoverflow.com/a/22686431

swagger-ui
tag name: swagger-ui
tags question: http://stackoverflow.com/q/22704788
type: Tag

http://stackoverflow.com/comment/34521811
comment on: http://stackoverflow.com/q/22663403
type: Comment
type: QuestionComment
score: 1
has text: I don't see all this having anything to do with try-with-resources. You have an issue with the `write` call blocking. BTW there is no method `write(Object)` in `ObjectOutputStream`.

http://stackoverflow.com/q/22717382
tagged with: io
score: 2
type: AnsweredQuestion
upvote count: 2
tagged with: java
has answer: http://stackoverflow.com/a/22915145
has body: I'm trying to use jsch to get the output of commands send hrough SSH. My problem is that I need to get the result of the command into a String in order to use it later. For exemple if I send the command "ls" I want the name of the files in the folder in a string. How can I do that ? Here is my code : import com.jcraft.jsch.*; public class SSHCommand2 { public static void main(String[] args) { String host="host"; String user="user"; String password="password"; try{ java.util.Properties config = new java.util.Properties(); config.put("StrictHostKeyChecking", "no"); JSch jsch = new JSch(); Session session=jsch.getSession(user, host, 22); session.setPassword(password); session.setConfig(config); session.connect(); System.out.println("Connected"); Channel channel = session.openChannel("shell"); ((ChannelShell) channel).setPty(true); OutputStream inputstream_for_the_channel = channel.getOutputStream(); PrintStream commander = new PrintStream(inputstream_for_the_channel, true); channel.setOutputStream(System.out, true); channel.connect(); commander.println("ls"); if(channel.isClosed()){ //if(in.available()&gt;0) continue; System.out.println("exit-status: "+channel.getExitStatus()); //break; } do { Thread.sleep(1000); } while(!channel.isEOF()); session.disconnect(); } catch(Exception e) { e.printStackTrace(); } }
type: Question
has title: How to get the Output result in jsch
accepted answer: http://stackoverflow.com/a/22915145
answer count: 1
downvote count: 0
tagged with: jsch
favorite count: 0

http://stackoverflow.com/comment/34672472
type: QuestionComment
comment on: http://stackoverflow.com/q/22747035
has text: @Ritikesh But `this.houses` seems to be a `House[][]`.
score: 0
type: Comment

http://stackoverflow.com/comment/34763311
has text: @tieTYT: I have just now tested it, and can verify that it does not work. That the Console only gets the chars when enter has been pressed. I'll post my code above.
type: Comment
type: AnswerComment
comment on: http://stackoverflow.com/a/22797464
score: 0

http://stackoverflow.com/comment/39263825
comment on: http://stackoverflow.com/a/22674066
has text: @RobertHarvey That probably depends on too many variables to discuss it here in detail (WHO is using WHICH layout manager for WHICH GUI in WHICH program etc). But looking at the askers' code, I consider this as basically unmaintainable (and the question itself is at least an indication for that). I think it can't harm to at least have an *idea* of how to lay out a GUI manually. When you have to create dozens of similar, boring dialogs, such a UI designer will certainly save time, but when you go beyond that, they (i.e. their code) may be a hassle. (In doubt, it's just an opinion...)
score: 0
type: Comment
type: AnswerComment

http://stackoverflow.com/a/22761599
upvote count: 1
downvote count: 0
answers question: http://stackoverflow.com/q/22758715
has body: I'm not entirely sure I understand what you're trying to achieve (comment on this is not), but here are my thoughts: Sounds like what you really want is to implement the Flyweight design pattern (http://en.wikipedia.org/wiki/Flyweight_pattern). If you really want to implement this as you describe it (again, under the assumption that I understood correctly), the following should work: public class Record { private static final int MAX_INSTANCES = 20; private static volatile int instanceCounter = 0; private Record() { if (instanceCounter &gt;= MAX_INSTANCES) throw new RuntimeException("max instances exceeded"); instanceCounter ++; } }
type: Answer
score: 1

http://stackoverflow.com/comment/34612684
comment on: http://stackoverflow.com/q/22712222
type: QuestionComment
type: Comment
has text: I had wasted a day in the similar issue. LogCat doesn't show complete response if its length is much greater. Try to put that response in a file or something. Only then you can be sure that you're getting half the response. Try to write that response to a text file, then check that text file.
score: 0

http://stackoverflow.com/q/22679109
has comment: http://stackoverflow.com/comment/34549884
downvote count: 2
answer count: 3
favorite count: 0
has answer: http://stackoverflow.com/a/22679130
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/22679126
upvote count: 0
tagged with: java
has body: can someone help me here? this is just a test, but when i run my program i am getting a cannot find symbol error, and it points the name i entered thinking it's a variable import java.util.*; import java.io.*; public class Employee{ public String emp_name; public int emp_id; public double emp_salary; public int emp_phone; public Employee(String add_newName, int add_newID, double add_newSalary, int add_newPhone){ emp_name = add_newName; emp_id = add_newID; emp_salary = add_newSalary; emp_phone = add_newPhone; } public Employee(int add_ID, int add_Phone){ emp_name = "NULL"; emp_id = add_ID; emp_salary = 0; emp_phone = add_Phone; } public double increaseSalary(double increase_amt){ return emp_salary += increase_amt; } public String getName(){ return emp_name; } public String toString(){ return "Name of employee: " + emp_name + ",, " + "ID number of employee: " + emp_id + ",, " + "Employee salary: " + emp_salary + ",, " + "Employee phone: " + emp_phone; } public static void process(){ Employee employee1 = new Employee(noel, 101, 5050.50, 1230987); Employee employee2 = new Employee(102, 5672389); System.out.println("Employee Information: " + employee1.toString()); } public static void main(String args[]){ process(); } } The error is in the process method, where you see noel, java saying cannot find symbol for it...help?
has comment: http://stackoverflow.com/comment/34549875
has answer: http://stackoverflow.com/a/22679140
type: Question
has title: java program reading my string input as a variable
score: -2

http://stackoverflow.com/q/22745050
tagged with: entity
has title: NullpointerException when I'm invoking a method
tagged with: nullpointerexception
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/34714615
has body: I have created an entity that selects all players from a database: @NamedQueries({ @NamedQuery(name ="player.findAll", query = "select p from Player p") }) and then I have created a stateless bean and its interface that implements the method. private EntityManager em; ... public List<Player> findAllPlayers(){ TypedQuery <Player> query = em.createNamedQuery("player.findAll", Player.class); List<Player> results = query.getResultList(); return results; } and in interface its signature public List<Player> findAllPlayers(); then I have created a stateless facade that works as a controller(MVC-structure). @EJB PlayerEAOLocal playerEAO; ...//Some more code public List <Player> findAllPlayers(){ return playerEAO.findAllPlayers(); } //And in interface... public List <Player> findAllPlayers(); To make it clearer this is what I have done: An entity A local java bean(stateless) + Interface. and a facade + Interface that refers to the beans. Now I have created a servlet that the JSP will use for calling the FacadeLocal class(interface). In my doPost method I have this implemented: protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { response.setContentType(CONTENT_TYPE); FacadeLocal f = (FacadeLocal) facade.findAllPlayers(); request.setAttribute("facade", f); } and then I have the JSP file: <% FacadeLocal facade = (FacadeLocal)request.getAttribute("facade"); %> <input type = "text" name= "showAll" value = "<%= facade.findAllPlayers()%>"> But I get a nullPointerException The error message ERROR [org.apache.catalina.core.ContainerBase.[jboss.web].[default-host].[/PlayerClientProject].[jsp]] (http-localhost-127.0.0.1-8080-1) Servlet.service() for servlet jsp threw exception: java.lang.NullPointerException at org.apache.jsp.ShowAllPlayers_jsp._jspService(ShowAllPlayers_jsp.java:81) at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:70) [jbossweb-7.0.13.Final.jar:] at javax.servlet.http.HttpServlet.servi…
score: 0
has comment: http://stackoverflow.com/comment/34709879
type: Question
tagged with: java
has answer: http://stackoverflow.com/a/22770824
tagged with: servlets
answer count: 1
tagged with: jsp

http://stackoverflow.com/a/22761160
type: AcceptedAnswer
downvote count: 0
has body: You are comparing a string (the forceId parameter of you java method) to an integer in the database (the ForceID column in your database). You need to convert forceID from a string to an integer in your java code and pass it to your prepared statment as an integer. pstmt.setInt(1, (int)Double.parseDouble(fourceID));
type: Answer
accepted answer of: http://stackoverflow.com/q/22760643
score: 2
answers question: http://stackoverflow.com/q/22760643
upvote count: 2

http://stackoverflow.com/comment/34581371
type: AnswerComment
type: Comment
has text: Updated my answer too.
comment on: http://stackoverflow.com/a/22696022
score: 0

http://stackoverflow.com/a/27338415
has body: simply put - int x = System.in.read(); automatically throws an exception. you allocated and defined a memory cell to hold an int, then assigned a byte to be stored there. Recast the input or use a diff. input method.
answers question: http://stackoverflow.com/q/22708071
score: 0
type: Answer

http://stackoverflow.com/comment/34544964
score: 0
has text: possible duplicate of [Why does autoboxing make some calls ambiguous in Java?](http://stackoverflow.com/questions/501412/why-does-autoboxing-make-some-calls-ambiguous-in-java)
comment on: http://stackoverflow.com/q/22676060
type: QuestionComment
type: Comment

http://stackoverflow.com/q/22691232
has body: I heard that the new version of Java String made ​​support in the operator Switch. Does it work now in Android?
tagged with: java
tagged with: switch-statement
type: Question
linked to: http://stackoverflow.com/q/7153989
has comment: http://stackoverflow.com/comment/34572387
has title: Is it possible to use already String in Switch?
has comment: http://stackoverflow.com/comment/34571075
answer count: 1
tagged with: string
has comment: http://stackoverflow.com/comment/34571274
has comment: http://stackoverflow.com/comment/34571192
has comment: http://stackoverflow.com/comment/34571818
tagged with: android
has answer: http://stackoverflow.com/a/22691262
type: UnansweredQuestion
score: 0
has comment: http://stackoverflow.com/comment/34571055
linked to: http://stackoverflow.com/q/14367629

http://stackoverflow.com/q/22687374
accepted answer: http://stackoverflow.com/a/22687992
type: AnsweredQuestion
tagged with: java
has comment: http://stackoverflow.com/comment/34564712
type: Question
tagged with: broadcastreceiver
has title: How to reload/refresh Main Activity from BroadcastReceiver class outside MainActivity - Android
has answer: http://stackoverflow.com/a/22687992
score: 0
answer count: 1
has body: I have a MainActivity class that calls a server to fetch messages in the onCreate() method. Then I have a BroadcastReceiver class outside the MainActivity class. This is my BroadcastReceiver class: 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); Bundle extras = intent.getExtras(); if (extras != null) { // This is where I want to refresh/reload MainActivity } } } If extras != null I want to refresh my MainActivity class so that it does the onCreate() call again. How can I do this? This is my manifest file snippet: &lt;receiver android:name="za.co.vine.samplepush.GcmBroadcastReceiver" android:permission="com.google.android.c2dm.permission.SEND" &gt; &lt;intent-filter&gt; &lt;!-- Receives the actual messages. --&gt; &lt;action android:name="com.google.android.c2dm.intent.RECEIVE" /&gt; &lt;category android:name="za.co.vine.samplepush" /&gt; &lt;/intent-filter&gt; &lt;/receiver&gt;
tagged with: android-activity
has comment: http://stackoverflow.com/comment/34565513
tagged with: android

http://stackoverflow.com/comment/35258017
type: Comment
score: 0
comment on: http://stackoverflow.com/a/23032093
has text: If it is the correct approach, would you mind editing your answer to include it in your POM?
type: AnswerComment

http://stackoverflow.com/comment/34681221
type: Comment
score: 0
type: AnswerComment
has text: Yes, I've updated the answer to include a skeleton of what that would like.
comment on: http://stackoverflow.com/a/22751834

http://stackoverflow.com/comment/34745790
type: AnswerComment
has text: it works, but when I look at net.sf.json.JSONObject jsonObject = a.getContent() it just converts that entry to a JsonArray
type: Comment
score: 0
comment on: http://stackoverflow.com/a/22769052

http://stackoverflow.com/a/26793189
has body: There’s a Windows service that runs on the database server called the “SQL Server Browser” that needed to be restarted. The service was listed as running, but it wasn’t responding to queries. As soon as we restarted this service everything started working again. Here’s some more information on this service. http://msdn.microsoft.com/en-us/library/hh510203.aspx
type: Answer
answers question: http://stackoverflow.com/q/22670189
score: 0

http://stackoverflow.com/comment/34586821
score: 1
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/22699276
has text: `regular expressions are very expensive` it depends on how you are using them. This solution can be optimized using separate Pattern class, but it does solve problem.

http://stackoverflow.com/comment/34706682
type: AnswerComment
type: Comment
has text: My answer does the same thing with a less elegant regex: It anchors to the start of the word. Knowing there's only one search per line makes the word-boundary un-needed. Smart.
comment on: http://stackoverflow.com/a/22765746
score: 0

http://stackoverflow.com/a/22717403
answers question: http://stackoverflow.com/q/22717218
has comment: http://stackoverflow.com/comment/34619800
type: AcceptedAnswer
downvote count: 0
accepted answer of: http://stackoverflow.com/q/22717218
has body: Your ArrayList holds int[][] elements, that is two dimensional integer arrays. By retrieving the first element using chunkHolder.get(0), you get a two dimensional integer array. These things, if printed, produce something like what you got. If you wanted the array elements, you would Retrieve an array element (like you did) Retrieve the elements of the array As suggested, you might want to use (from Java 5) Arrays.deepToString(arr): System.out.println(Arrays.deepToString(chunkHolder.get(0))); Otherwise, you can loop over the array to print it out. For example: int[][] a = chunkHolder.get(0); for (int[] b : a) { for (int c : b) { System.out.print(c + " "); } System.out.println(); }
type: Answer
has comment: http://stackoverflow.com/comment/34619420
upvote count: 3
score: 3
has comment: http://stackoverflow.com/comment/34619388

http://stackoverflow.com/comment/43945943
type: AnswerComment
type: Comment
has text: Note that 'method B' behaviour is what allows stream operations like `findFirst()` and `findAny()` and other 'short-circuit terminal operations' to be fast.
comment on: http://stackoverflow.com/a/22736179
score: 0

http://stackoverflow.com/a/22707438
has body: If node in your list have references to more than two elements (previous and next), it is not a list, it's more complicated data structure. For your problem I recommend you to create function, which allows you to transfer Cartesian coordinates into linear coordinates. Then add elements into list by linear coordinates (I think, ArrayList is more suitable for you). Technically, your matrix will be stored in a single list.
type: Answer
answers question: http://stackoverflow.com/q/22707307
score: 0

http://stackoverflow.com/comment/34785665
type: Comment
comment on: http://stackoverflow.com/a/22785500
has text: Thanks that works well just wondering what final alters when you put it on a integer value
score: 0
type: AnswerComment

http://stackoverflow.com/comment/34696283
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/22759983
has text: Why is your regex trying to match the `ends with`-part whereas you say, you want to match the `does not end with`-part? It's somehow confusing.
score: 0

atomic
type: Tag
tags question: http://stackoverflow.com/q/22756225
tag name: atomic

http://stackoverflow.com/comment/34512555
type: QuestionComment
has text: Apparently the program is fully working this way. I don't see any bug.
score: 0
comment on: http://stackoverflow.com/q/22657100
type: Comment

http://stackoverflow.com/q/22692811
downvote count: 0
has body: I need to load in a given String which will be type in as an input String： 20 6 .................... ..XXXXX..XXX.XXX..X. ..X.X.X..X.XXX.X..X. ..XXXXX..XX.X..X.... ..XX......XXXXXX..X. .................... something like that. It contains 2 integers and a String with "." and "X" Now I just want to ask 2 questions: 1)I need to load the 2 integers first,but how can get the first two integers by BufferedReader?(the 2 int is divide by space between each other and the rest) 2)Then after loading the two integers,how can I load the following rest string char by char?(Like everytime I need to just load one char,then I go to some function,then come back and load the next char;and between there is no blank space) Here is part of my code: BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); String str=br.readLine(); number1 = Integer.parseInt(); number2 = Integer.parseInt(); And now I don't know how to continue...Anyone can help me to load it?
tagged with: bufferedreader
tagged with: string
favorite count: 0
has answer: http://stackoverflow.com/a/22693054
has answer: http://stackoverflow.com/a/22692899
has title: How to load String by BufferedReader?
type: UnansweredQuestion
score: 1
upvote count: 1
tagged with: java
has comment: http://stackoverflow.com/comment/34574261
type: Question
answer count: 2

http://stackoverflow.com/a/22771946
downvote count: 0
has comment: http://stackoverflow.com/comment/34720289
has comment: http://stackoverflow.com/comment/34755936
score: 6
accepted answer of: http://stackoverflow.com/q/22771756
answers question: http://stackoverflow.com/q/22771756
has comment: http://stackoverflow.com/comment/34759069
has comment: http://stackoverflow.com/comment/34717676
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/34717460
upvote count: 6
has comment: http://stackoverflow.com/comment/34717849
has body: Well you're freezing the UI thread by doing that, so one approach would be to create a new Thread, and use a Handler to post back to the UI thread, so that it doesn't get clogged up and can continue drawing. For instance: final ProgressBar pbar = (ProgressBar) findViewById(R.id.bar); // Final so we can access it from the other thread pbar.setVisibility(View.VISIBLE); // Create a Handler instance on the main thread Handler handler = new Handler(); // Create and start a new Thread new Thread(new Runnable() { public void run() { try{ Thread.sleep(5000); } catch (Exception e) { } // Just catch the InterruptedException // Now we use the Handler to post back to the main thread handler.post(new Runnable() { public void run() { // Set the View's visibility back on the main UI Thread pbar.setVisibility(View.INVISIBLE); } }); } }).start(); And, as Chris suggested below, you should remove any pending messages from the Handler when the Activity is closing to avoid running into an IllegalStateException when trying to run the posted message/Runnable in an Activity that no longer exists: @Override public void onDestroy() { handler.removeCallbacksAndMessages(null); super.onDestroy(); }
has comment: http://stackoverflow.com/comment/34718129
type: Answer

http://stackoverflow.com/a/22665050
type: Answer
answers question: http://stackoverflow.com/q/22664788
downvote count: 0
has comment: http://stackoverflow.com/comment/34525761
score: 1
upvote count: 1
has body: This is almost certainly an application packaging problem. Are you sure you have the itext jar file on your classpath?

http://stackoverflow.com/a/22776042
score: 1
upvote count: 1
has body: for(int k = 0; k&lt; hashTable[j].size(); j++ ) { outputFile.write((hashTable[j].get(k).getWord()) + " " +(hashTable[j].get(k).getFrequency())+"\n"); outputFile.flush(); } In your inner for loop you increments the J. so at the first iteration j become greater than 16. so first loop doesn't iterate for second time. your code should be correct as public static void produceOutputFile() throws IOException { PrintWriter outputFile = new PrintWriter(new FileWriter("created_output_file.txt", true)); for(int j = 0; j &lt; hashTable.length; j++) { System.out.println(hashTable.length); System.out.println(j); if(hashTable[j] != null) { if(hashTable[j].size() &gt; 1) { for(int k = 0; k&lt; hashTable[j].size(); k++) { outputFile.write((hashTable[j].get(k).getWord()) + " " +(hashTable[j].get(k).getFrequency())+"\n"); outputFile.flush(); } } else { outputFile.write((hashTable[j].get(0).getWord()) + " " +(hashTable[j].get(0).getFrequency())+ "\n"); outputFile.flush(); } } } outputFile.close(); } here
answers question: http://stackoverflow.com/q/22775878
downvote count: 0
type: Answer

http://stackoverflow.com/a/22798075
has comment: http://stackoverflow.com/comment/34764684
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/34764704
upvote count: 23
has comment: http://stackoverflow.com/comment/34764741
has comment: http://stackoverflow.com/comment/34764791
has comment: http://stackoverflow.com/comment/34764446
has comment: http://stackoverflow.com/comment/34764314
has comment: http://stackoverflow.com/comment/34770098
type: Answer
has comment: http://stackoverflow.com/comment/34769986
accepted answer of: http://stackoverflow.com/q/22797964
has body: It looks like this was a long-standing bug in JDK 7 that was finally fixed. See for example: https://bugs.openjdk.java.net/browse/JDK-8029896 https://bugs.openjdk.java.net/browse/JDK-7131459 There is a draft plan to provide the following advisory with JDK 8 which explains the issue: --------------------------------------------------------------------- Area: Core Libraries / java.text Synopsis: A wrong rounding behavior of JDK7 has been fixed. The rounding behavior of NumberFormat/DecimalFormat format() method has changed when value is very close to a tie sitting exactly at the rounding position specified in the formatting pattern. Nature of Incompatibility: behavioral Description: When using NumberFormat/DecimalFormat classes, the rounding behavior of previous JDK versions was wrong in some corner cases. This wrong behaviour happened when calling format() method with a value that is very close to a tie, while rounding position specified by the pattern of the NumberFormat/DecimalFormat instance used is exactly sitting at the position of the tie. In that case wrong double rounding or erroneous non-rounding behavior happened. As an example, while using default recommended NumberFormatFormat API form: NumberFormat nf = java.text.NumberFormat.getInstance() followed by nf.format(0.8055d), value 0.8055d is recorded in the computer as 0.80549999999999999378275106209912337362766265869140625 since this value cannot be represented exactly in binary format. Here default rounding rule is "half-even", and the result of calling format() in JDK7 is a wrong output of "0.806", while correct result is "0.805" since value recorded in memory by the computer is "below" the tie. This new behavior is also implemented for all rounding positions that might be defined by any pattern chosen by the programmer (non default ones). RFE 7131459
answers question: http://stackoverflow.com/q/22797964
score: 23
has comment: http://stackoverflow.com/comment/34764392
has comment: http://stackoverflow.com/comment/34764866
has comment: http://stackoverflow.com/comment/34769996
downvote count: 0
has comment: http://stackoverflow.com/comment/34764518
has comment: http://stackoverflow.com/comment/34764664

http://stackoverflow.com/comment/34606445
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/22709774
has text: How are you running Tomcat?
score: 0

http://stackoverflow.com/comment/79582109
has text: This doesn't include the module which IntelliJ also requires. Not crazy about this side of IntelliJ, too many places to check the same thing.
comment on: http://stackoverflow.com/a/30522340
type: AnswerComment
score: 0
type: Comment

http://stackoverflow.com/a/22744345
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/22744294
upvote count: 3
answers question: http://stackoverflow.com/q/22744294
type: Answer
downvote count: 0
score: 3
has body: You have a basic misunderstanding of the concept. Arithmetic is performed on numbers, not on octal numbers or decimal numbers or hexadecimal numbers. The octal/decimal/hex aspect refers only to the written representation. As you probably know, to write a literal octal value in the code, you prefix it with a leading zero. Similarly to write a hex value you prefix it with 0x. To print a value in octal, use Integer.toOctalString(int). To parse a string and interpret it as an octal value, use Integer.parseInt(value, radix), and specify 8 as the radix. For example, you two examples become: int value1 = Integer.parseInt("5", 8); int value2 = Integer.parseInt("3", 8); int result = value1 + value2; System.out.println(Integer.toOctalString(result)); and int value1 = Integer.parseInt("12", 8); int value2 = Integer.parseInt("3", 8); int result = value1 - value2; System.out.println(Integer.toOctalString(result));

http://stackoverflow.com/comment/34656766
type: Comment
score: 1
comment on: http://stackoverflow.com/a/22738415
type: AnswerComment
has text: @felixd: One can make `PeriodicTable` class as Singleton and then there will be no need of having a reference to the object. One can then easily query the elements by atomic number and symbol, by static method access. Its just few lines of code change.

http://stackoverflow.com/comment/34658724
has text: Thanks! Although probably not the best way to do it, I just setFocusable(false) to all the buttons.
score: 0
type: QuestionComment
comment on: http://stackoverflow.com/q/22738919
type: Comment

http://stackoverflow.com/a/22795897
answers question: http://stackoverflow.com/q/22795563
score: 99
has body: You can use java.lang.Thread for parallel execution. However, in most cases it's easier to use an java.util.concurrent.ExecutorService. The latter provides a method to submit a Callable and returns a Future to get the result later (or wait for completion). If testA.abc() and testB.xyz() should be executed in parallel, you use the ExecutorService to execute the former in a separate thread whereas the latter is executed in the original thread. Then you wait for the completion of the former for synchronization. ExecutorService executor = ... // e.g. Executors.newFixedThreadPool(4); Future&lt;Void&gt; future = executor.submit(new Callable&lt;Void&gt;() { public Void call() throws Exception { testA.abc(); return null; } }); testB.xyz(); future.get(); // wait for completion of testA.abc()
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/93352302
upvote count: 99
type: Answer
downvote count: 0
accepted answer of: http://stackoverflow.com/q/22795563

http://stackoverflow.com/comment/34812259
comment on: http://stackoverflow.com/q/22807601
type: Comment
type: QuestionComment
score: 1
has text: You have the FX equivalent of JList: it's ListView. To get the selected index(es) or selected items, just query the selectionModel.

http://stackoverflow.com/comment/34666629
has text: your excel might have fields like 1.0,2.0
score: 0
type: Comment
comment on: http://stackoverflow.com/q/22744104
type: QuestionComment

http://stackoverflow.com/comment/34723319
has text: if you got it, then answer your own question. Nice problem solving.
comment on: http://stackoverflow.com/q/22774486
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/q/22773177
tagged with: java
type: Question
has body: The following code is meant to do the the listed tasks 1: create 3 linked lists 2: populate the first two 3: sort the first two 4: merge the first two linked lists with the third one by removing nodes from each of the first two, saving the data, and inserting it into the third list the code to do that is as follows import java.util.*; import java.util.Scanner; class Node { //stores int values public int data; public Node next; public Node(int d){ data = d; next = null; } //------------------------------------------------------------------- public void displayNode() { System.out.print(data); } //------------------------------------------------------------------- } //------------------------------------------------------------------- //------------------------------------------------------------------- class NodeList { private Node first; public NodeList(){ first = null; } //------------------------------------------------------------------- public boolean isEmpty(){ return first == null; } //------------------------------------------------------------------- public void inputList(int n){ int x = 0; Node newNode = null; Node last = null; Random randomGenerator = new Random(); Scanner in = new Scanner(System.in); for (int i = 0; i &lt; n; i++){ //System.out.printf("Enter data for node %d: ", i + 1); x = randomGenerator.nextInt(10); newNode = new Node(x); if (isEmpty()){ first = newNode; last = newNode; } else { last.next = newNode; last = last.next; } } System.out.println(); } //------------------------------------------------------------------- public void selectionSort(){ Node p = null; Node q = null; Node r = null; int t = 0; if (isEmpty()){ System.out.println("List is empty"); } else if(first.next != null){ p = first; while (p.next != null){ q = first; while (q.next != null){ if (q.data &gt; q.next.data){ r = q.next; } q = q.next; } //System.out.printf("%d\n", r.data); t = p.data; p.data = r.data; r.data = t; p = p.next; } //System.out.println("List is sorted"); } …
has comment: http://stackoverflow.com/comment/34720087
tagged with: sorting
score: 0
has title: Merging two sorted linked lists into a third linked list (sorting and merging error)
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/34720116
tagged with: singly-linked-list
answer count: 0

http://stackoverflow.com/a/22770190
score: 7
has comment: http://stackoverflow.com/comment/34714161
downvote count: 0
has comment: http://stackoverflow.com/comment/34714052
has comment: http://stackoverflow.com/comment/34714446
has body: With the cursor at the start of the line Ctrl + 1 should bring up a context menu with the option assign to new local variable, I think that is what you are looking for. P.S new rather than New will compile much better ;-)
type: Answer
answers question: http://stackoverflow.com/q/22770101
upvote count: 7

http://stackoverflow.com/comment/34512936
comment on: http://stackoverflow.com/a/22652938
type: Comment
has text: Don't think we are on the same page!!! Do you close browser manually in between the script execution? If yes, it will surely throw exception Or else if you are closing browser manually after all the scripts finished executing, you can write the kill process logic in tear down part! Is that understandable?
score: 0
type: AnswerComment

http://stackoverflow.com/q/22704518
has title: JedisPoolConfig is not assignable to GenericObjectPoolConfig
answer count: 4
favorite count: 0
score: 8
tagged with: redis
downvote count: 0
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/24485482
tagged with: spring
tagged with: java
tagged with: caching
tagged with: jedis
has body: I have a Spring based java web application hosted on Heroku. I am attempting to utilize the Spring Caching abstraction using the Redis implementation. When the server starts, I get an error saying: Type 'redis/clients/jedis/JedisPoolConfig' (current frame, stack[3]) is not assignable to 'org/apache/commons/pool2/impl/GenericObjectPoolConfig' Here is my configuration: @Bean RedisConnectionFactory jedisConnectionFactory() throws Exception { URI redisUri = new URI(System.getenv("REDISCLOUD_URL")); JedisConnectionFactory redisConnectionFactory = new JedisConnectionFactory(); redisConnectionFactory.setHostName(redisUri.getHost()); redisConnectionFactory.setPort(redisUri.getPort()); redisConnectionFactory.setPassword(redisUri.getUserInfo().split(":",2)[1]); redisConnectionFactory.setUsePool(true); return redisConnectionFactory; } @Bean RedisTemplate&lt;Object, Object&gt; redisTemplate() { RedisTemplate&lt;Object, Object&gt; redisTemplate = new RedisTemplate&lt;Object, Object&gt;(); try { redisTemplate.setConnectionFactory(jedisConnectionFactory()); } catch (Exception e) { // TODO Auto-generated catch block e.printStackTrace(); } return redisTemplate; } @Override @Bean public CacheManager cacheManager() { // configure and return an implementation of Spring's CacheManager SPI RedisCacheManager manager = new RedisCacheManager(redisTemplate()); List&lt;String&gt; caches = new ArrayList&lt;String&gt;(); caches.add("Suppliers"); caches.add("Manufacturer"); caches.add("Sheeting"); caches.add("SignTypeFlat"); manager.setCacheNames(caches); return manager; } Here is the entire Error Message: Caused by: org.springframework.beans.factory.BeanDefinitionStoreException: Factory m ethod [org.springframework.data.redis.connection.RedisConnectionFactory com.signInventory.config.ProdDataSourceConfiguration.jedisConnectionFactory() throws java.lang.Exception] threw exception; nested exception is java.lang.VerifyError: Bad type on operand stack Exception Details: Location: org/springframewor…
upvote count: 8
type: Question
linked to: http://stackoverflow.com/q/20255261
has answer: http://stackoverflow.com/a/23011310
has answer: http://stackoverflow.com/a/25836144
has answer: http://stackoverflow.com/a/56442663

http://stackoverflow.com/a/22658607
has comment: http://stackoverflow.com/comment/34513156
score: 0
upvote count: 1
answers question: http://stackoverflow.com/q/22658366
type: Answer
has body: Primitive data type don't extends Object so you can't call this method with parameter 1.
downvote count: 1

http://stackoverflow.com/comment/34824612
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/22781275
has text: @Jay I tried to `mvn dependency:resolve` or `mvn dependency:tree` to resolve dependencies, but the error remains
score: 0

http://stackoverflow.com/comment/34614812
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/22697172
has text: That's what I thought so initially. Although this is something I have never tried, but will check it out. Thanks for the guidance.
type: Comment

http://stackoverflow.com/a/22788626
answers question: http://stackoverflow.com/q/22788477
downvote count: 0
type: Answer
has body: here's an image panel i found somewhere on the internet when i had the same problem: public class ImagePanel extends JPanel { private java.awt.Image image; private boolean stretched = true; private int xCoordinate; private int yCoordinate; public ImagePanel() { } public ImagePanel(Image image) { this.image = image; } @Override protected void paintComponent(Graphics g) { super.paintComponent(g); if (image != null) { if (isStretched()) { g.drawImage(image, xCoordinate, yCoordinate, getWidth(), getHeight(), this); } else { g.drawImage(image, xCoordinate, yCoordinate, this); } } } public java.awt.Image getImage() { return image; } public void setImage(java.awt.Image image) { this.image = image; repaint(); } public boolean isStretched() { return stretched; } public void setStretched(boolean stretched) { this.stretched = stretched; repaint(); } public int getXCoordinate() { return xCoordinate; } public void setXCoodinate(int xCoordinate) { this.xCoordinate = xCoordinate; } public int getYCoordinate() { return xCoordinate; } public void setYCoordinate(int yCoordinate) { this.yCoordinate = yCoordinate; repaint(); } } to add an image to the panel use something like this: ImagePanel imagePanel = new ImagePanel(); BufferedImage image = ImageIO.read(new File("C:\\IMAGES\\"+ String.valueOf(i+1) + ".jpg")); imagePanel.setImage(image);
has comment: http://stackoverflow.com/comment/34747315
upvote count: 1
has comment: http://stackoverflow.com/comment/34746777
score: 1

http://stackoverflow.com/a/75981994
answers question: http://stackoverflow.com/q/22707097
score: 0
has body: One of the reason could be. You have not saved your program. Before running javac command always save the program(if u did any changes then only). Then running javac command will produce .class file.
type: Answer

breakout
type: Tag
tag name: breakout
tags question: http://stackoverflow.com/q/22777498

http://stackoverflow.com/a/22703692
has comment: http://stackoverflow.com/comment/34595084
answers question: http://stackoverflow.com/q/22703646
has comment: http://stackoverflow.com/comment/34595298
score: 1
has comment: http://stackoverflow.com/comment/34595256
has body: Synchronization isn't absolute; it's always relative to another action. In the case of a synchronized block, the synchronization is between the closing of one synchronized block and the opening of a subsequent one on the same object. Since your get method doesn't use synchronized, there is no happens-before relationship established between it and the set method. The getting thread could read a partially-set object put in by the setter, due to reorderings. For instance, if you put in ("Foo", 123), the getting thread could read that that same object as having state (null, 123): the 123 state is there, but the "Foo" state hasn't yet been written (or flushed to this core's memory, etc). Besides the synchronized block, another form of synchronization happens between the writing of a volatile field and the subsequent reading of that same field. That &mdash; and only that &mdash; is what provides the happens-before relationship you need in this case. The synchronized block in the setter only makes sure that this.o isn't set twice, nothing more.
has comment: http://stackoverflow.com/comment/34595260
downvote count: 0
upvote count: 1
type: Answer

jtable
tags question: http://stackoverflow.com/q/22696402
tags question: http://stackoverflow.com/q/22676071
tags question: http://stackoverflow.com/q/22710570
tags question: http://stackoverflow.com/q/22688848
tags question: http://stackoverflow.com/q/22746381
tags question: http://stackoverflow.com/q/22799236
tags question: http://stackoverflow.com/q/22715707
tags question: http://stackoverflow.com/q/22681898
tags question: http://stackoverflow.com/q/22745706
type: Tag
tags question: http://stackoverflow.com/q/22745244
tags question: http://stackoverflow.com/q/22648359
tags question: http://stackoverflow.com/q/22790686
tags question: http://stackoverflow.com/q/22734739
tags question: http://stackoverflow.com/q/22756353
tags question: http://stackoverflow.com/q/22657812
tag name: jtable
tags question: http://stackoverflow.com/q/22681192
tags question: http://stackoverflow.com/q/22686736
tags question: http://stackoverflow.com/q/22685423
tags question: http://stackoverflow.com/q/22663387
tags question: http://stackoverflow.com/q/22726896
tags question: http://stackoverflow.com/q/22749387
tags question: http://stackoverflow.com/q/22648799
tags question: http://stackoverflow.com/q/22680424
tags question: http://stackoverflow.com/q/22767701
tags question: http://stackoverflow.com/q/22698488
tags question: http://stackoverflow.com/q/22680691

http://stackoverflow.com/comment/34650436
type: Comment
type: AnswerComment
comment on: http://stackoverflow.com/a/22734730
has text: You can either print the lines from the server after a certain buffer size, a certain number of lines or when certain content is present in the stream. Or, I guess, even after a certain amount of time has passed.
score: 0

http://stackoverflow.com/comment/34723388
has text: I have updated the code to accommodate your requirement
type: Comment
comment on: http://stackoverflow.com/a/22770464
score: 0
type: AnswerComment

http://stackoverflow.com/comment/34551064
comment on: http://stackoverflow.com/q/22674892
type: Comment
score: 0
has text: @TessellatingHeckler Sorry, that code was for illustration purposes only and not mathematically correct. I should have pointed that out. I will correct that in my question.
type: QuestionComment

http://stackoverflow.com/comment/34604219
type: AnswerComment
score: 0
type: Comment
has text: But I have a problem testing it since my Spring configuration also states directly "folderName"... I need to know how to configure the project/module so the Spring configuration will work in testing time as well as production.
comment on: http://stackoverflow.com/a/22708287

http://stackoverflow.com/comment/34655887
has text: Thanks, I really appreciate your help. Looking at your corrections I can see where I made my mistakes!
type: AnswerComment
score: 0
comment on: http://stackoverflow.com/a/22737885
type: Comment

http://stackoverflow.com/q/22749205
tagged with: android
upvote count: 4
has comment: http://stackoverflow.com/comment/34677145
has comment: http://stackoverflow.com/comment/37574211
tagged with: java
has title: error: Error: No resource found that matches the given name (at 'resource' with value '@xml/device_filter')
tagged with: eclipse
type: Question
score: 4
downvote count: 0
has answer: http://stackoverflow.com/a/47779030
answer count: 1
linked to: http://stackoverflow.com/q/921533
has body: Android has me completely at a loss here. Android noob and I think it shows: I get the following error in the Android Manifest file : error: Error: No resource found that matches the given name (at 'resource' with value '@xml/device_filter'). I have retyped both the manifest file and the xml/device_file manually with no copying and pasting. Looked at both files with a hex editor to see if there were any lurking odd characters but zero , nothing. I have tried renaming both files, moving them to other folders and back again and Cleaned Project after every attempt. R is not generating either. <?xml version="1.0" encoding="utf-8"?> <uses-sdk android:minSdkVersion="12" android:targetSdkVersion="19" /> <uses-feature android:name="android.hardware.usb.host" /> <action android:name="android.intent.action.MAIN" /> <category android:name="android.intent.category.LAUNCHER" /> <action android:name="android.hardware.usb.action.USB_DEVICE_ATTACHED" /> <meta-data android:name="android.hardware.usb.action.USB_DEVICE_ATTACHED" android:resource="@xml/device_filter" /> And here is the device_filter.xml code: <?xml version="1.0" encoding="utf-8"?> <usb-accessory manuafacturer="FTDI" model="FTDIUARTDemo" version="1.0" /> <usb-accessory manufacturer="FTDI" model="Android Accessory FT312D" version="1.0" /> <usb-device manufacturer="FTDI" vendor-id="1027" version="1.0" />
tagged with: http://stackoverflow.com/tag/xml
favorite count: 0
type: UnansweredQuestion

alignment
tags question: http://stackoverflow.com/q/22776546
tags question: http://stackoverflow.com/q/22695068
tags question: http://stackoverflow.com/q/22756353
tag name: alignment
type: Tag

http://stackoverflow.com/q/22755912
score: 1
tagged with: java
possible better answer: http://stackoverflow.com/a/22758787
type: Question
has answer: http://stackoverflow.com/a/22758787
tagged with: hadoop
has body: My local environment: OS X 10.9.2, Hbase-0.94.17, Java 1.6 My Hbase mode: standalone I was able to do operation in shell, but when I used java api, it did not work. My java code: import java.io.IOException; import org.apache.hadoop.conf.Configuration; import org.apache.hadoop.hbase.HBaseConfiguration; import org.apache.hadoop.hbase.client.Get; import org.apache.hadoop.hbase.client.HTable; import org.apache.hadoop.hbase.client.Put; import org.apache.hadoop.hbase.client.Result; import org.apache.hadoop.hbase.client.ResultScanner; import org.apache.hadoop.hbase.client.Scan; import org.apache.hadoop.hbase.util.Bytes; public class MyLittleHBaseClient { public static void main(String[] args) throws IOException { Configuration config = HBaseConfiguration.create(); config.addResource("/Users/apple/Documents/tools/hbase-0.94.17/conf/hbase-site.xml"); HTable table = new HTable(config, "myLittleHBaseTable"); Put p = new Put(Bytes.toBytes("myLittleRow")); p.add(Bytes.toBytes("myLittleFamily"), Bytes.toBytes("someQualifier"), Bytes.toBytes("Some Value")); table.put(p); Get g = new Get(Bytes.toBytes("myLittleRow")); Result r = table.get(g); byte [] value = r.getValue(Bytes.toBytes("myLittleFamily"), Bytes.toBytes("someQualifier")); String valueStr = Bytes.toString(value); System.out.println("GET: " + valueStr); Scan s = new Scan(); s.addColumn(Bytes.toBytes("myLittleFamily"), Bytes.toBytes("someQualifier")); ResultScanner scanner = table.getScanner(s); try { for (Result rr = scanner.next(); rr != null; rr = scanner.next()) { // print out the row we found and the columns we were looking for System.out.println("Found row: " + rr); } } finally { scanner.close(); } } } Here is some of my conf doc: ###########################################hbase-env.sh: export JAVA_HOME=`/usr/libexec/java_home -v '1.6*'` export HBASE_OPTS="-XX:+UseConcMarkSweepGC" ###########################################hbase-site.sh: hbase.rootdir file:///Users/apple/Documents/tools/hbase-0.94.17/hbase-rootdir/hb…
has title: Get stuck when using java api to connect Hbase
has answer: http://stackoverflow.com/a/46571063
accepted answer: http://stackoverflow.com/a/22757651
linked to: http://stackoverflow.com/q/22800894
downvote count: 0
favorite count: 0
tagged with: hbase
upvote count: 1
has answer: http://stackoverflow.com/a/29136632
has answer: http://stackoverflow.com/a/22757651
answer count: 4
type: AnsweredQuestion
linked to: http://stackoverflow.com/q/7134723

http://stackoverflow.com/q/22807287
has answer: http://stackoverflow.com/a/22807416
score: 0
tagged with: installation
type: UnansweredQuestion
has title: How to set Public jre manually?
linked to: http://stackoverflow.com/q/21412853
has answer: http://stackoverflow.com/a/22807394
tagged with: java
type: Question
answer count: 2
has body: I faced with following problem on Windows. I used java 7. Then I need to use java 6. I download jdk 6 and install it. I set JAVA_HOME and PATH environment variables. But after it I tryed to type java -version in cmd. I got answer - java -7. I typed command where java and I got 2 strings: first - in windows/sytem32 second - in Program Files As I understood in windows/sytem32 windows stores public jre. How can I correctly replace public JRE to 6 version at this case? But I just remove java.exe and javaw.exe from windows/sytem32 folder and after it java -version returns java 6. But I affraid that this way is incorrect. What should I do at this situation?

http://stackoverflow.com/a/22764116
type: Answer
accepted answer of: http://stackoverflow.com/q/22764039
answers question: http://stackoverflow.com/q/22764039
downvote count: 0
score: 1
has comment: http://stackoverflow.com/comment/34704492
upvote count: 1
has comment: http://stackoverflow.com/comment/34703568
type: AcceptedAnswer
has body: use new String(byte[]) instead of toString(): Toast.makeText(getApplicationContext(),new String(pattern), Toast.LENGTH_LONG).show();
has comment: http://stackoverflow.com/comment/34703656
has comment: http://stackoverflow.com/comment/34703701

http://stackoverflow.com/q/22785796
score: -1
tagged with: eclipse
has answer: http://stackoverflow.com/a/22786022
answer count: 2
has body: Find Dialog allows to search for specific elements but by name only
upvote count: 0
has answer: http://stackoverflow.com/a/22785924
favorite count: 0
has comment: http://stackoverflow.com/comment/34742551
type: UnansweredQuestion
tagged with: java
has title: Is it possible to find an element by its value in Eclipse Expressions view?
downvote count: 1
type: Question
tagged with: debugging

http://stackoverflow.com/comment/134937329
score: 0
type: Comment
comment on: http://stackoverflow.com/a/49527267
has text: I get `Invalid URL: r2dbc:oracle:thin:@HOST:PORT:SID` PS: as you can see, I'm using r2dbc
type: AnswerComment

http://stackoverflow.com/comment/34637517
comment on: http://stackoverflow.com/q/22727422
score: 0
type: QuestionComment
has text: yea exactly. it does seem to recognize the 'filepath/file' part as something because without it it just exits, as per the if statement, but it doesnt really do anything with it until I type it in again
type: Comment

http://stackoverflow.com/comment/34594313
type: AnswerComment
comment on: http://stackoverflow.com/a/22703445
score: 0
type: Comment
has text: Actually I knew how to write regexp for that. Thank you though, as the question had regex tag, your answer is still valid. :)

http://stackoverflow.com/q/22786424
has answer: http://stackoverflow.com/a/53227210
tagged with: glassfish
answer count: 3
has answer: http://stackoverflow.com/a/22787921
upvote count: 7
favorite count: 0
has title: Glassfish schedule(timer) exception
type: AnsweredQuestion
possible better answer: http://stackoverflow.com/a/39684964
downvote count: 0
has answer: http://stackoverflow.com/a/39684964
tagged with: java
type: Question
tagged with: jakarta-ee
has body: i am trying repeat this tutorial on Glassfish 4 and java EE7. So i created simple WebApp with maven in Netbeans. I created simple class: import java.util.Date; import javax.ejb.Schedule; import javax.ejb.Stateless; @Stateless public class NewClass { @Schedule(minute = "*/1", hour = "*",persistent = false) public void anyMethod() { System.out.println("hello "+new Date()); } } But when i am deploing app to the server, i get this exception: Info: EJB5181:Portable JNDI names for EJB NewClass: [java:global/WebApplication1/NewClass, java:global/WebApplication1/NewClass!NewClass] Severe: Exception while invoking class org.glassfish.ejb.startup.EjbApplication start method java.lang.RuntimeException: EJB Timer Service is not available at com.sun.ejb.containers.BaseContainer.startApplication(BaseContainer.java:3951) at org.glassfish.ejb.startup.EjbApplication.start(EjbApplication.java:163) at org.glassfish.internal.data.EngineRef.start(EngineRef.java:122) at org.glassfish.internal.data.ModuleInfo.start(ModuleInfo.java:291) at org.glassfish.internal.data.ApplicationInfo.start(ApplicationInfo.java:352) at com.sun.enterprise.v3.server.ApplicationLifecycle.deploy(ApplicationLifecycle.java:497) at com.sun.enterprise.v3.server.ApplicationLifecycle.deploy(ApplicationLifecycle.java:219) at org.glassfish.deployment.admin.DeployCommand.execute(DeployCommand.java:491) at com.sun.enterprise.v3.admin.CommandRunnerImpl$2$1.run(CommandRunnerImpl.java:527) at com.sun.enterprise.v3.admin.CommandRunnerImpl$2$1.run(CommandRunnerImpl.java:523) at java.security.AccessController.doPrivileged(Native Method) at javax.security.auth.Subject.doAs(Subject.java:360) at com.sun.enterprise.v3.admin.CommandRunnerImpl$2.execute(CommandRunnerImpl.java:522) at com.sun.enterprise.v3.admin.CommandRunnerImpl.doCommand(CommandRunnerImpl.java:546) at com.sun.enterprise.v3.admin.CommandRunnerImpl.doCommand(CommandRunnerImpl.java:1423) at com.sun.enterprise.v3.admin.CommandRunnerImpl.access$1500(CommandRunnerImpl.jav…
tagged with: ejb
accepted answer: http://stackoverflow.com/a/22787921
score: 7

http://stackoverflow.com/comment/34690397
type: QuestionComment
comment on: http://stackoverflow.com/q/22757112
score: 0
has text: You should only post relevant code.
type: Comment

http://stackoverflow.com/q/22705095
type: Question
has title: autowired object shows null even after @Configurable class
has comment: http://stackoverflow.com/comment/34597290
tagged with: aspectj
has comment: http://stackoverflow.com/comment/34597094
has comment: http://stackoverflow.com/comment/34597200
has comment: http://stackoverflow.com/comment/34597547
has body: I have this class in which I want to access ILibraryRepository's autowired object. I make an object of this class using new AddLibraryProcessor(). So I used @Configurable but still the output shows null. @Configurable(autowire = Autowire.BY_TYPE) public class AddLibraryProcessor implements ICommandProcessor<AddLibrary> { @Autowired ILibraryRepository repository; @Override public IWebApiResponse Process(AddLibrary command) throws DomainProcessException{ System.out.println(repository); return null; } } my pom.xml looks like : 4.0.0 com.springapp xyzL war 1.0-SNAPSHOT xyz <spring.version>3.2.0.RELEASE</spring.version> org.aspectj aspectjrt 1.7.3 org.springframework spring-aspects 3.2.4.RELEASE org.springframework spring-tx 3.2.4.RELEASE org.springframework spring-core ${spring.version} org.springframework spring-web ${spring.version} javax.servlet servlet-api 2.5 javax.servlet.jsp jsp-api 2.1 provided org.springframework spring-webmvc ${spring.version} org.springframework spring-test ${spring.version} test junit junit 4.8.2 test org.freemarker freemarker 2.3.14 org.springframework spring-context-support 3.2.4.RELEASE com.fasterxml.jackson.datatype jackson-datatype-json-org 2.0.2 commons-dbcp commons-dbcp 1.2.2 log4j log4j 1.2.17 org.modelmapper modelmapper 0.6.3 org.hibernate hibernate-entitymanager 3.6.0.Final org.hibernate.javax.persistence hibernate-jpa-2.0-api 1.0.0.Final org.hibernate hibernate-validator 4.1.0.Final jar compile javax.xml.bind jaxb-api com.sun.xml.bind jaxb-impl org.springframework spring-orm ${spring.version} org.codehaus.jackson jackson-mapper-asl 0.9.9-6 postgresql postgresql 9.1-901.jdbc4 NGL org.codehaus.mojo aspectj-maven-plugin 1.6 true 1.7 1.7 ignore 1.7 UTF-8 false org.springframework spring-aspects compile test-compile org.aspectj aspectjrt 1.7.4 org.aspectj aspectjtools 1.7.4 maven-surefire-plugin **/*Tests.java
answer count: 1
has comment: http://stackoverflow.com/comment/34597129
favorite count: 0
has comment: http://stackoverflow.com/comment/34597112
upvote count: 2
type: UnansweredQuestion
tagged with: maven
has comment: http://stackoverflow.com/comment/34597190
has comment: http://stackoverflow.com/comment/34597239
tagged with: spring-mvc
has comment: http://stackoverflow.com/comment/34597258
score: 1
tagged with: java
has answer: http://stackoverflow.com/a/22705315
downvote count: 1

http://stackoverflow.com/q/22761210
downvote count: 0
score: 1
has comment: http://stackoverflow.com/comment/34698294
favorite count: 0
type: Question
tagged with: oracle-database
has body: I have no idea why I am getting this error, In the program i am not accessing any array. But its still giving this error. java.lang.ArrayIndexOutOfBoundsException: 0 at oracle.jdbc.driver.OracleSql.main(OracleSql.java:1666) I have posted the code below. public class ItT4 { public static void main(String[] args) { try { // loading the class Class.forName("oracle.jdbc.driver.OracleDriver"); } catch (Exception e) { e.printStackTrace(); } }//closing main }//closing class I have set the class path required for drivers. and even gone through few links in stackoverflow. Modified I removed everything and tried printing out the s simple statement. Still i am getting the same error. The code is given below. public class ItT4 { public static void main(String[] args) { System.out.println("hello boss"); } }
tagged with: jdbc
accepted answer: http://stackoverflow.com/a/22761675
has title: java.lang.ArrayIndexOutOfBoundsException: for jdbc connection
tagged with: database-connection
upvote count: 1
answer count: 1
has comment: http://stackoverflow.com/comment/34700882
has comment: http://stackoverflow.com/comment/34698247
has comment: http://stackoverflow.com/comment/34701226
tagged with: java
tagged with: oracle10g
has comment: http://stackoverflow.com/comment/34701189
has answer: http://stackoverflow.com/a/22761675
type: AnsweredQuestion

http://stackoverflow.com/comment/34618358
comment on: http://stackoverflow.com/a/22716966
type: AnswerComment
score: 0
type: Comment
has text: If only you could code faulty runtime environments away... But nope, this is going to be a very annoying battle with tech support / system administrators to try and persuade them it is NOT a code problem and in fact requires them to look into this.

http://stackoverflow.com/comment/34687232
type: Comment
type: QuestionComment
has text: Did you try to add *different* debug output in the *different* `if` clauses?
comment on: http://stackoverflow.com/q/22755312
score: 0

http://stackoverflow.com/a/22672284
upvote count: 1
has comment: http://stackoverflow.com/comment/34537980
type: Answer
answers question: http://stackoverflow.com/q/22672228
downvote count: 0
score: 1
has body: You need to get each element and then test it. Currently you're calling next() twice in a row. So if you have a List that contains (1,2,3,4) and you're starting the first iteration, this line: if (iter.next().intValue()&lt;=6 &amp;&amp; iter.next().intValue()&gt;=2) is equivalent to: if (1&lt;=6 &amp;&amp; 2&gt;=2) To avoid that store the element and then perform your tests. while (iter.hasNext()) { Integer i = iter.next(); if (i.intValue()&lt;=6 &amp;&amp; i.intValue()&gt;=2) { iter.remove(); } } Note that you are not using your min and max parameters values. Also I don't know why you made your method generic. After your edit, far away from the original post, the problem is that you call next() without knowing if your list contains some elements and even if it has, it would loop infinitely since you're not calling next() inside your loop (because hasNext() will always return true). So it should be: while (iter.hasNext()) { int i=iter.next(); if (i&lt;=6 &amp;&amp; i&gt;=2) { iter.remove(); } } Be aware that your list can contains null elements, so this line int i=iter.next(); could throw a NPE when trying to unbox the value in the Integer object. Finally if you're using java-8 (again be aware of null elements) you could do: l.removeIf(i -&gt; i &gt;= min &amp;&amp; i &lt;= max);

http://stackoverflow.com/comment/34642349
comment on: http://stackoverflow.com/a/22730160
type: Comment
has text: Thanks. But out.close() forces the response to be sent in my example. When I remove the out.close() line and have only out.flush() the response is sent after 1500ms, so both sleeps are processed before the response is sent.
type: AnswerComment
score: 0

http://stackoverflow.com/a/22664424
type: Answer
answers question: http://stackoverflow.com/q/22664086
has comment: http://stackoverflow.com/comment/34523487
has comment: http://stackoverflow.com/comment/34524001
has comment: http://stackoverflow.com/comment/34524059
score: 0
has body: I cannot see the code for this because you do not list it. However, the problem here seems to be with the list variable, which in all likelihood is actually an array itself. So where you want to add an actual array, then use the $each operator with $push instead: BasicDBObject updateCommand = new BasicDBObject(); updateCommand.append( "$push", new BasicDBObject( "imageContent", new BasicDBObject( "$each", list ) )); That will take an array/list and add all of the listed items to the existing array, as opposed to "pushing" the array into an existing array.

http://stackoverflow.com/q/22666861
upvote count: 1
has comment: http://stackoverflow.com/comment/34527973
downvote count: 1
type: Question
linked to: http://stackoverflow.com/q/2902458
linked to: http://stackoverflow.com/q/3422673
has title: Java doing arithmetic using variable operators
has comment: http://stackoverflow.com/comment/34528038
score: 0
has comment: http://stackoverflow.com/comment/34527956
answer count: 1
accepted answer: http://stackoverflow.com/a/22666992
favorite count: 0
duplicate of: http://stackoverflow.com/q/2902458
has answer: http://stackoverflow.com/a/22666992
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/34540846
has body: ok so the variable current is an operator ( +-*/%) and t1 = stack.pop() is a number in String formation t2 = stack.pop() is a number in String formation also I need to carry out the mathematical operation t2 current t1 (t2 "operator" t1, basically) How would you go about this. Thanks in advance!
has comment: http://stackoverflow.com/comment/34527950
tagged with: java

http://stackoverflow.com/a/22889287
type: Answer
upvote count: 5
answers question: http://stackoverflow.com/q/22681771
downvote count: 0
has body: can you try this?, and ensure that you are using the latest JDK 7 public static void main(String[] args) { GraphicsEnvironment ge = GraphicsEnvironment.getLocalGraphicsEnvironment(); String[] fontFamilies = ge.getAvailableFontFamilyNames(); for (String ff : fontFamilies) { System.out.println(ff); } }
score: 5

http://stackoverflow.com/comment/34742731
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/22783903
has text: i dont have any parseInt or String, i just have a form wich netbeans created automatically, i am just testing how can i start my swing local with jnlp, i set my web start, i have launch.jnlp and launch.html in dist folder, i cant run it why?

http://stackoverflow.com/comment/34725111
type: QuestionComment
comment on: http://stackoverflow.com/q/22750373
has text: I am using the scale equation to calculate the variable h (along with a constant of 5cm for the maps size on my phone) the angular size equation (http://en.wikipedia.org/wiki/Forced_perspective). Me and a friend came up with the solution presented below which essentially uses it to solve for a leg of a triangle. If you would proof read my solution, or offer up an alternative solution, I would be extremely grateful.
score: 0
type: Comment

http://stackoverflow.com/q/22707787
tagged with: java
downvote count: 2
has title: How to update JList in multiple window?
has comment: http://stackoverflow.com/comment/34602698
tagged with: swing
has comment: http://stackoverflow.com/comment/34602614
type: Question
has body: I am trying to update JList on multiple windows. How can I do that? Here is my code, please help me. samplListModel = new DefaultListModel&lt;String&gt;(); sampleList = new JList&lt;String&gt;(samplListModel); samplListModel.addElement("Cities"); cityField = new JTextField(); cityField.setColumns(10); cityButton = new JButton("Update"); JPanel panel = new JPanel(); panel.add(sampleList); panel.add(cityField); panel.add(cityButton); this.add(panel); this.setSize(500, 400); this.setVisible(true); this.setDefaultCloseOperation(EXIT_ON_CLOSE); cityButton.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent ae) { samplListModel.addElement(cityField.getText()); cityField.setText(""); } });
has comment: http://stackoverflow.com/comment/34602681
has answer: http://stackoverflow.com/a/22708378
has comment: http://stackoverflow.com/comment/34602568
has comment: http://stackoverflow.com/comment/34602107
has comment: http://stackoverflow.com/comment/34602450
has comment: http://stackoverflow.com/comment/34603580
score: 0
has comment: http://stackoverflow.com/comment/34601751
linked to: http://stackoverflow.com/q/9554636
answer count: 2
has answer: http://stackoverflow.com/a/22708010
has comment: http://stackoverflow.com/comment/34602168
favorite count: 0
has comment: http://stackoverflow.com/comment/34601826
has comment: http://stackoverflow.com/comment/34602296
has comment: http://stackoverflow.com/comment/34601669
type: UnansweredQuestion
tagged with: jlist
has comment: http://stackoverflow.com/comment/34602637
has comment: http://stackoverflow.com/comment/34602195
upvote count: 2

setcontentview
tags question: http://stackoverflow.com/q/22656915
type: Tag
tag name: setcontentview

http://stackoverflow.com/comment/34662765
comment on: http://stackoverflow.com/q/22740314
score: 0
type: Comment
has text: For a working calculator, see [Calculet](http://stackoverflow.com/a/7441804/418556).
type: QuestionComment

http://stackoverflow.com/comment/34548089
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/22677146
has text: @adneal I added what you said and the three line side menu logo is there now but it still doesnt activate the menu

http://stackoverflow.com/q/22681703
has comment: http://stackoverflow.com/comment/34554345
has comment: http://stackoverflow.com/comment/34554390
has comment: http://stackoverflow.com/comment/34612638
has title: Recommended architecture for login in GWT
has comment: http://stackoverflow.com/comment/34554288
score: 0
linked to: http://stackoverflow.com/q/10298463
answer count: 1
has body: What would be the recommandations for designing a login screen in GWT? I know that GWT is completely Async but the login process is fairly binary, you're either logged in now or never, but not something like perhaps later... Is there a way to make the client side wait? Should I have some kind of client side call back? Any idea is appreciated...
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/34554511
has answer: http://stackoverflow.com/a/22739556
tagged with: gwt
tagged with: java
tagged with: authentication
has comment: http://stackoverflow.com/comment/34557757
linked to: http://stackoverflow.com/q/2974100
type: Question

http://stackoverflow.com/comment/34612607
comment on: http://stackoverflow.com/q/22713288
type: Comment
type: QuestionComment
has text: I did some research and found that the `Interval` object will fit my needs perfectly, doesn't explain the issue with my other method, but it fixs the problem.
score: 0

http://stackoverflow.com/comment/34592612
has text: "[Yoda conditions](http://blog.codinghorror.com/new-programming-jargon)."
score: 1
comment on: http://stackoverflow.com/a/22702449
type: AnswerComment
type: Comment

http://stackoverflow.com/a/22743754
type: Answer
has body: Using DecimalFormat works fine for all the cases: DecimalFormat dec = new DecimalFormat("#.00"); double cellValue = Double.valueOf(dec.format(111)); XSSFCell cell = sheet.createRow(0).createCell(0); cell.setCellValue(cellValue); this set the cell value to 111 only.
has comment: http://stackoverflow.com/comment/34667284
score: 0
answers question: http://stackoverflow.com/q/22743039

http://stackoverflow.com/comment/34610121
type: AnswerComment
comment on: http://stackoverflow.com/a/22712332
score: 0
type: Comment
has text: Of course, because you have destroyed the original string.

http://stackoverflow.com/a/22745437
type: Answer
answers question: http://stackoverflow.com/q/22745241
has body: You can implement Comparator public SecondClassComparator implements Comparator&lt;SecondClass&gt; { public int compare (SecondClass c1, SecondClass c2) { // Do some comparision } }
score: 0

http://stackoverflow.com/comment/34726070
has text: Java wouldn't work without a GC as there are too many places where things get allocated. Actually everything including for-each loops and all libraries would be unusable if there was nobody to clean up.
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/22770068
score: 0

http://stackoverflow.com/comment/34742041
type: QuestionComment
has text: Analyze the Stacktrace, the first errors are in low-level socket classes. Any firewall?
type: Comment
comment on: http://stackoverflow.com/q/22785838
score: 0

http://stackoverflow.com/a/22714320
type: Answer
accepted answer of: http://stackoverflow.com/q/22712935
has body: As you seem to have strings that need to be (optionally) padded with zeros, you can use a different approach than generally used to pad integers: public String addPadding(int length, String text) { StringBuilder sb = new StringBuilder(); // First, add (length - 'length of text') number of '0' for (int i = length - text.length(); i &gt; 0; i--) { sb.append('0'); } // Next, add string itself sb.append(text); return sb.toString(); } so you can use: "B-" + // prefix addPadding(2, LoginActivity.strEventID) + "-" + // eventID addPadding(2, LoginActivity.strOperativeID) + "-" + // operativeID getNextNumber() + // counter ".jpg" There are lots of other possibilities to pad a String, see this question for more details/possibilities.
score: 3
upvote count: 3
type: AcceptedAnswer
downvote count: 0
answers question: http://stackoverflow.com/q/22712935

http://stackoverflow.com/comment/34538916
has text: Look here http://stackoverflow.com/questions/6343166/android-os-networkonmainthreadexception.
comment on: http://stackoverflow.com/a/22672902
score: 0
type: AnswerComment
type: Comment

http://stackoverflow.com/comment/34653511
comment on: http://stackoverflow.com/q/22736539
has text: I also do not understand exactly what kind of list you are talking about. Do you mean a list of students?
type: Comment
type: QuestionComment
score: 1

http://stackoverflow.com/comment/34749774
type: AnswerComment
score: 0
type: Comment
has text: @AnubianNoob your new example also won't work, as you can't execute a class name.
comment on: http://stackoverflow.com/a/22789851

http://stackoverflow.com/comment/34614546
type: Comment
comment on: http://stackoverflow.com/a/22714932
score: 0
type: AnswerComment
has text: He has `this.context` con is not delcared. I think its a typo error op has

http://stackoverflow.com/comment/34777673
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/22805489
has text: the BBDD have a schema (dbo.gv_productos), could be so

http://stackoverflow.com/a/22764401
has comment: http://stackoverflow.com/comment/34703745
type: Answer
upvote count: 1
score: 1
has comment: http://stackoverflow.com/comment/34704306
has body: The sun.reflect packages are not deprecated. They are for internal use by the JDK only. Oracle (formerly Sun) does not document the internal packages and does not guarantee that they will exist on all Java platform implementations (any vendor can make a Java platform implementation) nor that they will be the same in all versions of the standard Oracle Java platform implementation. Oracle explains this on their website: The sun.* packages are not part of the supported, public interface. A Java program that directly calls into sun.* packages is not guaranteed to work on all Java-compatible platforms. In fact, such a program is not guaranteed to work even in future versions on the same platform.
has comment: http://stackoverflow.com/comment/34703974
has comment: http://stackoverflow.com/comment/34704008
downvote count: 0
answers question: http://stackoverflow.com/q/22764175
has comment: http://stackoverflow.com/comment/34703998
has comment: http://stackoverflow.com/comment/34704422

http://stackoverflow.com/q/22738173
has comment: http://stackoverflow.com/comment/34659350
has title: Exception in thread "main" java.lang.ArrayIndexOutOfBoundsException: 3 when adding objects of array
has body: I need to do a program with a method that receives a two dimensional 3*3 array with the information of several Professors (created in a class called "Professor") and gets the amount of hours they work, how much money they make per hour and add them up to a variable that returns the total amount that's paid to the professors. I've already created the classes, the array, the objects with the information using the constructor, and put each object in every index of the array. However, when I loop through the array I always get this error message as output: Exception in thread "main" java.lang.ArrayIndexOutOfBoundsException: 3 Here's my code (The last two numbers on the objects are (in order) the amount of hours the professor works, and the money they make per hour. I created all the objects with the same information for testing purposes, so 8 would be the hours and 1.66 the amount of money: public static void main(String[] args) { // TODO code application logic here Scanner in = new Scanner(System.in); Profesor arreglo[][]; arreglo = new Profesor[3][3]; Profesor profe1 = new Profesor(126509404, "Edgar", "Hernandez", 29, "M", 8, 1.66); Profesor profe2 = new Profesor(233849920, "Nuria", "Ramírez", 52, "F", 4, 2.84); Profesor profe3 = new Profesor(126509404, "Edgar", "Hernandez", 29, "M", 8, 1.66); Profesor profe4 = new Profesor(126509404, "Edgar", "Hernandez", 29, "M", 8, 1.66); Profesor profe5 = new Profesor(126509404, "Edgar", "Hernandez", 29, "M", 8, 1.66); Profesor profe6 = new Profesor(126509404, "Edgar", "Hernandez", 29, "M", 8, 1.66); Profesor profe7 = new Profesor(126509404, "Edgar", "Hernandez", 29, "M", 8, 1.66); Profesor profe8 = new Profesor(126509404, "Edgar", "Hernandez", 29, "M", 8, 1.66); Profesor profe9 = new Profesor(126509404, "Edgar", "Hernandez", 29, "M", 8, 1.66); arreglo[0][0] = profe1; arreglo[0][1] = profe2; arreglo[0][2] = profe3; arreglo[1][0] = profe4; arreglo[1][1] = profe5; arreglo[1][2] = profe6; arreglo[2][0] = profe7; arreglo[2][1] = profe…
tagged with: java
score: -1
type: Question
has comment: http://stackoverflow.com/comment/34656235
answer count: 3
upvote count: 1
has comment: http://stackoverflow.com/comment/34656248
tagged with: arrays
has answer: http://stackoverflow.com/a/22738185
has comment: http://stackoverflow.com/comment/34659530
favorite count: 0
has answer: http://stackoverflow.com/a/22738210
tagged with: multidimensional-array
has comment: http://stackoverflow.com/comment/34656310
has answer: http://stackoverflow.com/a/22738231
type: UnansweredQuestion
downvote count: 2

http://stackoverflow.com/q/22676405
has comment: http://stackoverflow.com/comment/34545704
has comment: http://stackoverflow.com/comment/34545437
upvote count: 2
downvote count: 2
has answer: http://stackoverflow.com/a/22677445
type: Question
has comment: http://stackoverflow.com/comment/34545295
has comment: http://stackoverflow.com/comment/34545856
tagged with: java
has title: Polymorphism in Java - can I set an object to a specific type?
has comment: http://stackoverflow.com/comment/34546177
score: 0
answer count: 3
has answer: http://stackoverflow.com/a/22677603
has comment: http://stackoverflow.com/comment/34545234
has comment: http://stackoverflow.com/comment/34546402
tagged with: polymorphism
tagged with: inheritance
has answer: http://stackoverflow.com/a/22676968
favorite count: 0
has body: I am a programmer who is getting to grasps with polymorphism after a long break and I was wondering if the following is possible. Say I had a super class in which there were some instance variables A, B and C. In all subclasses A and B are strings and behave as such in all subclasses however in all of the subclasses, the type of C may depend on the state of the subclass. I was wondering if it is possible to set C as type 'Object' in the superclass and then specify its type in each subclass using wrapper classes. e.g public class SuperClass { String A; String B; Object C; public SuperClass(){} } } public class SubClassA extends SuperClass { public SubClassA () { C = new String(); //notice this type is different from its type in the next class } } public class SubClassB extends SuperClass { public SubClassB () { C = new Integer(); } } your thoughts would be appreciated :) Thanks
type: UnansweredQuestion

http://stackoverflow.com/q/22683220
downvote count: 0
has answer: http://stackoverflow.com/a/22737093
tagged with: pane
has title: set boundary limit for draggable pane inside its parent pane
favorite count: 0
has answer: http://stackoverflow.com/a/44969131
accepted answer: http://stackoverflow.com/a/22737093
type: AnsweredQuestion
score: 3
possible better answer: http://stackoverflow.com/a/44969131
upvote count: 3
tagged with: java
tagged with: javafx
type: Question
has body: I have a draggable pane which is inside another pane. I want to make the child pane be draggable only inside the boundary of the parent pane but by default, the child pane can be dragged anywhere. How to solve this problem.
answer count: 2

http://stackoverflow.com/comment/34514019
comment on: http://stackoverflow.com/q/22659114
has text: No this looks like JSP scriptlets, i.e. the _javascript_ tag is misplaced here ;)
score: 2
type: QuestionComment
type: Comment

http://stackoverflow.com/comment/34598302
type: Comment
comment on: http://stackoverflow.com/a/22705434
has text: @EJP yeah I also read your comments on another article regarding EOF exception.With reputaion points you are having I don't think you can be wrong in any case.So Now I believe that I have to use try and catch block.Also if you could plz take a look at this http://stackoverflow.com/questions/22659969/paramvalues-not-working-in-jstl-and-throwing-an-exception.
score: 0
type: AnswerComment

http://stackoverflow.com/comment/34654083
score: 0
type: Comment
has text: This drawing is added to another panel in a different class as `LeftSidePanel.add(new DrawStatus(),BorderLayout.CENTER);` perhaps the problem is in that class
type: QuestionComment
comment on: http://stackoverflow.com/q/22736963

http://stackoverflow.com/comment/34662367
score: 0
type: QuestionComment
has text: try to change 'thread' radio to 'all'
comment on: http://stackoverflow.com/q/22741299
type: Comment

http://stackoverflow.com/a/22697354
answers question: http://stackoverflow.com/q/22697242
score: 0
has body: I think the UTF-8 needs a hyphen try this: String s = new String(myArray, "UTF-8") EDIT There might also be a problem with reading UTF-8 every time in the String. The Byte order mark (BOM) will only be in the first bytes of the file, not every 64k. It might be better to use a Reader BufferedReader in = new BufferedReader( new InputStreamReader(new FileInputStream(myFile), "UTF-8")); AND you might also have a problem printing the String to the console if the console isn't UTF-8 so you have to change the encoding there too. PrintStream out = new PrintStream(System.out, true, "UTF-8"); String str; while ((str = in.readLine()) != null) { out.println(str); }
type: Answer

http://stackoverflow.com/a/22804748
has body: You can find the dimensions of an array using recursion and reflection. Given the method dimensions: private int dimensions(Class arrayType) { return arrayType.isArray() ? 1 + dimensions(arrayType.getComponentType()) : 0 } When calling the dimensions method like this: int[] oneDimensionalArray = new int[0]; int[][] twoDimensionalArray = new int[0][0]; int[][][] threeDimensionalArray = new int[0][0][0]; System.out.println(dimensions(oneDimensionalArray.getClass())); System.out.println(dimensions(twoDimensionalArray.getClass())); System.out.println(dimensions(threeDimensionalArray.getClass())); Will print: 1 2 3
type: Answer
score: 1
upvote count: 1
answers question: http://stackoverflow.com/q/22804048
downvote count: 0

http://stackoverflow.com/a/22749778
accepted answer of: http://stackoverflow.com/q/22749647
type: Answer
answers question: http://stackoverflow.com/q/22749647
upvote count: 2
score: 2
has comment: http://stackoverflow.com/comment/34677487
has body: Try this one JPanel panel=new MyPanel(); JScrollPane pane = new JScrollPane(ScrollPaneConstants.VERTICAL_SCROLLBAR_ALWAYS, ScrollPaneConstants.HORIZONTAL_SCROLLBAR_ALWAYS); pane.getViewport().add(panel); Here MyPanel is a class that extend from JPanel. You can set the horizontal and vertical scroll bars visibility also. -- EDIT -- Please have a look at main method. public static void main(String[] a) { JFrame fram = new JFrame(); FoldersAndFiles b = new FoldersAndFiles(); JScrollPane pane = new JScrollPane(ScrollPaneConstants.VERTICAL_SCROLLBAR_ALWAYS, ScrollPaneConstants.HORIZONTAL_SCROLLBAR_ALWAYS); pane.getViewport().add(b); fram.getContentPane().add(pane); b.addToTotalFolderAndFiles(new FolderAndFilePaths()); fram.pack(); fram.setVisible(true); fram.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); }
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/34677291
downvote count: 0

http://stackoverflow.com/comment/34522748
comment on: http://stackoverflow.com/a/22663736
type: Comment
has text: Ah, I think I'm understanding now . . . The range is how many neighbours it is greater than! Got you. Easy fix.
score: 1
type: AnswerComment

http://stackoverflow.com/comment/34620433
has text: yes but without scope... now add but no changes...
score: 0
comment on: http://stackoverflow.com/q/22708241
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/34652126
score: 1
comment on: http://stackoverflow.com/q/22735857
type: Comment
type: QuestionComment
has text: You haven't really described your issue... please provide us with more information. A short but complete program demonstrating the problem would be helpful.

http://stackoverflow.com/q/22701151
tagged with: android
answer count: 1
has title: Andengine sprite dynamic Zindex
type: AnsweredQuestion
tagged with: java
has answer: http://stackoverflow.com/a/22703514
has body: in my game I have some moving sprites that overlap and I want to set Zindex of each sprite dynamically, to get something like perspective view. I can set Zindex of each sprite when i create a scene, but they move in random direction, so I have to set Zindex of each sprite and do sortChildren() for every frame but this is very performance costly. Is there an alternative to set sprites layer dynamically? I'm new to andengine and gamedev, hope you will understand my question. Some test code here(code executes every frame in update thread): public void sortEnemy(){ int indexZ; Iterator&lt;Enemy&gt; enemyIterator = EnemyList.iterator(); while (enemyIterator.hasNext()) { Enemy e = (Enemy) enemyIterator.next(); for(int j = EnemyList.size() - 1; j &gt;= 0; j--){ Enemy e2 = (Enemy) EnemyList.get(j); if(e.getY()&gt;e2.getY()){ indexZ = e2.getZIndex(); Debug.e("e2 z= "+indexZ); indexZ++; Debug.e("e z= "+indexZ); e.setZIndex(indexZ); enemyLayer.sortChildren(); } } } }
accepted answer: http://stackoverflow.com/a/22703514
tagged with: andengine
type: Question
score: 0

http://stackoverflow.com/q/22777774
tagged with: cassandra-cli
has answer: http://stackoverflow.com/a/22881928
has body: I am new bie in cassandra and i want to fetch multiple row keys in column counter family,just like MultigetSliceQuery.is it possible or not ??? for example my colunfamily definition is create column family MyCounters with default_validation_class=CounterColumnType and comparator=UTF8Type; and data structure is RowKey:111111 =&gt;name=like, value=2222 =&gt;name=share, value=2542 =&gt;name=comment, value=3532 RowKey:111112 =&gt;name=like, value=2542 =&gt;name=share, value=25524 =&gt;name=comment, value=32 RowKey:111113 =&gt;name=like, value=22 =&gt;name=share, value=22 =&gt;name=comment, value=32 RowKey:111114 =&gt;name=like, value=22 =&gt;name=share, value=542 =&gt;name=comment, value=332 RowKey:111115 =&gt;name=like, value=949 =&gt;name=share, value=226 =&gt;name=comment, value=342 now i want to fetch all row keys using multi getslice query.it is possible to fetch record using multiget slice query or any other query?
upvote count: 1
type: Question
possible better answer: http://stackoverflow.com/a/22778357
has answer: http://stackoverflow.com/a/22778357
tagged with: cassandra-2.0
tagged with: java
linked to: http://stackoverflow.com/q/8448911
answer count: 2
accepted answer: http://stackoverflow.com/a/22881928
downvote count: 0
score: 1
favorite count: 0
has title: How to get multiple rows key values from counter column family in Cassandra .
tagged with: cassandra
tagged with: hector
type: AnsweredQuestion

http://stackoverflow.com/comment/34626519
type: QuestionComment
type: Comment
has text: @RC.: A debugger, while usually useful, would not help here, since the program's logic would work just fine, but the the cause of the problem, the `Thread.sleep(...)` freezing the Swing event dispatch thread (EDT) and thus freezing Swing graphics, would be something that would be very hard to isolate with a standard debugger.
comment on: http://stackoverflow.com/q/22721098
score: 0

jpype
tag name: jpype
tags question: http://stackoverflow.com/q/22795634
type: Tag

http://stackoverflow.com/comment/34752778
type: QuestionComment
comment on: http://stackoverflow.com/q/22790368
type: Comment
has text: @DonChakkappan I just checked and yes it is OutputToAFileBrocEast.java
score: 0

http://stackoverflow.com/a/61984400
has comment: http://stackoverflow.com/comment/109639627
answers question: http://stackoverflow.com/q/22803246
has comment: http://stackoverflow.com/comment/109639761
score: 0
has body: You can add this to the configuration of the maven-surefire-plugin in the pom.xml file. all 10 2 2 6 <parallelTestTimeoutInSeconds>3.5</parallelTestTimeoutInSeconds> <parallelTestTimeoutForcedInSeconds>5</parallelTestTimeoutForcedInSeconds> true **/FunctionTestSuite.java A detailed explanation can be found at this link. It gives a complete description step by step to run JUnit tests parallel with surefire-maven-plugin. Note: This code snippet shows all the available options. You can change or remove some options as per your need!
has comment: http://stackoverflow.com/comment/109639861
type: Answer
has comment: http://stackoverflow.com/comment/109639651
has comment: http://stackoverflow.com/comment/109639537

http://stackoverflow.com/a/22783486
has body: In the line: when(restClientUtil.orderStatusUpdateToProvider(request,"http://localhost:8080")).thenReturn(response); response is not initialized. The if-else condition is incorrect in orderStatusUpdate method, because if the response is null, the logger still tries to access the status code from it.
has comment: http://stackoverflow.com/comment/34743923
has comment: http://stackoverflow.com/comment/34741663
downvote count: 0
score: 1
has comment: http://stackoverflow.com/comment/34744639
type: Answer
answers question: http://stackoverflow.com/q/22782848
upvote count: 1

http://stackoverflow.com/comment/34550589
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/22679542
score: 0
has text: So you want to move `hunt()` method to super class?

http://stackoverflow.com/q/22667485
has comment: http://stackoverflow.com/comment/34529616
has answer: http://stackoverflow.com/a/22672773
tagged with: multithreading
upvote count: 1
type: AnsweredQuestion
has body: I have a program which simulates an Airport which is based on the code found here: http://www.javapractices.com/topic/TopicAction.do?Id=51 Which has three classes: Airport, Airplane and AirportSimulator (in my case) and uses threads to synchronise actions. The problem I'm having is that when the airplane is waiting for runway space for landing, the notifyAll() function doesn't seem to be working, and as such the airplane stays in an infinite loop of "waiting" for space. I think the problem lies with either the wait() being infinite due to not being interrupted, or the notifyAll() not working and notifying the threads (airplanes) which are waiting on them. Any help is appreciated. EDIT: Here are the classes. Airplane.java public class Airplane implements Runnable { public Airplane(Airport anAirport, String FlightID) { fAirport = anAirport; aFlightID = FlightID; } @Override public void run() { takeOff(); fly(); land(); } //Private private Airport fAirport; private String aFlightID; private void takeOff() { synchronized(fAirport) { while(!fAirport.hasAvailableRunway()) { System.out.println(aFlightID + ": waiting for runway space"); try { fAirport.wait(); } catch(InterruptedException ex) { System.err.println(ex); Thread.currentThread().interrupt(); } } System.out.println(aFlightID + ": departing now..."); } } private void fly() { System.out.println(aFlightID + ": now flying..."); try { //wait for 10 seconds Thread.sleep(10000); } catch(InterruptedException ex) { System.err.println(ex); Thread.currentThread().interrupt(); } } private void land() { synchronized(fAirport) { while(!fAirport.hasAvailableRunway()) { System.out.println(aFlightID + ": waiting for runway space"); try { fAirport.wait(); } catch(InterruptedException ex) { System.err.println(ex); Thread.currentThread().interrupt(); } } } } } Airport.java public class Airport implements Runnable { public Airport(String aName) { super(); fName = aName; } public synchronized boolean hasAvailableRunway() { return fHasA…
tagged with: java
accepted answer: http://stackoverflow.com/a/22672773
type: Question
downvote count: 0
has comment: http://stackoverflow.com/comment/34533890
has comment: http://stackoverflow.com/comment/34529225
answer count: 1
score: 1
has title: wait() or notifyAll() creating infinite loop
favorite count: 0

http://stackoverflow.com/comment/34655763
type: Comment
has text: what is the name of xml file?
type: QuestionComment
score: 0
comment on: http://stackoverflow.com/q/22737853

http://stackoverflow.com/q/22693020
possible better answer: http://stackoverflow.com/a/23571426
tagged with: sql
accepted answer: http://stackoverflow.com/a/22693266
downvote count: 0
favorite count: 0
tagged with: ajax
upvote count: 2
tagged with: oracle-database
has answer: http://stackoverflow.com/a/22693266
has answer: http://stackoverflow.com/a/23571426
has title: Change application from Oracle to Hadoop
score: 2
type: AnsweredQuestion
tagged with: java
type: Question
tagged with: hadoop
answer count: 2
has body: I currently have a web application that runs with all of the data in Oracle. At the high level, the application consists of a java applet, some java servlets, some Ajax, and the oracle database. I was wondering what converting the whole suite to Hadoop instead would cost in terms of work? Below are some questions that can help me get a grasp on it. Is there any software that can take SQL database schema creation scripts and queries and convert them to appropriate calls in Hadoop? How different are the Java APIs for communicating with Hadoop to that of oracle SQL? Theres a bit of Ajax in there too, how different is that from SQL to Hadoop? Please consider me a beginner when explaining anything having to do with Hadoop. I don't need to drill down into specifics (unless you want to), just high level talks. Thanks!

android-broadcast
tag name: android-broadcast
type: Tag
tags question: http://stackoverflow.com/q/22686436

http://stackoverflow.com/comment/34551268
comment on: http://stackoverflow.com/a/22653428
has text: If you place **visualization.txt** under **C Drive**, You can initialize in the following way: `BufferedReader in = new BufferedReader(new FileReader("C:\\visualization.txt"));`. Edited my answer.
type: AnswerComment
score: 0
type: Comment

http://stackoverflow.com/q/22710363
answer count: 1
favorite count: 0
type: UnansweredQuestion
linked to: http://stackoverflow.com/q/7493823
has title: java iterative deepening on tree without recursion
has body: I currently have a depth first search implemented as followed: protected void algorithmLogic() { currentNode = ((Stack&lt;Node&gt;) expanded).pop(); if(atGoal()) { // Goal reached so stop return; } else { visited.add(currentNode); if(currentNode.hasChild()) { for(int i=currentNode.getChildren().size()-1;i&gt;-1;i--) { ((Stack&lt;Node&gt;) expanded).push(currentNode.getChildren().get(i)); } } } } This is working on a tree on nodes. Is it possible to edited this code in some way such that it performed iterative deepening search? Say with limit 2? I can't think of a way to track the level.
score: 1
tagged with: java
type: Question
tagged with: iterative-deepening
downvote count: 0
tagged with: search
has answer: http://stackoverflow.com/a/22724573
upvote count: 1

http://stackoverflow.com/q/22668701
tagged with: actionlistener
has body: I have a form in a JDialog starting with a JComboBox: myJComboBox = new JComboBox(itemOfBox); myJpanel.add(myJComboBox); When I don't care what my default itemOfBox is, I have some JSliders shown by default. When I change my itemOfBox from the JDialog user interface, I have an ActionListener on my myJComboBox which changes the JSliders in function of the itemOfBox (ranges, default values, etc). So far, all works fince since I don't care about my default itemOfBox. Now I want to keep all these working, but to add that if I have a requiredItemOfBox, to be able to set the myJComboBox to it, but also to activate the ActionListener on myJComboBox on the new itemOfBox (which is my requiredItemOfBox now) myJComboBox.setSelectedItem(requiredItemOfBox); So when I don't have a requiredItemOfBox (in this case it's "", so the previous line does nothing to the program), I have the first item of my JComboBox with the default values and default JSliders and when I select another item of the list, I have my ActionListener to take care of it. When I have the requiredItemOfBox (!), I manage to make my JDialog select it, but every time I have to click again on it to update my JSliders. How may I solve this problem ? Thank you for your help and sorry for my english.
type: UnansweredQuestion
tagged with: jdialog
has title: Activate ActionListener on JComboBox setSelectedItem()
has answer: http://stackoverflow.com/a/22668887
type: Question
has comment: http://stackoverflow.com/comment/34532963
tagged with: swing
tagged with: jcombobox
score: 0
tagged with: java
answer count: 1

http://stackoverflow.com/comment/34665291
type: QuestionComment
has text: @rcook I'd say this is almost certainly a homework assignment. The input is probably fairly naive, but since the OP didn't tell us that it's homework, I'm just guessing.
type: Comment
comment on: http://stackoverflow.com/q/22743247
score: 0

http://stackoverflow.com/a/22666768
score: 0
upvote count: 1
downvote count: 1
answers question: http://stackoverflow.com/q/22666377
type: Answer
has body: You can just build your own compare functions , and use one of the sort algorithms easiest and slowest: BubbleSort ( O(N^2) ). hardest but fastest : MergeSort( (O(Nlog(n) ) . now in both algos you have the part that asks if A > B , in this part you should put your compare func. boolean compare(int x, int y){ if(/* your crazy compare condition */) return true; else return false; } example in bubble sort : procedure bubbleSort( A : list of sortable items ) repeat swapped = false for i = 1 to length(A) - 1 inclusive do: /* if this pair is out of order */ if compare(A[i],A[i-1]) then // Notcie the compare instead of A[i] &gt; A[i-1] /* swap them and remember something changed */ swap( A[i-1], A[i] ) swapped = true end if end for until not swapped end procedure hope this helps

spring-security
tags question: http://stackoverflow.com/q/22750241
tags question: http://stackoverflow.com/q/22783583
tags question: http://stackoverflow.com/q/22709980
tags question: http://stackoverflow.com/q/22781288
tags question: http://stackoverflow.com/q/22769467
type: Tag
tags question: http://stackoverflow.com/q/22680023
tags question: http://stackoverflow.com/q/22670646
tags question: http://stackoverflow.com/q/22802914
tags question: http://stackoverflow.com/q/22663488
tags question: http://stackoverflow.com/q/22738397
tags question: http://stackoverflow.com/q/22678891
tags question: http://stackoverflow.com/q/22779912
tags question: http://stackoverflow.com/q/22666416
tags question: http://stackoverflow.com/q/22740727
tags question: http://stackoverflow.com/q/22779872
tags question: http://stackoverflow.com/q/22785501
tags question: http://stackoverflow.com/q/22729725
tags question: http://stackoverflow.com/q/22722653
tags question: http://stackoverflow.com/q/22738738
tags question: http://stackoverflow.com/q/22729312
tags question: http://stackoverflow.com/q/22696401
tags question: http://stackoverflow.com/q/22657510
tags question: http://stackoverflow.com/q/22694559
tags question: http://stackoverflow.com/q/22744666
tags question: http://stackoverflow.com/q/22804721
tags question: http://stackoverflow.com/q/22764556
tags question: http://stackoverflow.com/q/22652794
tags question: http://stackoverflow.com/q/22778188
tags question: http://stackoverflow.com/q/22703161
tag name: spring-security
tags question: http://stackoverflow.com/q/22683007
tags question: http://stackoverflow.com/q/22747108
tags question: http://stackoverflow.com/q/22804058

http://stackoverflow.com/comment/34515887
type: QuestionComment
score: 1
has text: can you tell me the statement in line 24?
comment on: http://stackoverflow.com/q/22660148
type: Comment

http://stackoverflow.com/q/22731244
linked to: http://stackoverflow.com/q/22724286
has comment: http://stackoverflow.com/comment/34644128
has comment: http://stackoverflow.com/comment/34645699
tagged with: java
has body: I have Menu class with buttons - newGame and quit: public class Menu extends JFrame { JButton newGameButton = new JButton(); ... @Override public void mouseClicked(MouseEvent e) { game.start(); } } After clicking on the button, new game starts, so this class : public class Game extends JPanel implements Runnable { private Thread t; public void start() { t = new Thread(this); t.start(); setVisible(true); } } After I create the JPanel, game starts and buttons aren't visible, but if I click on the position of a button the button blinks and proceed. I'm painting with paintComponent(g) method, I was painting on Canvas instead of JPanel before and it was OK, after I changed it to JPanel I have this problem, any ideas? EDIT: here are the working (Canvas) and not-working(JPanel) codes, in JPanel i can click the button as many times as i want.
type: Question
has answer: http://stackoverflow.com/a/22731377
answer count: 1
has comment: http://stackoverflow.com/comment/34660305
has title: Buttons in JFrame are active after creating new JPanel
score: 0
has comment: http://stackoverflow.com/comment/34645874
has comment: http://stackoverflow.com/comment/34646522
type: UnansweredQuestion
tagged with: swing

http://stackoverflow.com/a/23732566
accepted answer of: http://stackoverflow.com/q/22764387
answers question: http://stackoverflow.com/q/22764387
upvote count: 1
has body: For future references: At the end I could NOT find a good solution to my problem besides the points mentioned in the question.
score: 1
type: AcceptedAnswer
downvote count: 0
type: Answer

http://stackoverflow.com/comment/34691011
comment on: http://stackoverflow.com/a/22757125
score: 0
type: AnswerComment
has text: Thanks it worked with the correct version of the commons-net.
type: Comment

http://stackoverflow.com/a/22795942
score: 1
has body: Normally you would setup a JDBC connection pool and use a JDBC resource to reference it. In the application you configure the JDBC resource used via the persistence.xml. Something like this, when using the default Glassfish derby database (JDBC resource and connection are already setup for this, only the DB must be started): <persistence xmlns="http://java.sun.com/xml/ns/persistence" version="1.0"> jdbc/__default So on all your environments you must ensure the JDBC resource has the same name (if you do not want to change the war file) but the actual config can be different, because it is stored in the Glassfish instance and not in your war file.
type: AcceptedAnswer
upvote count: 1
accepted answer of: http://stackoverflow.com/q/22766056
answers question: http://stackoverflow.com/q/22766056
has comment: http://stackoverflow.com/comment/35163685
type: Answer
has comment: http://stackoverflow.com/comment/34760680
downvote count: 0

http://stackoverflow.com/comment/34701872
score: 0
type: Comment
comment on: http://stackoverflow.com/a/22763343
has text: @OldCurmudgeon method is synchronized
type: AnswerComment

http://stackoverflow.com/a/22725474
answers question: http://stackoverflow.com/q/22725428
upvote count: 0
has body: You need to change int pi = 3.14; to double pi = 3.14; Also, static method is in wrong place.
has comment: http://stackoverflow.com/comment/34634440
type: Answer
downvote count: 1
score: -1

ssl
tags question: http://stackoverflow.com/q/22655661
tags question: http://stackoverflow.com/q/22778975
tags question: http://stackoverflow.com/q/22681899
tags question: http://stackoverflow.com/q/22712438
tags question: http://stackoverflow.com/q/22707924
type: Tag
tags question: http://stackoverflow.com/q/22703706
tags question: http://stackoverflow.com/q/22722085
tags question: http://stackoverflow.com/q/22737970
tags question: http://stackoverflow.com/q/22709897
tags question: http://stackoverflow.com/q/22724862
tags question: http://stackoverflow.com/q/22804441
tag name: ssl
tags question: http://stackoverflow.com/q/22730117
tags question: http://stackoverflow.com/q/22702941
tags question: http://stackoverflow.com/q/22713137
tags question: http://stackoverflow.com/q/22760124
tags question: http://stackoverflow.com/q/22784589
tags question: http://stackoverflow.com/q/22691658
tags question: http://stackoverflow.com/q/22775311
tags question: http://stackoverflow.com/q/22665723
tags question: http://stackoverflow.com/q/22707635

http://stackoverflow.com/comment/34671132
has text: Providing code snaps will better explain the probkem
type: QuestionComment
comment on: http://stackoverflow.com/q/22746617
score: 0
type: Comment

http://stackoverflow.com/comment/34575603
score: 0
type: QuestionComment
type: Comment
has text: I think i deleted the imports for fragment while editing by mistake. DO check whether the imports are from support library or not coz that could also cause problems
comment on: http://stackoverflow.com/q/22693444

http://stackoverflow.com/comment/34527294
comment on: http://stackoverflow.com/q/22665948
score: 0
type: Comment
type: QuestionComment
has text: That hasn't really answered my question. It *suggests* that it's `ps2.execute()` that's throwing the exception, but you should be clearer about that - and remove anything unnecessary from your question.

http://stackoverflow.com/a/22755669
type: Answer
answers question: http://stackoverflow.com/q/22755655
score: 3
upvote count: 3
has comment: http://stackoverflow.com/comment/34688006
downvote count: 0
has comment: http://stackoverflow.com/comment/34687952
accepted answer of: http://stackoverflow.com/q/22755655
type: AcceptedAnswer
has body: You could look into using Serializable and saving the objects to files locally. Here is oracle's tutorial on serialization using this method: Oracle tutorial link

http://stackoverflow.com/q/22787203
has comment: http://stackoverflow.com/comment/34744929
type: Question
has comment: http://stackoverflow.com/comment/34744600
has answer: http://stackoverflow.com/a/22788533
has body: my goal is to randomly shuffle an array, (from 0 to 9) but every number has to appear in the array only once. I have got two (working) ideas, but I would like to find out how many times must this random2 method iterate to achieve the same level of randomness in array as in the first method (random1). import java.util.Random; class RandomStuff { static Random r; final static int iteraction = 10; public static void main (String[] args) { r = new Random(); int[] array = new int[10]; random1(array); random2(array, iteraction); } static void random1(int[] array) { for(int i = 0; i &lt; array.length; i++) pole[i] = -1; for(int i = 0; i &lt; array.length; i++) { while(true) { int y = r.nextInt(10); if(!find(array, y)) { array[i] = y; break; } } } } static void random2(int[] array, int iteraction) { for(int i = 0; i &lt;= iteraction; i++) { int y1 = r.nextInt(array.length); int y2 = r.nextInt(array.length); int p = array[y1]; array[y1] = array[y2]; array[y2] = p; } } static boolean find(int[] array , int value) { for(int i = 0; i &lt; array.length; i++) { if(pole[i] == value) return true; } return false; } } The first method (random1) works assigning of random numbers and testing, if they are/aren't in the array already. Which seems to be pretty random to me. The second method (random2) works on swaping two random random values in the array. So the question is, how many times do I have to swap two numbers in the array to achieve the same level of randomness. (or what value shoud the variable iteraction have). Thanks for any reply.
has comment: http://stackoverflow.com/comment/34744797
tagged with: math
tagged with: arrays
has title: Level of randomness
answer count: 2
tagged with: random
downvote count: 0
accepted answer: http://stackoverflow.com/a/22788533
favorite count: 0
linked to: http://stackoverflow.com/q/1519736
possible better answer: http://stackoverflow.com/a/22787611
has answer: http://stackoverflow.com/a/22787611
has comment: http://stackoverflow.com/comment/34744876
has comment: http://stackoverflow.com/comment/34744677
type: AnsweredQuestion
score: 1
tagged with: java
upvote count: 1
has comment: http://stackoverflow.com/comment/34744499

http://stackoverflow.com/a/22712695
upvote count: 2
downvote count: 0
has comment: http://stackoverflow.com/comment/34610585
answers question: http://stackoverflow.com/q/22711441
type: Answer
score: 2
has body: Apparently there was a very funky character being put into your string.. as I was using my &lt;- and -> arrow keys, it was getting caught for three characters at the end, and in the middle of the string. Seems to be some copy-pasta issue. I fixed it just be putting it one one line, however I would still recommend going with @lost's answer as it's more explicit. @Config(url="https://rawgithub.com/ddavison/so-tests/master/22711441.html", browser= Browser.CHROME) public class _22711441 extends AutomationTest { @Test public void test() { ((JavascriptExecutor) driver).executeScript( // the issue was happening \/ here and \/ here "var inputs = document.getElementsByTagName('input');for(var i = 0; i &lt; inputs.length; i++){inputs[i].removeAttribute('readonly','readonly');}" ); setText(By.id("1"), "something") .validateText(By.id("1"), "something"); } } See the script here and the page i used to test here

http://stackoverflow.com/a/22723579
type: Answer
score: 2
downvote count: 0
has comment: http://stackoverflow.com/comment/34659406
has comment: http://stackoverflow.com/comment/34641285
upvote count: 2
accepted answer of: http://stackoverflow.com/q/22721666
type: AcceptedAnswer
answers question: http://stackoverflow.com/q/22721666
has body: You can do it using the Dialog.* macro functions. See the DialogDemo macro for an example.

http://stackoverflow.com/a/22765162
score: 0
type: Answer
has body: It is not possible to apply an operation to all values in a collection in less than O(n) time, however if your objection is truly with iteration itself, there are some possible alternatives, notably functional programming. This is made most easy by the Guava library (or natively in Java 8), and their functional programming utilities. Their Maps.transformValues() provides a view of the map, with the provided function applied. This means that the function returns in O(1) time, unlike your iteration, but that the computation is done on the fly whenever you .get() from the returned map. This is obviously a tradeoff - if you only need to .get() certain elements from the transformed map, you save time by avoiding computing unnecessary values. On the other hand, if you know you'll later hit every element at least once, using this behavior means you'll actually waste time. In essence, this approach is O(k) where k is the number of lookups you plan to do. If k is always less than n, then using the transformation approach is optimal. Read carefully however the caveat at the top of the page; iteration is a simple, easy, and generally ideally efficient way to work with the members of a map. You should only try to optimize past that when absolutely necessary.
answers question: http://stackoverflow.com/q/22764871

http://stackoverflow.com/comment/34501153
has text: @MadProgrammer Thats probably next option, but then I'm not sure how the thirdparty application is exiting from it's main class as i don't have the visibility to it.
comment on: http://stackoverflow.com/q/22651402
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/q/22725051
score: 0
tagged with: wsdl
answer count: 1
has body: I'm trying to generate a Java Service Class in Mule from this WSDL using the SOAP component's Import WSDL and generate JAX-WS classes feature: https://www.tracegains.net/api/scsi.asmx?WSDL But I'm getting an undefined element declaration 's:schema' at line xx column yy of schema (error repeated quite a few times). So, based on this answer: Error when using Jax to generate Proxy web service client I saved the WSDL file locally and changed the reference from http://www.w3.org/2001/XMLSchema to http://www.w3.org/2001/XMLSchema.xsd Now I'm getting a Part &lt;parameters&gt; in Message &lt;{http://www.tracegains.net/Services}GetAttributesByIngredientSoapOut&gt; referenced Type &lt;{http://www.tracegains.net/Services}GetAttributesByIngredientResponse&gt; can not be found in the schemas. I also tried the wsimport tool from Apache CXF 3.0.0 but I'm getting similar results there: [ERROR] Schema descriptor {http://www.tracegains.net/Services}Version in message part "parameters" is not defined and could not be bound to Java. Perhaps the schema descriptor {http://www.tracegains.net/Services}Version is not defined in the schema imported/included in the WSDL. You can either add such imports/includes or run wsimport and provide the schema location using -b switch. line 774 of file:/D:/tg/tg_modified.wsdl It appears to me that the import is failing on the tns namespace, but when I try to browse the tns namespace uri I'm getting a 404: http://www.tracegains.net/Services Is this the problem or is there something else I can do to get this to work?
type: UnansweredQuestion
tagged with: web-services
has answer: http://stackoverflow.com/a/22725440
tagged with: java
tagged with: wsimport
has title: Referenced type can not be found while trying to import WSDL
type: Question
tagged with: mule
linked to: http://stackoverflow.com/q/6209583

http://stackoverflow.com/a/22661927
has body: For huge files, try command line tools. They often work much more efficient. In your case, try xmllint with the option --format or XMLStarlet with fo (docs). Alternatively, give Eclipse a lot of memory (1-1.5GB) and be more patient. The XML editor in Eclipse is pretty slow for huge documents.
downvote count: 0
score: 2
upvote count: 2
answers question: http://stackoverflow.com/q/22661624
type: Answer

http://stackoverflow.com/comment/34901424
type: AnswerComment
type: Comment
has text: I removed the hibernate 3 deps and the FilterDefinition error is not there any more, but the no session bound to thread is. Here is the pastebin http://pastebin.com/6phKahat
comment on: http://stackoverflow.com/a/22872120
score: 0

http://stackoverflow.com/q/22698488
tagged with: swingx
tagged with: jtable
tagged with: jxtable
has body: I have a jxtable. It has horizontalGridLines enabled. here is what it looks like. I want the horizontal gridline to be thicker. See the desired look below. The line after the 2nd row should have a thicker divider.
has answer: http://stackoverflow.com/a/22708642
has title: jxtable with on gridline that is thicker
favorite count: 0
possible better answer: http://stackoverflow.com/a/22708642
has answer: http://stackoverflow.com/a/22700647
upvote count: 3
tagged with: swing
type: AnsweredQuestion
score: 3
tagged with: java
accepted answer: http://stackoverflow.com/a/22700647
type: Question
answer count: 2
downvote count: 0

http://stackoverflow.com/q/22762091
answer count: 1
has comment: http://stackoverflow.com/comment/34700334
tagged with: aem
upvote count: 1
has answer: http://stackoverflow.com/a/22762988
has body: I am novice in CQ5. I have installed publisher and author instances. How can I check that my author connects with my publisher?
has comment: http://stackoverflow.com/comment/34700594
type: AnsweredQuestion
tagged with: java
has title: cq5. How to show list publishers for author? version 5.5
downvote count: 1
type: Question
has comment: http://stackoverflow.com/comment/34700243
accepted answer: http://stackoverflow.com/a/22762988
has comment: http://stackoverflow.com/comment/34700022
has comment: http://stackoverflow.com/comment/34700276
favorite count: 0
score: 0

http://stackoverflow.com/comment/34546704
score: 0
has text: @JustinBushy no analyze what Hot Licks just said, think about how recursion acts like a stack (first called last out)
comment on: http://stackoverflow.com/q/22677123
type: QuestionComment
type: Comment

http://stackoverflow.com/comment/34634354
type: Comment
score: 1
comment on: http://stackoverflow.com/a/22725565
type: AnswerComment
has text: @JasonC ok. but you left them in. The OP seems to be confused about the purpose of setter methods - what he wrote is a not a setter method. It makes the answer better IMO if you explain that.

communication
tag name: communication
tags question: http://stackoverflow.com/q/22704899
type: Tag

http://stackoverflow.com/comment/34682151
score: 0
comment on: http://stackoverflow.com/q/22752545
type: Comment
type: QuestionComment
has text: you have misplaced `}` in your code. You use a IDE so should be easy to fix

http://stackoverflow.com/comment/34642418
has text: @user3475390 alright check the Edit 2 that should fix NPE
comment on: http://stackoverflow.com/a/22729666
type: AnswerComment
score: 0
type: Comment

http://stackoverflow.com/comment/34723667
type: AnswerComment
score: 0
has text: I actually did this earlier and compared my code to the code in his example. I changed it around to fit my application, but it still doesn't seem to be working for me.
type: Comment
comment on: http://stackoverflow.com/a/22775376

http://stackoverflow.com/comment/34716099
type: Comment
type: QuestionComment
has text: you are just repeatedly pulling off the bottom set bit using a twos complement trick. this is only faster for sparse numbers
comment on: http://stackoverflow.com/q/22770709
score: 0

lucene
tags question: http://stackoverflow.com/q/22693197
tags question: http://stackoverflow.com/q/22721584
tags question: http://stackoverflow.com/q/22726954
tags question: http://stackoverflow.com/q/22713653
tags question: http://stackoverflow.com/q/22659523
tags question: http://stackoverflow.com/q/22719547
tags question: http://stackoverflow.com/q/22648993
tags question: http://stackoverflow.com/q/22744277
type: Tag
tags question: http://stackoverflow.com/q/22681798
tag name: lucene
tags question: http://stackoverflow.com/q/22804169
tags question: http://stackoverflow.com/q/22792505

http://stackoverflow.com/comment/34759720
type: Comment
has text: ExecutorService is probably the best approach to execute two tasks in parallel. It also supports _Runnable_. However, _Callable_ has the advantage to also support arbitrary exceptions.
score: 14
type: AnswerComment
comment on: http://stackoverflow.com/a/22795648

http://stackoverflow.com/comment/34758254
comment on: http://stackoverflow.com/a/22794195
type: AnswerComment
score: 0
type: Comment
has text: http://www.tatirandotruta.net/share/tmp/Screenshot-1.png and http://www.tatirandotruta.net/share/tmp/Screenshot.png

http://stackoverflow.com/comment/34738618
comment on: http://stackoverflow.com/q/22782493
type: Comment
score: 0
has text: @ambarox What do you mean seperate mapping?
type: QuestionComment

http://stackoverflow.com/comment/34693129
type: Comment
has text: @peeskillet can you take look at that
comment on: http://stackoverflow.com/q/22735446
score: 0
type: QuestionComment

jdialog
tags question: http://stackoverflow.com/q/22690094
type: Tag
tags question: http://stackoverflow.com/q/22667099
tags question: http://stackoverflow.com/q/22783818
tag name: jdialog
tags question: http://stackoverflow.com/q/22668701
tags question: http://stackoverflow.com/q/22788387
tags question: http://stackoverflow.com/q/22714896

oncreate
tags question: http://stackoverflow.com/q/22656915
type: Tag
tag name: oncreate

http://stackoverflow.com/comment/34592487
comment on: http://stackoverflow.com/a/22702322
type: Comment
score: 1
type: AnswerComment
has text: There are at least two ways to achieve it. The first is store each shape you generate in some kind of `List` and iterate this list each time the `paintComponent` is called. This would require to store information about color and other properties along with the shape. The other is to use a `BufferedImage` as the primary canvas, paint to this directly and when `paintComponent` is called, paint the image to the `Graphics` context

http://stackoverflow.com/comment/34497675
type: QuestionComment
comment on: http://stackoverflow.com/q/22649500
type: Comment
score: 0
has text: its not outputting whether the numbers are palindrome or not @SotiriosDelimanolis

http://stackoverflow.com/a/22668473
score: 3
accepted answer of: http://stackoverflow.com/q/22668342
answers question: http://stackoverflow.com/q/22668342
type: AcceptedAnswer
downvote count: 0
has body: There's some lovely mathematics to the effect that, unless you can prove that A &lt;= B and B &lt;= A using reflexivity and transitivity, there exists a model where A != B. The forced equality classes on variables correspond one-to-one with the strongly connected components of the graph of &lt;=-related variables (where A = B induces A &lt;= B and B &lt;= A). In total, the algorithm for determining feasibility is to extract all of the &lt;= constraints (where A &lt; B induces A &lt;= B, and A = B induces A &lt;= B and B &lt;= A, and A != B induces nothing), find strong components in the directed graph, then verify, for every A &lt; B and A != B, that A and B lie in different strong components. To query, add each possibility in turn and check feasibility.
type: Answer
upvote count: 3

http://stackoverflow.com/a/22731849
has body: You should import this class: import com.google.android.gms.maps.model.BitmapDescriptorFactory;
downvote count: 2
answers question: http://stackoverflow.com/q/22709676
type: Answer
upvote count: 0
score: -2

http://stackoverflow.com/comment/34625085
type: QuestionComment
comment on: http://stackoverflow.com/q/22720605
has text: _How can I equals two VALUES ?_ **using properly implemented `equals()` method**
score: 0
type: Comment

http://stackoverflow.com/comment/34619616
type: QuestionComment
comment on: http://stackoverflow.com/q/22717619
score: 0
has text: @RobertScholte I need to download a JAR via Maven and execute it (The manifest contains a main class and the JAR has shaded dependencies).
type: Comment

tcp
type: Tag
tags question: http://stackoverflow.com/q/22678077
tags question: http://stackoverflow.com/q/22672103
tags question: http://stackoverflow.com/q/22797271
tags question: http://stackoverflow.com/q/22693878
tags question: http://stackoverflow.com/q/22764336
tags question: http://stackoverflow.com/q/22747728
tag name: tcp

http://stackoverflow.com/q/22775137
tagged with: angularjs
has comment: http://stackoverflow.com/comment/34723231
has answer: http://stackoverflow.com/a/22775512
type: UnansweredQuestion
tagged with: web-applications
has comment: http://stackoverflow.com/comment/34723074
type: Question
has comment: http://stackoverflow.com/comment/34723289
has comment: http://stackoverflow.com/comment/34723121
tagged with: java
score: 0
has comment: http://stackoverflow.com/comment/34723141
has title: What are some conventions to deal with deploying a web app under different root directories?
has comment: http://stackoverflow.com/comment/34723200
answer count: 1
has body: I am developing a java/javascript web application with JSPs, servlets, JAX-RS, and AngularJS. I am pretty new to this kind of stuff. One problem I've been having is that I need to address url paths from static html, from javascript files, from jsps, and within servlets. I would like to be able to deploy this web app under different context roots (basically deploy in different folders). But in order to do this, unless I am mistaken, I must go through all the static files, (javascript and html) and change every link to properly reference resources based on new root directory. For the server side files, there are some java convenience methods like ServletContext's getContextPath() which allow me to avoid this. Are there any conventions or strategies that people use to allow one to easily move a web app to different directories on a site without breaking all the links? At the moment I am guessing you must do search and replace for all the links. Maybe put a special tag next to all local links so you know to change it? Cheers,

http://stackoverflow.com/a/22733831
has comment: http://stackoverflow.com/comment/34652675
has body: It will be 362 by 384, instead of 400 by 400 Because the size of the frame include the title bar and borders. Don't use the setSize() method. Instead override the getPreferredSize() method of your custom panel to return the size that you want the panel to be. Then you use: frame.pack(); Then the size of the frame will be the preferred size of your panel, plus the size of the title bar and borders.
upvote count: 6
type: AcceptedAnswer
downvote count: 0
type: Answer
has comment: http://stackoverflow.com/comment/34653704
accepted answer of: http://stackoverflow.com/q/22733796
answers question: http://stackoverflow.com/q/22733796
score: 6

http://stackoverflow.com/q/22793105
has answer: http://stackoverflow.com/a/22793151
possible better answer: http://stackoverflow.com/a/22793149
has answer: http://stackoverflow.com/a/22793149
tagged with: java
has body: I have a map from type Map&lt;Character, Integer&gt; tmp; and at some point in my code, I do the following: if(tmp.containsKey(key)) tmp.put(key, tmp.get(key)+1) In the second line, I would prefer to just do something like tmp.get(key)++; which I expected to work, since I should get a reference to the Integer Object from the get-call. But it doesn't, and Integer doesn't seem to have an update function apart from the int-syntax. Is there no way around the first construct?
accepted answer: http://stackoverflow.com/a/22793174
answer count: 4
score: 2
type: AnsweredQuestion
downvote count: 0
favorite count: 0
type: Question
tagged with: dictionary
tagged with: integer
has title: How to increment an Integer-lvalue
has answer: http://stackoverflow.com/a/22793229
upvote count: 2
has answer: http://stackoverflow.com/a/22793174

http://stackoverflow.com/q/22699372
has comment: http://stackoverflow.com/comment/34589980
accepted answer: http://stackoverflow.com/a/22699540
favorite count: 0
has comment: http://stackoverflow.com/comment/34586886
has body: I have problem with conversion of C++ integer to Java int. In c++: //while loop int *bla = new int; *bla = counter; //counter starting from 0 counter++; if ((size = send(client, bla, 4, 0)) == -1) //sizeof(int) show 4 bytes so I put it there directly { cerr &lt;&lt; "Error." &lt;&lt; endl; return -1; } In Java: //while loop //DataInputStream inFromServer; System.out.println(inFromServer.readInt()); //it should read 4 bytes and interpret it as int Result from Java: 0 //for 0 16777216 //for 1 33554432 //for 2 50331648 //etc. 67108864 83886080 100663296 117440512 134217728 150994944 167772160 184549376 201326592 218103808 234881024 251658240 (I'm using g++) EDIT: Both (java and c++ app) runs on the same Raspberry Pi with Raspian OS (so it's localhost)
upvote count: 2
linked to: http://stackoverflow.com/q/13211770
linked to: http://stackoverflow.com/q/13926760
possible better answer: http://stackoverflow.com/a/22699554
linked to: http://stackoverflow.com/q/6534190
linked to: http://stackoverflow.com/q/9385542
has title: Incorrect conversion from C++ integer to Java integer
has answer: http://stackoverflow.com/a/22699554
tagged with: c++
type: AnsweredQuestion
tagged with: java
downvote count: 3
type: Question
has answer: http://stackoverflow.com/a/22699540
answer count: 2
has comment: http://stackoverflow.com/comment/34636698
score: -1
tagged with: type-conversion

http://stackoverflow.com/comment/34616706
comment on: http://stackoverflow.com/a/22708578
has text: In my understanding, JButton is a built-in class. Is there a “a" member in JButton? This ActionListener is a left-single-click handler for a button titled "Load", I just want to know which part of code does the button click event trigger, so I thought this.b.a.q() should have nothing to do with the UI?
score: 0
type: AnswerComment
type: Comment

http://stackoverflow.com/comment/34577684
type: QuestionComment
comment on: http://stackoverflow.com/q/22694628
has text: Ref. [List.remove](http://docs.oracle.com/javase/7/docs/api/java/util/List.html#remove(java.lang.Object))
score: 0
type: Comment

http://stackoverflow.com/comment/34499787
has text: Provide a DTO and retrieve the `watchUsers` field.
score: 0
type: QuestionComment
comment on: http://stackoverflow.com/q/22649309
type: Comment

http://stackoverflow.com/a/22686797
has comment: http://stackoverflow.com/comment/34563399
score: 1
has comment: http://stackoverflow.com/comment/34563942
upvote count: 1
has comment: http://stackoverflow.com/comment/34564159
has comment: http://stackoverflow.com/comment/34563057
answers question: http://stackoverflow.com/q/22686460
has comment: http://stackoverflow.com/comment/34563022
downvote count: 0
has comment: http://stackoverflow.com/comment/34563615
has body: You are missing the commons-fileupload.jar in the classpath. Please add this jar to your build path of the project and package the .war along with it and deploy! Note : This link will help you download it
has comment: http://stackoverflow.com/comment/34563959
has comment: http://stackoverflow.com/comment/34563507
type: Answer

http://stackoverflow.com/comment/37356265
type: Comment
has text: Jar file does not contain SqlMapConfig in jar. How to fix it?
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/22684172

http://stackoverflow.com/comment/64231554
has text: This will prevent a user from typing anything at all. The only way this works is that the user pastes the value in an EditText.
type: AnswerComment
score: 0
type: Comment
comment on: http://stackoverflow.com/a/24631869

http://stackoverflow.com/comment/34626996
type: Comment
comment on: http://stackoverflow.com/a/22721550
score: 0
type: AnswerComment
has text: How do iterate the list and String value would be list object instead of string?

http://stackoverflow.com/q/22750338
tagged with: 3d
tagged with: netlogo
has body: I would like to try to make a web application out of my NetLogo3D simulation. Since NetLogo3D 5.0.5 doesn't (yet) support making applets, I had the idea to use directly the API and output screenshots out of the simulation by using the "export-view" command. Here is my code so far: import org.nlogo.headless.HeadlessWorkspace; public class main { public static void main(String[] argv) { System.setProperty("org.nlogo.is3d", "true"); HeadlessWorkspace workspace = HeadlessWorkspace.newInstance() ; try { System.out.println("Working Directory = " + System.getProperty("user.dir")); workspace.open("MyProject.nlogo3d"); workspace.command("setup"); workspace.command("repeat 50 [ go ]") ; workspace.command("export-view \"screenshot.jpg\"") ; workspace.dispose(); } catch(Exception ex) { ex.printStackTrace(); } } } The simulation is working nicely, agents are moving for 50 ticks then a screenshot is outputted. The problem is that the screenshot does not capture all the elements: all patches are invisible (even the ones that are normally colored) and agents are draw in 2D shapes (even if they should have a specific 3D shape like "car"). Export-view works nicely from the NetLogo3D GUI, so I can't see why it should not using the API. Is there something more I can do or is this command just not fully implemented in the Headless API yet?
has answer: http://stackoverflow.com/a/22752334
upvote count: 1
answer count: 1
favorite count: 0
has title: Export-view in NetLogo3D using Headless API
type: AnsweredQuestion
downvote count: 0
score: 1
tagged with: java
type: Question
accepted answer: http://stackoverflow.com/a/22752334

http://stackoverflow.com/comment/63359873
type: Comment
has text: I was facing the same issue but it was already on 8.0. The comment from @user1516873 helped me solve the issue
type: AnswerComment
score: 0
comment on: http://stackoverflow.com/a/22704620

http://stackoverflow.com/q/22718522
has comment: http://stackoverflow.com/comment/34621115
has comment: http://stackoverflow.com/comment/34621826
answer count: 5
has answer: http://stackoverflow.com/a/22718615
tagged with: equals
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/22718618
has comment: http://stackoverflow.com/comment/34621121
has body: public class Person{ private String name; public Person(String name) { this.name = name; } public boolean equals (Person p){ return p.name.equals(this.name); } } The equals method does not properly override the object.equals method. Why?
has answer: http://stackoverflow.com/a/22718627
has title: Why doesn't this equals method properly override the object.equals method?
tagged with: java
type: Question
has answer: http://stackoverflow.com/a/22718637
score: 0
has answer: http://stackoverflow.com/a/22718811

http://stackoverflow.com/comment/34507558
type: AnswerComment
score: 0
type: Comment
has text: You should know that java has no 0-termination of Strings
comment on: http://stackoverflow.com/a/22655239

http://stackoverflow.com/comment/34634313
type: Comment
comment on: http://stackoverflow.com/q/22725499
score: 0
type: QuestionComment
has text: you are not calling the setter for other fields that is why they are zero

http://stackoverflow.com/comment/34582450
has text: @Pshemo i downloaded the SDK ADT bundle for mac from the android developer website. Whatever came with that, i have. I dont think it comes with the JDK, but I could be wrong
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/22696463
score: 0

http://stackoverflow.com/comment/34697530
type: AnswerComment
comment on: http://stackoverflow.com/a/22743448
has text: adding coalesce(500, true) before cache() helped. Seems like GC problem is solved.
type: Comment
score: 1

http://stackoverflow.com/a/22773370
upvote count: 5
downvote count: 0
answers question: http://stackoverflow.com/q/22773300
type: Answer
has body: You forgot to pass any params to your AsyncTask here: new NetworkTask().execute(); That is why your array is empty here: String link = params[0]; ==> pass a parameter while executing the AsyncTask: new NetworkTask().execute(someLink); //execute AsyncTask with one param Update: in fact seems like you don't do anything with String link in the doInBackground method. So maybe you can just get rid of that line?
score: 5

http://stackoverflow.com/comment/34572484
comment on: http://stackoverflow.com/a/22691532
type: AnswerComment
score: 0
has text: Exactly! My task, as name suggests, just checks if a connection is up by opening a socket with a certain timeout. This has to be done every x seconds after the previous attempt had place.
type: Comment

http://stackoverflow.com/comment/34717603
comment on: http://stackoverflow.com/a/22771744
has text: Never mind you were right I forgot to import java.awt.* Thanks :)
score: 0
type: AnswerComment
type: Comment

http://stackoverflow.com/q/22750007
has comment: http://stackoverflow.com/comment/34677606
has answer: http://stackoverflow.com/a/22750079
tagged with: java
downvote count: 2
has comment: http://stackoverflow.com/comment/34677596
has body: I'm new to java, and having trouble using Strings and Character assignment, when they intertwined. Here the Caesar program doesn't run because the assignment between Character and String have to be compared. Please help thank you. class Caesar { public static char encrypt(String str) { String result = ""; String x; for (String ch : str) { x = plainalphabet.indexOf(ch); if (x != -1) { result = result + cipheralphabet.charAt(x); } else { result = result + ch; } } return result; } public static void main(String args[]) { String plainalphabet = "abcdefghijklmnopqrstuvwxyz"; String cipheralphabet = "defghijklmnopqrstuvwxyzabc"; System.out.println(encrypt("James")); } }
possible better answer: http://stackoverflow.com/a/22750050
has title: Java Encrypting a Caesar code
has answer: http://stackoverflow.com/a/22750050
accepted answer: http://stackoverflow.com/a/22750079
has comment: http://stackoverflow.com/comment/34677586
type: AnsweredQuestion
upvote count: 0
favorite count: 0
type: Question
answer count: 2
score: -2

http://stackoverflow.com/q/22736634
has answer: http://stackoverflow.com/a/22736714
upvote count: 1
has body: How should i implement an MVC controller with multiple JButtons on the view? for example: i have a start button, stop button and many others as well. I tried to do this for the start button and it works fine but then how do i implement it for a stop button trigger? Controller Code: public MVCAuctionController(Auction a, MVCAuctionView v) { auction = a; view = v; view.addProcessBidsListener(new ProcessBidsController()); view.addStopProcessListener(new StopBidsController()); } class ProcessBidsController implements ActionListener { public void actionPerformed(ActionEvent e) { view.disableProcessButton(); Thread thread = new Thread (auction); thread.start(); } } addProcessBidsListener - is associated with the START/Process button,When i click on the button - the thread starts running and fills the JTextArea with data. Now my Stop button should stop the thread. For this if i do something like this it doesnt actually stop the Thread: class ProcessStartController implements ActionListener { public void actionPerformed(ActionEvent e) { if(e.getSource() == view.start){ view.disableStartButton(); new Thread (rest).start(); //thread.start(); System.out.println("inside action performed of start button"); view.kitchen.append("Orders to kitchen"); } else if (e.getSource() == view.stop) { new Thread (rest).interrupt(); } } }
tagged with: design-patterns
has comment: http://stackoverflow.com/comment/34653494
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/22736714
score: 1
tagged with: java
has comment: http://stackoverflow.com/comment/34653627
type: Question
answer count: 1
downvote count: 0
favorite count: 0
tagged with: model-view-controller
has title: MVC pattern for multiple JButtons

http://stackoverflow.com/a/22670916
has body: Use ArrayList.set(index,Object) method instead of add to replace value at an index as follows: students.set(i,temp2);
score: 0
type: Answer
answers question: http://stackoverflow.com/q/22670740

http://stackoverflow.com/a/22710927
has body: You can Try Eclipse(https://www.eclipse.org/) or IntelliJ IDEA comminity Edition (http://www.jetbrains.com/idea/)
type: Answer
answers question: http://stackoverflow.com/q/22710823
score: 0

http://stackoverflow.com/comment/34674505
score: 0
has text: *I have created a Bayes Classifier [...] I don't know much about the E scientific notification* `o_O` Kidding aside...what do you exactly want? To print the numbers with fewer digits?
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/22748315

http://stackoverflow.com/comment/34695936
comment on: http://stackoverflow.com/q/22759404
score: 0
type: Comment
has text: Um, an array would work.
type: QuestionComment

http://stackoverflow.com/a/22678874
score: 1
upvote count: 1
has body: Copy log files stored in an Amazon S3 bucket into HDFS. Here --srcPattern option is used to limit the data copied to the daemon logs. Linux, UNIX, and Mac OS X users: ./elastic-mapreduce --jobflow j-3GY8JC4179IOJ --jar \ /home/hadoop/lib/emr-s3distcp-1.0.jar \ --args '--src,s3://myawsbucket/logs/j-3GY8JC4179IOJ/node/,\ --dest,hdfs:///output,\ --srcPattern,.*daemons.*-hadoop-.*' Windows users: ruby elastic-mapreduce --jobflow j-3GY8JC4179IOJ --jar /home/hadoop/lib/emr-s3distcp-1.0.jar --args '--src,s3://myawsbucket/logs/j-3GY8JC4179IOJ/node/,--dest,hdfs:///output,--srcPattern,.*daemons.*-hadoop-.*' Please check this link for more : http://docs.aws.amazon.com/ElasticMapReduce/latest/DeveloperGuide/UsingEMR_s3distcp.html Hope this helps!
downvote count: 0
answers question: http://stackoverflow.com/q/22678748
type: Answer

http://stackoverflow.com/a/22731657
has comment: http://stackoverflow.com/comment/34661260
has body: json file: { "file": "phrases", "use": "quotes", "famous_phrases": [ { "phrase1": "one for all", "phrase2": "all for one", "id": 1 }, { "phrase1": "four scores", "phrase2": "and seven years ago", "id": 17 }, { "phrase1": "elementary", "phrase2": "my dear watson", "id": 22 } ] } Beans: public class Quotes { private String file; private String use; private List&lt;Phrases&gt; famous_phrases; public String getFile() { return file; } public void setFile(String file) { this.file = file; } public String getUse() { return use; } public void setUse(String use) { this.use = use; } public List&lt;Phrases&gt; getFamous_phrases() { return famous_phrases; } public void setFamous_phrases(List&lt;Phrases&gt; famous_phrases) { this.famous_phrases = famous_phrases; } } public class Phrases { private String phrase1; private String phrase2; private String id; public String getPhrase1() { return phrase1; } public void setPhrase1(String phrase1) { this.phrase1 = phrase1; } public String getPhrase2() { return phrase2; } public void setPhrase2(String phrase2) { this.phrase2 = phrase2; } public String getId() { return id; } public void setId(String id) { this.id = id; } } read json file: BufferedReader fileReader = new BufferedReader(new FileReader("./test.json")); ObjectMapper mapper = new ObjectMapper(); Quotes quotes = mapper.readValue(fileReader, Quotes.class); for (Phrases element : quotes.getFamous_phrases()) { System.out.println(element.getPhrase1()); }
type: AcceptedAnswer
downvote count: 0
answers question: http://stackoverflow.com/q/22728460
type: Answer
accepted answer of: http://stackoverflow.com/q/22728460
score: 2
upvote count: 2

http://stackoverflow.com/comment/75835835
type: Comment
score: 13
has text: I like the initial approach in this answer. For customization purposes, it is possible to convert the last `get()` to `orElseThrow()`
comment on: http://stackoverflow.com/a/34663949
type: AnswerComment

http://stackoverflow.com/a/22792109
answers question: http://stackoverflow.com/q/22791931
score: 1
upvote count: 1
has body: Use a Swing Timer to animate your slide. For example, this link has code that places the components in a JLayeredPane and slides one component over the other, again using a Swing Timer: slide effect with JPanel. Another useful effect is to fade out from one JPanel to another. For an example of this that uses a Swing Timer as well as a CardLayout, please check out this answer.
type: AcceptedAnswer
downvote count: 0
type: Answer
accepted answer of: http://stackoverflow.com/q/22791931

http://stackoverflow.com/comment/34700216
has text: may be you should add ... ul li a? Otherwise the get text will try to get the text from li not a
comment on: http://stackoverflow.com/q/22762401
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/34665054
type: Comment
has text: You're going to need to maintain some state somewhere. That means track if you're currently in an if block. A boolean would work fine. Also, don't assume you won't have multiple if statements on a single line
type: QuestionComment
comment on: http://stackoverflow.com/q/22743247
score: 0

http://stackoverflow.com/comment/34538701
score: 0
comment on: http://stackoverflow.com/q/22648933
type: Comment
type: QuestionComment
has text: My other workaround is writing the entire url for each item to the option value, but that seems like a ton more code to be generated dynamically each time. I use %20 on static links on my site so it would be ideal to not use the combination of + from HTTP URI requests with GET in addition to %20.

http://stackoverflow.com/q/22720953
tagged with: android-layout
has answer: http://stackoverflow.com/a/22721458
score: 1
tagged with: java
tagged with: android-linearlayout
has comment: http://stackoverflow.com/comment/34626437
type: Question
answer count: 1
downvote count: 0
tagged with: android-tablelayout
has title: TableLayout row and column in android with java
tagged with: android
has body: I designed a dynamic table in android with java. The table has 3 columns but the last column displays data out/off the screen which is not visible in the screen but are there. How can I make the data of the third column to continue display below it and make all data be visible to users?? This is the java codes iv used to achieve that: LinearLayout main_layout = (LinearLayout) findViewById(R.id.main_layout); TableLayout table_service = new TableLayout(this); table_service.setLayoutParams(new LinearLayout.LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.MATCH_PARENT)); for(ServiceArray s : arr_service){ TableRow tr_item = new TableRow(this); tr_item.setLayoutParams(new TableLayout.LayoutParams( LayoutParams.MATCH_PARENT, LayoutParams.MATCH_PARENT )); TextView date = new TextView(this); date.setText(s.getDateOfService()); date.setTextColor(Color.WHITE); date.setLayoutParams(new TableRow.LayoutParams( LayoutParams.FILL_PARENT, LayoutParams.MATCH_PARENT )); date.setBackgroundColor(Color.RED); TextView mileage = new TextView(this); mileage.setText(s.getMileage()); mileage.setTextColor(Color.WHITE); mileage.setLayoutParams(new TableRow.LayoutParams( LayoutParams.FILL_PARENT, LayoutParams.MATCH_PARENT )); mileage.setBackgroundColor(Color.BLUE); TextView description = new TextView(this); description.setText(s.getDescription()); description.setTextColor(Color.WHITE); description.setLayoutParams(new TableRow.LayoutParams( LayoutParams.FILL_PARENT, LayoutParams.MATCH_PARENT )); description.setBackgroundColor(Color.GREEN); tr_item.addView(date); tr_item.addView(mileage); tr_item.addView(description); table_service.addView(tr_item); } main_layout.addView(table_service); setContentView(main_layout); xml is here: &lt;LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools" android:id="@+id/main_layout" android:layout_width="fill_parent" android:layout_height="fill_parent" android:orientation="vertical" tools:context=…
favorite count: 0
type: UnansweredQuestion
upvote count: 1
has comment: http://stackoverflow.com/comment/34626186

http://stackoverflow.com/comment/35034721
score: 0
type: Comment
has text: That picture is unrelated to the code I need. It just shows what I mean by "behind the window." What I meant was that I want the effect from [this answer](http://stackoverflow.com/questions/22622034/frosted-glass-effect-in-javafx/22630754#22630754) to be applied to whatever's behind the Java Window.
comment on: http://stackoverflow.com/a/22947712
type: AnswerComment

http://stackoverflow.com/a/22741127
has comment: http://stackoverflow.com/comment/34680201
upvote count: 1
score: 1
has comment: http://stackoverflow.com/comment/34687762
downvote count: 0
has body: I guess you have a few problems here: Your MetadataType does not have the @XmlRootElement. So JAXB does not know which element is supposed to match it. You want to unmarshal partially, but you're unmarshalling (I guess) the whole document. What you could try: Try unmarshalling a specific class from the specific node using the unmarshal(node, class) method From your stack trace, you try to unmarshal gpx:gpx element, not the metadata element. You have to go deeper You have to overtake package-info.java as well (or provide namespaces in your MetadataType, otheriwse you're missing namespaces See this answer about partial unmarshalling.
answers question: http://stackoverflow.com/q/22739343
has comment: http://stackoverflow.com/comment/34803048
type: Answer
has comment: http://stackoverflow.com/comment/117299494

http://stackoverflow.com/q/22777880
has comment: http://stackoverflow.com/comment/34727732
has comment: http://stackoverflow.com/comment/34728533
type: Question
accepted answer: http://stackoverflow.com/a/22777944
tagged with: recursion
type: AnsweredQuestion
has title: Recursion with an Array
has comment: http://stackoverflow.com/comment/34727727
tagged with: java
has answer: http://stackoverflow.com/a/22778208
has comment: http://stackoverflow.com/comment/34727757
has comment: http://stackoverflow.com/comment/34727731
has comment: http://stackoverflow.com/comment/34727825
tagged with: arrays
possible better answer: http://stackoverflow.com/a/22777970
has body: I'm having a bit of trouble understanding the concept of recursion. I understand that it is basically a method that calls itself and turns a big problem into a bunch of smaller parts to solve it. What I'm having difficulty with is using recursion with an array. Here is an example in my book: //Precondition: x is an array of n integers public int recur(int[] x, int n) { int t; if(n == 1) return x[0]; else { t = recur(x, n-1); if(x[n-1] &gt; t) return x[n-1]; else return t; } } If anyone has the time, could you explain what this method does and how it works? Greatly appreciated!
score: 0
has answer: http://stackoverflow.com/a/22777970
answer count: 4
has answer: http://stackoverflow.com/a/22777944
has answer: http://stackoverflow.com/a/22778321

http://stackoverflow.com/q/22674859
linked to: http://stackoverflow.com/q/9014068
tagged with: jframe
has title: How do I fill the whole Jframe?
tagged with: swing
type: AnsweredQuestion
tagged with: java
tagged with: jpanel
type: Question
has body: I am fairly new to GUIs in Java. What I want to know is, is there a way to take two JPanels and divide it up in the JFrame, ie. 70% for panel 1 and 30% for panel 2? Here is a snippet from where I create my GUI: import javax.swing.BoxLayout; import javax.swing.JFrame; import javax.swing.JButton; import javax.swing.JLabel; import javax.swing.JPanel; import java.awt.Color; import java.awt.GridLayout; public class ButtonGrid extends Game { private static JFrame frame = new JFrame(); private static JPanel panel1 = new JPanel(); private static JPanel panel2 = new JPanel(); private static JPanel panel3 = new JPanel(); private static JPanel panel4 = new JPanel(); private static JLabel lblP1 = new JLabel("Player 1: "); private static JLabel lblP2 = new JLabel("Player 2: "); private static JLabel P1Score = new JLabel("0"); private static JLabel P2Score = new JLabel("0"); public static JButton grid[][]; public ButtonGrid(int width, int length) { frame.setLayout(new GridLayout(width, length)); panel1.setLayout(new GridLayout(width, length)); panel2.setLayout(new BoxLayout(panel2, BoxLayout.Y_AXIS)); panel3.setLayout(new BoxLayout(panel3, BoxLayout.X_AXIS)); panel4.setLayout(new BoxLayout(panel4, BoxLayout.X_AXIS)); lblP1.setForeground(Color.blue); lblP2.setForeground(Color.red); grid = new JButton[width][length]; for(int x=0; x&lt;length; x++) { for(int y=0; y&lt;width; y++) { grid[x][y] = new JButton(); grid[x][y].addActionListener(actionListener); grid[x][y].setName("[" + x + ',' +y + "]"); //grid[x][y].setText(grid[x][y].getName()); //frame.add(grid[x][y]); panel1.add(grid[x][y]); } } grid[0][0].setBackground(Color.blue); grid[width-1][length-1].setBackground(Color.red); panel3.add(lblP1); panel3.add(P1Score); panel4.add(lblP2); panel4.add(P2Score); panel2.add(panel3); panel2.add(panel4); frame.add(panel2); frame.add(panel1); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); frame.setSize(800, 600); frame.setVisible(true); frame.setResizable(false); } What I would like i…
has answer: http://stackoverflow.com/a/22674919
tagged with: user-interface
answer count: 1
score: 0
has comment: http://stackoverflow.com/comment/34542991
accepted answer: http://stackoverflow.com/a/22674919
has comment: http://stackoverflow.com/comment/34542918

http://stackoverflow.com/a/22831429
type: Answer
score: 0
answers question: http://stackoverflow.com/q/22792793
has body: It seems that after Eclipse asked me if I want to change to UTF-8, it worked, only after I posted this. Sorry for wasting your time

http://stackoverflow.com/q/22795483
type: Question
downvote count: 0
answer count: 1
has body: My assignment deals with hashing and using Horner's polynomial to create a hash function. I have to computer the theoretical probe length using ( 1 + 1/(1-L)**2)/2 (Usuccessful) or (1+1/(1-L))/2 (successful) for Linear probing and then the same for the correct equations that correspond to quadratic probing. I then have to compare the theoretical values with experimental values for load factors 0.1 through 0.9. I am using the find method and searching for 100 random ints to acquire the experimental data. The problem that I am having is that I am not obtaining the correct probeLength value once the find either succeeds or fails. I create 10000 random ints to fill with and then 100 random ints that I will search for. for(i = 0; i&lt;10000; i++) { int x = (int)(java.lang.Math.random() * size); randomints.add(x); } //Make arraylist of 10000 random ints to fill for(p = 0; p&lt;100; p++) { int x = (int)(java.lang.Math.random() * size); randomintsfind.add(x); } Later on I have a loop that does the finding and keeps track of how many times the find succeeds or fails. That part of it is working. It is also supposed to keep track of the probeLength for each find and then add them all together so that it can be divided by the number of successes or failures respectively to find out what the average is. That is where I am having a problem. The probeLength isn't being retrieved correctly and I am not sure why. This is the section of code that calls the find method and keeps track of those variables as well as the creation and filling. HashTableLinear theHashTable = new HashTableLinear(primesize); for(int j=0; j&lt;randomintscopy.length; j++) // insert data { //aKey = (int)(java.lang.Math.random() * size); aDataItem = new DataItem(randomintscopy[j]); theHashTable.insert(aDataItem); } for(int f = 0; f &lt; randomintsfindcopy.length;f++) { aDataItem = theHashTable.find(randomintsfindcopy[f]); if(aDataItem != null) { linearsuccess += 1; experimentallinearsuccess += theHashTable.probe…
favorite count: 0
tagged with: hash
has answer: http://stackoverflow.com/a/22796302
accepted answer: http://stackoverflow.com/a/22796302
type: AnsweredQuestion
score: 1
tagged with: java
upvote count: 1
has title: Retrieving probe length for linear/quadratic hashing

http://stackoverflow.com/q/22742147
score: 0
has answer: http://stackoverflow.com/a/22742366
has body: I have been surfing on Internet for hours trying to find a good example to configure a Spring's repository by using the XML instead of annotations (@Repository). I found some good stuff (Hibernate 3): hibernateInterceptor But it seems that Hibernate 4 does not support HibernateInterceptor any longer. Have any of you experience with this issue? A good solution? There's no other option rather than using the annotation? Thanks in advance.
answer count: 1
has title: Configure a Repository on Spring via XML
tagged with: spring
type: UnansweredQuestion
type: Question
tagged with: java
tagged with: hibernate

http://stackoverflow.com/comment/34715370
score: 0
type: Comment
has text: I remember NB doing something similar. I didn't know that Eclipse does it too. You probably have some fancy plugin installed that tries to guess what you want.
type: QuestionComment
comment on: http://stackoverflow.com/q/22770261

http://stackoverflow.com/q/22649145
type: AnsweredQuestion
has title: How to make a "clickable" row in Android and highlight the row and texts in TextView
tagged with: java
has answer: http://stackoverflow.com/a/22649229
type: Question
score: 0
answer count: 1
tagged with: android
accepted answer: http://stackoverflow.com/a/22649229
has comment: http://stackoverflow.com/comment/34496934
has body: I've created a class called ClickableRow which highlights the row and changes the text color of all the TextViews inside of it, then returns the row to its initial settings after the user stops clicking or scrolls too far, but I feel like android probably already has a built in function for this. The main thing that I want to accomplish is to change all the TextViews in the row so that they are white when a click happens, and return to their previous color after a click or a scroll happens. I am sort-of accomplishing this, but for now I just have it turning the TextViews text to black afterwards. This isn't always the correct color, so is there a way to highlight text on a click and put it back to its default after? Thanks.
has comment: http://stackoverflow.com/comment/34496937

http://stackoverflow.com/comment/34571169
score: 0
type: Comment
has text: Okay. I realized that the two answers need to be combined, but this was the essential step. Thanks again Greg!
type: AnswerComment
comment on: http://stackoverflow.com/a/22660776

http://stackoverflow.com/q/22688459
type: Question
score: 0
has title: Send and recive message or notification in my app in different devices through my aap
has answer: http://stackoverflow.com/a/22688694
answer count: 1
has comment: http://stackoverflow.com/comment/34566011
type: UnansweredQuestion
has body: I want to make an app in android in which i send a message or notification and it will automatically send to all the users of my app or they will get notification like i want to say them your test will be tomorrow ... kindly tell me the code of sending and receiving the message or notification all the users of my app
tagged with: android
tagged with: java

http://stackoverflow.com/q/22648629
tagged with: design-patterns
has comment: http://stackoverflow.com/comment/34496363
tagged with: c++
score: 3
answer count: 0
upvote count: 3
tagged with: java
type: Question
tagged with: c#
has title: Which design patterns are made irrelevant after the introduction of new language features?
downvote count: 0
has body: As shown by Peter Norvig, some design patterns are "invisible" or far simpler in dynamic languages. http://www.norvig.com/design-patterns/design-patterns.pdf Moreover, there are language features that (to a high extend) replace them. http://www.c2.com/cgi/wiki?AreDesignPatternsMissingLanguageFeatures After the introduction of recent versions of Java (Java 8), C# (C# 3) and C++ (C++11), the commonly used OOP languages became (partially) functional languages. As explained in another post: https://stackoverflow.com/a/328146/1987258 "However, it's correct that most OOP-specific design patterns are pretty much irrelevant in functional languages." Therefore, I would like to know which OOP specific design patterns are now irrelevant for C++, C# and Java after the introduction of new language features. Then, it will be clear which design patterns we should keep on teaching to new developers.
tagged with: functional-programming
has comment: http://stackoverflow.com/comment/34497108
favorite count: 0
has comment: http://stackoverflow.com/comment/34496277
linked to: http://stackoverflow.com/q/327955
type: UnansweredQuestion

http://stackoverflow.com/q/22668212
has answer: http://stackoverflow.com/a/22668702
favorite count: 0
duplicate of: http://stackoverflow.com/q/218384
has comment: http://stackoverflow.com/comment/34530522
type: AnsweredQuestion
tagged with: linked-list
possible better answer: http://stackoverflow.com/a/22668314
tagged with: java
has body: I'm trying to implement linked Lists. I therefore have this first class, called List, which represents one element package list; /** * Linked list with int values. * * The empty list is represented by a null reference. */ public class List { public int value; public List next; /** * Creates a new list * * @param value value of the head of the list * @param next reference to rest of the list; may be null */ public List(int value, List next) { this.value = value; this.next = next; } } and the linked list class itself which contains the following method public static int size(List list) { if(list==null) return 0; else return size(list.next)+1; } so far everything works. But if I try public static int size(List list) { if(list.next==null) return 1; else return size(list.next)+1; } i get a NullPointerException... I have no Idea why this shouldn't work since list.next should a one point be a reference to the null pointer and end the recursion. Therefore size(null.next) should never be called. I apologise for the bad english and am grateful for any help
type: Question
linked to: http://stackoverflow.com/q/218384
has comment: http://stackoverflow.com/comment/34530713
has answer: http://stackoverflow.com/a/22668320
accepted answer: http://stackoverflow.com/a/22668320
has comment: http://stackoverflow.com/comment/34530673
score: 0
answer count: 3
has comment: http://stackoverflow.com/comment/34530975
has comment: http://stackoverflow.com/comment/34531486
has comment: http://stackoverflow.com/comment/34531038
has answer: http://stackoverflow.com/a/22668314
upvote count: 1
downvote count: 1
has title: Linked list mystery

http://stackoverflow.com/a/28824677
has comment: http://stackoverflow.com/comment/45920415
has body: You might have already checked, but if not, see https://bz.apache.org/bugzilla/show_bug.cgi?id=47251 if helps. It has similar problem(s) and you may find answer on how to handle it.
score: 0
upvote count: 1
downvote count: 1
answers question: http://stackoverflow.com/q/22786968
type: Answer

http://stackoverflow.com/q/22721385
downvote count: 0
answer count: 1
tagged with: hashset
favorite count: 0
has title: How to store two equal String or any object (with different references) in a HashMap/HashSet?
has body: I have written following code, with two String object, but only one String is added in HashSet or HashMap: String s1 = new String("Text"); String s2 = "Text"; //checking with Reference equality operator System.out.println("Does both are same object: " + s1 == s2); //not equal two different object of String is created HashSet&lt;String&gt; set = new HashSet&lt;&gt;(); set.add(s1); set.add(s2); for (Iterator&lt;String&gt; iterator = set.iterator(); iterator.hasNext();) { String strObj = (String) iterator.next(); System.out.println(strObj); } The output is: Text I know adding any object in HashMap or HashSet depends on equal() method: i.e. for both the String s1.equals(s2) //returns true that is why only one String is added in HashMap or HashSet(which is in the contract), but what is the workaround I wanted to add both the String as they are different object. String is a final class so I can not create subclass and override equals() and hashCode() method to check with reference equality operator and return true or false.
has answer: http://stackoverflow.com/a/22721449
has comment: http://stackoverflow.com/comment/34627024
tagged with: equals
upvote count: 1
tagged with: collections
type: Question
accepted answer: http://stackoverflow.com/a/22721449
type: AnsweredQuestion
tagged with: hashmap
score: 1
tagged with: java

persistence
tags question: http://stackoverflow.com/q/22786359
tags question: http://stackoverflow.com/q/22758179
tags question: http://stackoverflow.com/q/22755655
tag name: persistence
type: Tag
tags question: http://stackoverflow.com/q/22787260
tags question: http://stackoverflow.com/q/22657617
tags question: http://stackoverflow.com/q/22767573
tags question: http://stackoverflow.com/q/22723727
tags question: http://stackoverflow.com/q/22700224

http://stackoverflow.com/q/22751819
answer count: 0
type: UnansweredQuestion
score: 1
has body: I am new to Android development, and I want to implement MuPDF in my Android app (.pdf file is on sdcard). I downloaded MuPDF source code from here: http://mupdf.googlecode.com/files/mupdf-1.3-source.tar.gz I was compile code with 'ndk-build', import to Eclipse, and build apk. Testing on Samsung Galaxy SIII Mini, and application fully working (open content of my sdcard with built-in file manager, and opening and rendering .pdf file succesly). Than, I was copy-paste sources, resources, libs, jni etc in my own project in Eclipse with no errors (there is no red marks in Eclipse). Build apk, and install apk on SGSIIIMini again. My app and functions of my app, work properly. When I click a button to start 'ChoosePDFActivity.java' (this is now from MuPDF), also working properly, and show me content of my sdcard. But, when I want to open any .pdf file from sdcard (that is a MuPDFActivity.java), I got a Force Close. This is my logcat: IN (Dev1, Dev2, Dev3, Dev4, Dev5, Dev6))ORDER BY rowid LIMIT 1 I/System.out( 8208): Trying to open /storage/emulated/0/narudzbenica.pdf D/dalvikvm( 8208): Trying to load lib /data/app-lib/stiw47.logos.muzicko1-2/libmupdf.so 0x41c49558 D/dalvikvm( 8208): Added shared lib /data/app-lib/stiw47.logos.muzicko1-2/libmupdf.so 0x41c49558 D/dalvikvm( 8208): No JNI_OnLoad found in /data/app-lib/stiw47.logos.muzicko1-2/libmupdf.so 0x41c49558, skipping init W/dalvikvm( 8208): No implementation found for native Lstiw47/logos/muzicko1/MuPDFCore;.openFile:(Ljava/lang/String;)J D/AndroidRuntime( 8208): Shutting down VM W/dalvikvm( 8208): threadid=1: thread exiting with uncaught exception (group=0x4199cce0) E/AndroidRuntime( 8208): FATAL EXCEPTION: main E/AndroidRuntime( 8208): Process: stiw47.logos.muzicko1, PID: 8208 E/AndroidRuntime( 8208): java.lang.UnsatisfiedLinkError: Native method not found: stiw47.logos.muzicko1.MuPDFCore.openFile:(Ljava/lang/String;)J E/AndroidRuntime( 8208): at stiw47.logos.muzicko1.MuPDFCore.openFile(Native Method) E/AndroidRuntime…
upvote count: 1
tagged with: mupdf
tagged with: android-ndk
has title: Import MuPDF to Android app
tagged with: java
tagged with: eclipse
type: Question
tagged with: http://stackoverflow.com/tag/pdf
downvote count: 0
favorite count: 0

http://stackoverflow.com/comment/34528039
type: QuestionComment
comment on: http://stackoverflow.com/q/22666935
has text: One thing I forgot to mention is that this code is profiled using appstats as well and all the fetches from memcache are shown to be <10ms. That means that the remainder of the time is spent deserializing the objects....
score: 0
type: Comment

http://stackoverflow.com/q/22688402
has comment: http://stackoverflow.com/comment/90417425
tagged with: jpa
has answer: http://stackoverflow.com/a/78940582
downvote count: 0
has answer: http://stackoverflow.com/a/55916042
has answer: http://stackoverflow.com/a/63450739
has body: I have a spring 4 app where I'm trying to delete an instance of an entity from my database. I have the following entity: @Entity public class Token implements Serializable { @Id @SequenceGenerator(name = "seqToken", sequenceName = "SEQ_TOKEN", initialValue = 500, allocationSize = 1) @GeneratedValue(strategy = GenerationType.SEQUENCE, generator = "seqToken") @Column(name = "TOKEN_ID", nullable = false, precision = 19, scale = 0) private Long id; @NotNull @Column(name = "VALUE", unique = true) private String value; @ManyToOne(fetch = FetchType.EAGER) @JoinColumn(name = "USER_ACCOUNT_ID", nullable = false) private UserAccount userAccount; @Temporal(TemporalType.TIMESTAMP) @Column(name = "EXPIRES", length = 11) private Date expires; ... // getters and setters omitted to keep it simple } I have a JpaRepository interface defined: public interface TokenRepository extends JpaRepository&lt;Token, Long&gt; { Token findByValue(@Param("value") String value); } I have a unit test setup that works with an in memory database (H2) and I am pre-filling the database with two tokens: @Test public void testDeleteToken() { assertThat(tokenRepository.findAll().size(), is(2)); Token deleted = tokenRepository.findOne(1L); tokenRepository.delete(deleted); tokenRepository.flush(); assertThat(tokenRepository.findAll().size(), is(1)); } The first assertion passes, the second fails. I tried another test that changes the token value and saves that to the database and it does indeed work, so I'm not sure why delete isn't working. It doesn't throw any exceptions either, just doesn't persist it to the database. It doesn't work against my oracle database either. Edit Still having this issue. I was able to get the delete to persist to the database by adding this to my TokenRepository interface: @Modifying @Query("delete from Token t where t.id = ?1") void delete(Long entityId); However this is not an ideal solution. Any ideas as to what I need to do to get it working without this extra method?
score: 120
tagged with: spring-data-jpa
has comment: http://stackoverflow.com/comment/119959423
has comment: http://stackoverflow.com/comment/90424821
has answer: http://stackoverflow.com/a/22689134
answer count: 15
favorite count: 0
has answer: http://stackoverflow.com/a/75407879
has answer: http://stackoverflow.com/a/57669102
has comment: http://stackoverflow.com/comment/100622127
has comment: http://stackoverflow.com/comment/110597689
has answer: http://stackoverflow.com/a/61253080
has answer: http://stackoverflow.com/a/52525033
has answer: http://stackoverflow.com/a/53450191
type: UnansweredQuestion
tagged with: spring-data
has title: Delete Not Working with JpaRepository
has answer: http://stackoverflow.com/a/57359176
type: Question
has answer: http://stackoverflow.com/a/27954027
has answer: http://stackoverflow.com/a/42675619
tagged with: java
tagged with: hibernate
has answer: http://stackoverflow.com/a/71146102
has answer: http://stackoverflow.com/a/37030089
has answer: http://stackoverflow.com/a/30248348
upvote count: 120

http://stackoverflow.com/comment/34560708
comment on: http://stackoverflow.com/q/22685363
type: Comment
type: QuestionComment
has text: What do you mean by static drawing ?
score: 0

http://stackoverflow.com/comment/34769672
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/22801136
type: Comment
has text: My messages have a type, but step 1 is on a different thread. So that thread keeps on running , and keeps accepting the messages. So the client reply from Step 3 is received on that thread. Where as I want this reply specifically to step 3. I am sorry if my question was not clear.

http://stackoverflow.com/a/22789013
has body: You also need to do a check if the spell is currently in view/activate prior to initiating a new spell in the shoot() method... public void shootSpell(){ //do a check here if a spell is already running! final BlueSpell b = new BlueSpell(GoodGuy.getx(), GoodGuy.gety() +1, BlueSpellWizard()); int delay = 100; //...... So in your method that is updating the spell going accross the screen you either need to have a flag in there if its still active, or if you are running it in a new thread, save that thread to a global var and check to see if the thread is running prior instantiating a new BlueSpell()
score: 0
type: Answer
answers question: http://stackoverflow.com/q/22788639

http://stackoverflow.com/comment/34729471
type: Comment
comment on: http://stackoverflow.com/a/22774817
has text: Thank you all for your insight and prompt responses!
type: AnswerComment
score: 0

http://stackoverflow.com/comment/34658723
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/22739539
has text: @JigarJoshi this directory contains the src file and the bin file of the java project called "Clean"

http://stackoverflow.com/comment/34607184
has text: No problem, yeah basically `list.toArray(new String[list.size()]);` is what you were looking for. Glad to hlep.
type: AnswerComment
score: 0
type: Comment
comment on: http://stackoverflow.com/a/22694875

http://stackoverflow.com/q/22702173
type: Question
tagged with: split
has answer: http://stackoverflow.com/a/22702400
tagged with: expression
downvote count: 0
has answer: http://stackoverflow.com/a/22702196
has answer: http://stackoverflow.com/a/22702194
has answer: http://stackoverflow.com/a/22702237
has title: Using Java split to evaluate a mathematical expression
possible better answer: http://stackoverflow.com/a/22702194
has body: After some time of working with this problem, I'm having trouble figuring out the Regex syntax for exactly what I need. In a Java course I'm taking, we're given the task of building a calculator capable of taking an expression string (written with or without parentheses) and correctly evaluating it. The concept behind the parsing of the expression is that you have a string... 5+16/20-56+7-20*16/9 And you want to get two ArrayLists via 'split': {5,16,20,56,7,20,16,9} {+,/,-,+,-,*,/} You then perform operations piece by piece, in order of operation priority, emptying operations from your ArrayList until your number array has one element: the final result. Unfortunately, I have no experience with Regex and can't make any sense of the tutorials and examples I'm reading. I can't figure out how to split based on "[*-/+]", and I can't figure out how to select whole numbers to split by rather than mere digits. I can't get my code to compile because of these errors. The one working snippet of code I did get: import java.util.*; import java.awt.*; import javax.swing.*; import java.awt.event.*; public class Tester { public static void main(String[] args) { String expression = "3+5+6-10*20/150-14+76%2"; // String[] operands = expression.split(""); String[] operators = expression.split("[0-9]"); // System.out.println(operands); System.out.println(operators); } } results in [Ljava.lang.String;@308ab721 And I have no idea where that comes from. Can anyone help me figure out what I'm doing wrong? Or point to a very good beginner's lesson on Regex? I appreciate your help, everyone.
favorite count: 0
accepted answer: http://stackoverflow.com/a/22702196
tagged with: regex
answer count: 4
type: AnsweredQuestion
score: 1
tagged with: java
upvote count: 1

http://stackoverflow.com/comment/34766662
type: QuestionComment
comment on: http://stackoverflow.com/q/22775758
score: 0
type: Comment
has text: Then checkout my test case at github. That's definitely wrong. And to your second suggestion: do you really want one to use JDK 7 just to delete from files with bad names?

http://stackoverflow.com/a/22731033
type: Answer
score: 3
downvote count: 0
has comment: http://stackoverflow.com/comment/34715771
answers question: http://stackoverflow.com/q/22730715
upvote count: 3
has body: The solution is not to use the KeyListener's key press for moving your sprite. The key is not to rely on the hardware-specific key press frequency, to use a Swing Timer to create your own frequency. Instead use Key Bindings and a Swing Timer. Start the time on key press and stop it on key release. For example, run this code and press and release the up-arrow key: import java.awt.Color; import java.awt.Dimension; import java.awt.Font; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import java.awt.event.KeyEvent; import javax.swing.*; @SuppressWarnings("serial") public class KeyBindingEg extends JPanel { private static final String UP_KEY_PRESSED = "up key pressed"; private static final String UP_KEY_RELEASED = "up key released"; private static final int UP_TIMER_DELAY = 50; private static final Color FLASH_COLOR = Color.red; private Timer upTimer; private JLabel label = new JLabel(); public KeyBindingEg() { label.setFont(label.getFont().deriveFont(Font.BOLD, 32)); label.setOpaque(true); add(label); setPreferredSize(new Dimension(400, 300)); int condition = WHEN_IN_FOCUSED_WINDOW; InputMap inputMap = getInputMap(condition); ActionMap actionMap = getActionMap(); KeyStroke upKeyPressed = KeyStroke.getKeyStroke(KeyEvent.VK_UP, 0, false); KeyStroke upKeyReleased = KeyStroke.getKeyStroke(KeyEvent.VK_UP, 0, true); inputMap.put(upKeyPressed, UP_KEY_PRESSED); inputMap.put(upKeyReleased, UP_KEY_RELEASED); actionMap.put(UP_KEY_PRESSED, new UpAction(false)); actionMap.put(UP_KEY_RELEASED, new UpAction(true)); } private class UpAction extends AbstractAction { private boolean onKeyRelease; public UpAction(boolean onKeyRelease) { this.onKeyRelease = onKeyRelease; } @Override public void actionPerformed(ActionEvent evt) { if (!onKeyRelease) { if (upTimer != null &amp;&amp; upTimer.isRunning()) { return; } System.out.println("key pressed"); label.setText(UP_KEY_PRESSED); upTimer = new Timer(UP_TIMER_DELAY, new ActionListener() { @Override public void actionP…

http://stackoverflow.com/comment/34544746
score: 0
has text: If the rule is applicable then when calling method `f` with an auto (un)boxing parameter it should call method `void f(double)`
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/22676060

http://stackoverflow.com/comment/34535703
score: 0
type: Comment
comment on: http://stackoverflow.com/q/22649636
type: QuestionComment
has text: Edited the example and added scrollPane.setVerticalScrollBarPolicy(ScrollPaneConstants.VERTICAL_SCROLLBAR_ALWAYS);scrollPane.setHorizontalScrollBarPolicy(ScrollPaneConstants.HORIZONTAL_SCROLLBAR_ALWAYS); This should help with the initial jumping.

http://stackoverflow.com/a/22708328
answers question: http://stackoverflow.com/q/22706448
type: Answer
has body: It is possible without using third party modules and without iterating (and without writing too much code): Just write a Wrapper for your person list which accesses the Ids: static class PersonIdList extends AbstractList&lt;Long&gt; { private final List&lt;Person&gt; wrapped; public PersonIdList( List&lt;Person&gt; wrapped ){ this.wrapped = wrapped; } @Override public Long get( int index ) { return wrapped.get( index ).personId; } @Override public int size() { return wrapped.size(); } } which can be used this way: List&lt;Person&gt; persons = Arrays.asList( new Person( 1L, "Foo" ), new Person( 2L, "Bar" ), new Person( 3L, "Joshua" ) ); PersonIdList personIds = new PersonIdList( persons ); for( Long id : personIds ){ System.out.println( id ); } This solution works best of cause with random access lists (e.g. ArrayList) and not so good with sequential lists (e.g. LinkedList). If you need it for linked lists and performance is an issue (large linked list, large database results) you could extend AbstractSequentialList and its Iterator or directly implement List and Iterator. Both would be more code than this one but I think with this one you should get the idea.
score: 0

http://stackoverflow.com/comment/34732879
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/22780735
type: Comment
has text: Thank you for your efforts. This is not good news thus, as code problems, I can fix, the rest, I'm not sure! I will try to circumvent the issue by using my own temporary directory.

http://stackoverflow.com/q/22794414
has body: I've been looking around for a couple of days, I think I have the answer. I don't have a lot of experience with java, so I wanted a second, or more, opinion. Anyway the issue my logging function started logging the wrong time after DST started: private static void logmsg( String lfile, String msg) { try { Date date = new Date(); SimpleDateFormat sdf = new SimpleDateFormat("yyyyMMdd HHmm"); String formattedDate = sdf.format(date); PrintStream fubar = new PrintStream(new FileOutputStream(lfile, true)); fubar.print(formattedDate+": "+msg+"\n"); fubar.close(); } catch(Exception e2) { e2.printStackTrace(); // gotta print if logging won't work. } } I spent a fair amount of time here, and elsewhere, looking for a simple answer. I think this is it, and I wanted it where I could find it again. :) private static void logmsg( String lfile, String msg) { try { Date date = new Date(System.currentTimeMillis() + TimeZone.getDefault().getDSTSavings()); SimpleDateFormat sdf = new SimpleDateFormat("yyyyMMdd HHmm"); String formattedDate = sdf.format(date); PrintStream fubar = new PrintStream(new FileOutputStream(lfile, true)); fubar.print(formattedDate+": "+msg+"\n"); fubar.close(); } catch(Exception e2) { e2.printStackTrace(); // gotta print if logging won't work. } } Basically changing the Date() initialization to get the system time and add the default timezone offset in millis. Am I overlooking some gotcha? All I needed was a simple, accurate, local timestamp in a file. The same file is written by a pl/sql function that is part of the overall process, I initially noticed when the java datestamps were out of sequence with the rest.
tagged with: logging
type: Question
tagged with: java
tagged with: date
has comment: http://stackoverflow.com/comment/34762165
score: 0
has answer: http://stackoverflow.com/a/22794668
answer count: 1
has title: Logging the Correct time using java simpledateformat
type: UnansweredQuestion

http://stackoverflow.com/comment/34723274
type: Comment
comment on: http://stackoverflow.com/a/22766683
has text: Thanks for the answer. Having different versions and preserving it looks to be the way in case the above guidelines have to be followed. But the frequency in which these documents keep getting modified is quite high in case of a Public Listed Company. Not sure what the govt. was thinking. Will need to seek a clarification from them..
score: 0
type: AnswerComment

http://stackoverflow.com/comment/34648494
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/22733757
score: 9
has text: Why not create a class (let's say `Person`) and then use an array of `Person`?

http://stackoverflow.com/comment/34664218
has text: Updated it with imports inside, otherwise yes. If there was a tutorial on how to populate ListViews in a Fragment via Async (Or otherwise - prefer it to be in the background tho.), i'd be happy to read it as well :).
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/22742563
type: Comment

http://stackoverflow.com/comment/34683534
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/22753286
has text: Didn't you just answered your own question? My apologies. It seems there is a index out of bounds error
score: 0

http://stackoverflow.com/q/22773300
upvote count: 3
tagged with: android
favorite count: 0
tagged with: android-asynctask
tagged with: android-studio
has body: The following code in my MainActivity is failing with a fatal exception in the overridden doInBackground() method: public class MainActivity extends ActionBarActivity { . . . public void onFetchBtnClicked(View v){ if(v.getId() == R.id.FetchBtn){ Toast.makeText(getApplicationContext(), "You mashed the button, dude.", Toast.LENGTH_SHORT).show(); new NetworkTask().execute(); } } public static class NetworkTask extends AsyncTask<String, Void, HttpResponse> { @Override protected HttpResponse doInBackground(String... params) { String link = params[0]; HttpGet request = new HttpGet("http://localhost:28642/api/deliveries/Count"); AndroidHttpClient client = AndroidHttpClient.newInstance("Android"); try { return client.execute(request); } catch (IOException e) { e.printStackTrace(); return null; } finally { client.close(); } } @Override protected void onPostExecute(HttpResponse result) { FileOutputStream f = null; //Do something with result if (result != null) /* result.getEntity().writeTo(new FileOutputStream(f)); */ try { result.getEntity().writeTo(f); } catch (IOException e) { e.printStackTrace(); } } } The specific exception messages, with a smidgin of pre-exception context follows: 03-31 18:04:26.350 1401-1401/hhs.app I/Choreographer﹕ Skipped 33 frames! The application may be doing too much work on its main thread. 03-31 18:05:00.030 1401-1420/hhs.app W/dalvikvm﹕ threadid=12: thread exiting with uncaught exception (group=0xb2a7aba8) 03-31 18:05:00.250 1401-1420/hhs.app E/AndroidRuntime﹕ FATAL EXCEPTION: AsyncTask #1 Process: hhs.app, PID: 1401 java.lang.RuntimeException: An error occured while executing doInBackground() at android.os.AsyncTask$3.done(AsyncTask.java:300) at java.util.concurrent.FutureTask.finishCompletion(FutureTask.java:355) at java.util.concurrent.FutureTask.setException(FutureTask.java:222) at java.util.concurrent.FutureTask.run(FutureTask.java:242) at android.os.AsyncTask$SerialExecutor$1.run(AsyncTask.java:231) at java.util.concurrent.ThreadPoolExecu…
possible better answer: http://stackoverflow.com/a/22773370
has comment: http://stackoverflow.com/comment/34720260
linked to: http://stackoverflow.com/q/22791834
type: AnsweredQuestion
score: 3
has title: Why does this background task fail with a fatal exception?
accepted answer: http://stackoverflow.com/a/22773336
tagged with: java
type: Question
answer count: 2
has answer: http://stackoverflow.com/a/22773336
has answer: http://stackoverflow.com/a/22773370
tagged with: androidhttpclient
downvote count: 0

http://stackoverflow.com/q/22743346
upvote count: 7
favorite count: 0
has answer: http://stackoverflow.com/a/36136442
has comment: http://stackoverflow.com/comment/34704983
possible better answer: http://stackoverflow.com/a/31992106
has answer: http://stackoverflow.com/a/50136022
has comment: http://stackoverflow.com/comment/34690262
has answer: http://stackoverflow.com/a/31992106
type: AnsweredQuestion
downvote count: 0
has answer: http://stackoverflow.com/a/57693342
tagged with: spring
type: Question
tagged with: spring-mvc
score: 7
tagged with: java
has body: How can I print date and time is specified timezone with Thymeleaf? Something like: 2010-01-01 16:30
answer count: 6
has answer: http://stackoverflow.com/a/22787498
accepted answer: http://stackoverflow.com/a/22787498
has comment: http://stackoverflow.com/comment/34695062
has title: Spring + Thymeleaf: time in user's timezone
tagged with: thymeleaf
has answer: http://stackoverflow.com/a/71671629

http://stackoverflow.com/q/22781292
has title: Problems getting XML node text in StAX XMLStreamConstants.CHARACTERS event
has comment: http://stackoverflow.com/comment/34734399
tagged with: http://stackoverflow.com/tag/xml
has body: While reading an XML file using StAX and XMLStreamReader, I encountered a weird problem. Not sure if its an error or I am doing something wrong. Still learning StAX. So the problem is, In XMLStreamConstants.CHARACTERS event, when I collect node text as XMLStreamReader.getText() method. If there is &amp;, &lt;, > or even something hidden for instance in node text, it returns only the first part of the text string. e.g. ABC &amp; XYZ returns only ABC Simplified Java Source: // Start StaX reader XMLInputFactory xmlInputFactory = XMLInputFactory.newInstance(); try { XMLStreamReader xmlStreamReader = xmlInputFactory.createXMLStreamReader(inStream); int event = xmlStreamReader.getEventType(); while (true) { switch (event) { case XMLStreamConstants.START_ELEMENT: switch (xmlStreamReader.getLocalName()) { case "group": // Do something break; case "source": isSource = true; break; case "target": isTarget = true; break; default: isSource = false; isTrans = false; break; } break; case XMLStreamConstants.CHARACTERS: if (srcData != null) { String srcTrns = xmlStreamReader.getText(); if (srcTrns != null) { if (isSource) { // Set source text isSource = false; } else if (isTrans) { // Set target text isTrans = false; } } } break; case XMLStreamConstants.END_ELEMENT: if (xmlStreamReader.getLocalName().equals("group")) { // Add to return list } break; } if (!xmlStreamReader.hasNext()) { break; } event = xmlStreamReader.next(); } } catch (XMLStreamException ex) { LOG.log(Level.WARNING, ex.getMessage(), MessageFormat.format("{0} {1}", ex.getCause(), ex.getLocation())); } I am not quite sure what exactly I am doing wrong or how to collect complete text of the node. Any suggestions or tips would be a great help to move on learning StAX more. :-)
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/34734584
tagged with: java
type: Question
score: 4
upvote count: 4
has comment: http://stackoverflow.com/comment/34733964
answer count: 1
downvote count: 0
has answer: http://stackoverflow.com/a/22786482
favorite count: 0
tagged with: stax
accepted answer: http://stackoverflow.com/a/22786482

http://stackoverflow.com/a/22749564
has body: Sure. If it's not private, then its inherited by InnerClass - that is, the i that's operated on is the one in the InnerClass object. If it is private, it can't be inherited, so the i that's operated on is the one in the containing object.
answers question: http://stackoverflow.com/q/22749460
score: 2
upvote count: 2
downvote count: 0
type: Answer

http://stackoverflow.com/q/22789452
answer count: 1
has title: Google Custom search API: how to get search result contents description (e.g snippets) for URL
favorite count: 0
has answer: http://stackoverflow.com/a/22796068
has body: how can we get the contents of the URL retrieved using google custom search API. I am new to work with such APIs and in documentation no such sample code is given that can explain it. I am using google-api-services-customsearch-v1-rev36-1.17.0-rc.jar here is my code. protected Result[] doSearch() { HttpRequestInitializer httpRequestInitializer = new HttpRequestInitializer(){ @Override public void initialize(HttpRequest request) throws IOException { } }; JsonFactory jsonFactory = new JacksonFactory(); Customsearch csearch = new Customsearch( new NetHttpTransport(), jsonFactory, httpRequestInitializer); Customsearch.Cse.List listReqst = csearch.cse().list(query.getQueryString()); listReqst.setKey(GOOGLE_KEY); // set the search engine ID got from API console listReqst.setCx("SEARCH_ENGINE_ID"); // set the query string listReqst.setQ(query); //query contains search query string // language chosen is English for search results listReqst.setLr("lang_en"); // set hit position of first search result listReqst.setStart((long) firstResult); // set max number of search results to return listReqst.setNum((long) maxResults); Search result = list.execute(); // perform search } here after this need to get the snippets and URLs of the corresponding websites. which I have to return in this function. how can we retrieve them.
score: 2
downvote count: 0
tagged with: google-custom-search
type: AnsweredQuestion
tagged with: java
type: Question
upvote count: 2
accepted answer: http://stackoverflow.com/a/22796068

http://stackoverflow.com/a/22793215
upvote count: 2
type: Answer
score: 2
has comment: http://stackoverflow.com/comment/45877225
has body: API says that PriorityQueue iterator is not guaranteed to traverse the elements of the priority queue in any particular order. It's only guaranteed that poll, remove, peek, and element access the element at the head of the queue (least element)
downvote count: 0
answers question: http://stackoverflow.com/q/22792932

http://stackoverflow.com/comment/34593145
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/22702788
has text: P.S. I'm using net.sf.json.JSONObject

http://stackoverflow.com/q/22751564
tagged with: character
has title: Regex illegal escape character
type: Question
has body: String[] tokens = infix.split("[0-9]*([.][0-9]+)? | sin | cos | tan | log | \^ | sqrt | \( | \) | \+ | \- | \* | \/"); When I compile this, it says I have an illegal escape character at "\^", I'm trying to tell it to ignore the special character "^" and view "^" as an actual String, don't I have the syntax right?
tagged with: escaping
tagged with: java
has comment: http://stackoverflow.com/comment/34680518
linked to: http://stackoverflow.com/q/1367322
has comment: http://stackoverflow.com/comment/34680447
score: 0
has answer: http://stackoverflow.com/a/22751592
answer count: 1
has comment: http://stackoverflow.com/comment/34680492
linked to: http://stackoverflow.com/q/3297867
type: UnansweredQuestion
tagged with: regex

http://stackoverflow.com/a/22649901
has body: your code is wrong. list.setAdapter(new ArrayAdapter&lt;String&gt;(getActivity(),R.layout.fragment_database, names)); you use this code. list.setAdapter(new ArrayAdapter&lt;String&gt;(getActivity(),android.R.layout.simple_list_item_1, names)); R.layout.fragment_database is not ListviewItem's xml file. You use custom item layout or simpleItemLayout. read this page and try again. http://www.vogella.com/tutorials/AndroidListView/article.html
answers question: http://stackoverflow.com/q/22649810
score: 0
has comment: http://stackoverflow.com/comment/34498408
type: Answer
accepted answer of: http://stackoverflow.com/q/22649810
has comment: http://stackoverflow.com/comment/34498353
type: AcceptedAnswer

http://stackoverflow.com/q/22714236
has comment: http://stackoverflow.com/comment/34613125
tagged with: eclipse
has body: &lt; at java.util.Scanner.throwFor(Unknown Source) at java.util.Scanner.next(Unknown Source) at java.util.Scanner.nextInt(Unknown Source) at java.util.Scanner.nextInt(Unknown Source) at Main.main(Main.java:14)&gt;&gt; I am trying to make a file reader , it should read from textfile a 9 digit and make a ISBN Number. this gives constantly error : Exception in the thread.... the 9 digits are like this : 013601267&lt; enter> 013031997 013292373 here is my code: File fr = new File("ISBN.txt"); Scanner in = new Scanner(fr); int s ; int sum; int c10; while (in.hasNextInt()) { int c1 = in.nextInt(); int c2 = in.nextInt(); int c3 = in.nextInt(); int c4 = in.nextInt(); int c5 = in.nextInt(); int c6 = in.nextInt(); int c7 = in.nextInt(); int c8 = in.nextInt(); int c9 = in.nextInt(); String set = in.next(); sum = Integer.parseInt(set); c10 = (c1 * 1 + c2 * 2 + c3 * 3 + c4 * 4 + c5 * 5 + c6 * 6 + c7 * 7 + c8 * 8 + c9 * 9) % 11; s = c1+c2+c3+c4+c5+c6+c7+c8+c9; System.out.print("" + s); if (c10 == 1) { System.out.println(set); } else if (c10 % 11 == 0) { System.out.println(set + "X"); } } } }
has answer: http://stackoverflow.com/a/22714498
accepted answer: http://stackoverflow.com/a/22714584
type: Question
has answer: http://stackoverflow.com/a/22714321
answer count: 3
possible better answer: http://stackoverflow.com/a/22714321
has title: Why can't read this code: Exception in thread "main" java.util.NoSuchElementException, at java.util.Scanner.throwFor(Unknown Source),
has comment: http://stackoverflow.com/comment/34613616
tagged with: java.util.scanner
has answer: http://stackoverflow.com/a/22714584
tagged with: multithreading
tagged with: filereader
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/34613375
score: 0
tagged with: java

http://stackoverflow.com/comment/34563674
has text: Just curious, why would you want to extend functional interfaces, it seems not so smart to do so in my opinion.
comment on: http://stackoverflow.com/q/22686586
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/a/22767298
answers question: http://stackoverflow.com/q/22767101
upvote count: 3
has body: # is not a valid character in a URI path; # and what follows it is actually a URI fragment. What you need to do is therefore: final URI build = uriInfo.getBaseUriBuilder().path("..") .fragment("/clients/asd/").build(); (note: I don't use Jersey, actually; I looked up the javadoc here, as I suppose this is the same)
score: 3
type: AcceptedAnswer
downvote count: 0
type: Answer
accepted answer of: http://stackoverflow.com/q/22767101

http://stackoverflow.com/a/22765075
answers question: http://stackoverflow.com/q/22764628
type: AcceptedAnswer
downvote count: 0
has body: You custom painting is done in the CountryPolygon class. Since you are using a null layout the default size of these components is (0, 0), so the painting of your polygons is done outside the bounds of the class and there is nothing to see. You need to set the size of each of these components. Not sure, but maybe you can use the approach found in Custom Painting Approaches. The DrawOnComponent example keeps an ArrayList of Rectangles to draw. In your case you can change this to use to hold Shape objects and then use the fillShape(...) method of Graphics2D to do the painting. Edit: The width/height of (30, 30) would still be wrong Point[] poly2 = new Point[] { new Point(50, 10), new Point(80, 10), new Point(80, 40), new Point(50, 40) }; You are using points like (80, 10) which is well outside the (30, 30) size. You really need to make the size of each component the size of the parent panel.
has comment: http://stackoverflow.com/comment/34706093
has comment: http://stackoverflow.com/comment/34706861
has comment: http://stackoverflow.com/comment/34705314
type: Answer
upvote count: 2
score: 2
accepted answer of: http://stackoverflow.com/q/22764628

http://stackoverflow.com/q/22754808
upvote count: 1
linked to: http://stackoverflow.com/q/2877262
favorite count: 0
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/34690345
has comment: http://stackoverflow.com/comment/34686253
has body: I am getting this exception when i am trying to run a simple class from intellijIdea using spark Exception in thread "Thread-0" java.lang.SecurityException: class "javax.servlet.SessionTrackingMode"'s signer information does not match signer information of other classes in the same package at java.lang.ClassLoader.checkCerts(ClassLoader.java:952) at java.lang.ClassLoader.preDefineClass(ClassLoader.java:666) at java.lang.ClassLoader.defineClass(ClassLoader.java:794) at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:142) at java.net.URLClassLoader.defineClass(URLClassLoader.java:449) at java.net.URLClassLoader.access$100(URLClassLoader.java:71) at java.net.URLClassLoader$1.run(URLClassLoader.java:361) at java.net.URLClassLoader$1.run(URLClassLoader.java:355) at java.security.AccessController.doPrivileged(Native Method) at java.net.URLClassLoader.findClass(URLClassLoader.java:354) at java.lang.ClassLoader.loadClass(ClassLoader.java:425) at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:308) at java.lang.ClassLoader.loadClass(ClassLoader.java:358) at spark.webserver.SparkServerFactory.create(SparkServerFactory.java:33) at spark.Spark$1.run(Spark.java:303) at java.lang.Thread.run(Thread.java:744)
answer count: 0
downvote count: 0
has title: Exception in java.lang.securityexception
type: Question
score: 1
tagged with: java
has comment: http://stackoverflow.com/comment/34686270

http://stackoverflow.com/q/22677815
tagged with: java
tagged with: eclipse
has comment: http://stackoverflow.com/comment/34547657
type: Question
has answer: http://stackoverflow.com/a/22677895
has answer: http://stackoverflow.com/a/22678357
answer count: 2
tagged with: c-preprocessor
accepted answer: http://stackoverflow.com/a/22677895
possible better answer: http://stackoverflow.com/a/22678357
score: 0
has comment: http://stackoverflow.com/comment/34596970
tagged with: preprocessor
tagged with: eclipse-plugin
linked to: http://stackoverflow.com/q/2347828
has title: Eclipse: "println(__LINE__);" -- does such a preprocessor macro exist to programmatically get the code's Line Number?
type: AnsweredQuestion
has body: Note: To be clear, the question being asked is not about "How can I display line numbers in Eclipse?" That is answered here @ StackOverflow. Goal: I want to know if Eclipse has a macro that acts as getLineNumber() the same way Visual Studio has the ability to use the preprocessor macro __LINE__ to easily/universally get the line# for where this particular call to getLineNumber() lives on. It's useful for knowing if a line of code was hit, without using a debugger/breakpoints. I'd like to debug using: println("I just hit file@line: "+__FILE__ +'@'+ __LINE__ ); I am seeking a universal macro that can be copied and pasted to any file/any line, so that those values are known at/before compile time. Does Java/Eclipse offer such a feature? Possibly in an Eclipse plugin? I can't find any info on this anywhere, I'm at a loss. Thanks.
linked to: http://stackoverflow.com/q/3979809

http://stackoverflow.com/comment/34781361
has text: @assylias: Please see my update in the post
comment on: http://stackoverflow.com/q/22805176
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/a/22780188
type: Answer
has body: You question doesn't contain much information about the login form and the URL handler it gets submitted to. But I guess, after clicking the submit button, the login form is submitted to a Java servlet that doesn't implement doGet() or service() methods. Probably, it requires a POST request. So you can try to change the method attribute of the login form to method="POST" and see if it helps.
score: 0
has comment: http://stackoverflow.com/comment/34732337
answers question: http://stackoverflow.com/q/22779823
has comment: http://stackoverflow.com/comment/34733770

http://stackoverflow.com/a/22743127
downvote count: 0
type: Answer
has body: One way is to use Java Native Interface: http://docs.oracle.com/javase/6/docs/technotes/guides/jni/
score: 1
upvote count: 1
answers question: http://stackoverflow.com/q/22742971

http://stackoverflow.com/a/22666001
has comment: http://stackoverflow.com/comment/34526335
type: Answer
answers question: http://stackoverflow.com/q/22665806
score: 0
has body: You can concatenate strings if that is what you mean. And put this in a method createCommand that gets a string array as input and outputs a concatenated string: public String createCommand(String[] parts) { String result = ""; for(String part : parts) { result = result + part + " "; \\concatenates the result string with the next string in your parts array. } return result; }

http://stackoverflow.com/comment/34651917
has text: Ok, I just add to the topic the stacktrack after the changes in the code. Just for the record, what I did was or comment the line **super(SecurityConfig)** from the SecurityWebApplicationInitializer, or comment the line **container.addListener(new ContextLoaderListener(rootContext))** from WebAppInitializer
comment on: http://stackoverflow.com/a/22734487
score: 0
type: AnswerComment
type: Comment

http://stackoverflow.com/q/22690006
tagged with: forms
type: Question
has title: Want to capture 'Enter' key press in HTML form field
has answer: http://stackoverflow.com/a/22690068
accepted answer: http://stackoverflow.com/a/22690068
tagged with: javascript
tagged with: jquery
has answer: http://stackoverflow.com/a/22694261
favorite count: 0
answer count: 3
upvote count: 1
tagged with: http://stackoverflow.com/tag/html
has answer: http://stackoverflow.com/a/45771464
possible better answer: http://stackoverflow.com/a/22694261
has comment: http://stackoverflow.com/comment/34569191
type: AnsweredQuestion
downvote count: 0
score: 1
tagged with: java
has body: I have a HTML form text field( this is a form field),where I want to capture the whole text the end user put into that field along with the Enter key pressed for new lines.Like if i give an example, lets assume, I am putting the below string into the form text field exactly as it looks here: I Pressed Enter for a new Line. Now, I want to save this filed input into the database exactly as end user filled it,for that My database string may looks like this "I&lt;/br&gt;Pressed&lt;/br&gt;Enter for a new Line." That is okey with me.But i don't want to store it like "I Pressed Enter for a new Line." I have done it anyway.But there are many issues in my coding. Also, my requirement is it should be implemented in such a way, show that the same logic could be applied when the form will be open for editing and there will already be value in that text field from Database. Can anybody please help me?

http://stackoverflow.com/q/22665771
answer count: 2
has title: java.lang.OutOfMemoryError when loading image
downvote count: 0
has body: when i try to scroll for more images from sd card it's showing java.lang.OutOfMemoryError java.lang.OutOfMemoryError at android.graphics.BitmapFactory.nativeDecodeAsset(Native Method) at android.graphics.BitmapFactory.decodeStream(BitmapFactory.java:502) at android.graphics.BitmapFactory.decodeStream(BitmapFactory.java:601) at net.altnetwork.accountability.helpers.ScreenshotLibrary$LibraryItem.getBitmap(ScreenshotLibrary.java:124) at net.altnetwork.accountability.helpers.ScreenshotLibrary$ItemGroup.getBitmaps(ScreenshotLibrary.java:102) at net.altnetwork.accountability.v2.GalleryAdapter.getView(GalleryAdapter.java:127) at android.widget.AbsListView.obtainView(AbsListView.java:2143) at android.widget.ListView.makeAndAddView(ListView.java:1831) at android.widget.ListView.fillSpecific(ListView.java:1320) at android.widget.ListView.layoutChildren(ListView.java:1630) at android.widget.AbsListView.onTouchEvent(AbsListView.java:3348) at android.view.View.dispatchTouchEvent(View.java:7246) at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:2168) at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:1903) at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:2174) at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:1917) at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:1917) at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:2174) at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:1917) at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:2174) at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:1917) at com.android.internal.policy.impl.PhoneWindow$DecorView.superDispatchTouchEvent(PhoneWindow.java:1953) at com.android.internal.policy.impl.PhoneWindow.superDispatchTouchEvent(PhoneWindow.java:1405) at android.app.Activity.dispatchTouchEvent(Activity.java:2410) at com.android.internal.policy.impl.PhoneWindow$DecorView.dispatchTouchEvent(PhoneWindow.java:1901) at…
favorite count: 0
has answer: http://stackoverflow.com/a/22665970
type: UnansweredQuestion
tagged with: android
upvote count: 1
score: 1
tagged with: java
has answer: http://stackoverflow.com/a/22666047
type: Question

http://stackoverflow.com/a/22780351
answers question: http://stackoverflow.com/q/22780308
type: Answer
upvote count: 1
score: 1
downvote count: 0
has body: In the below Class A isn't x a local variable too since it is in blocks({}) Your x is not a local variable, it's an instance variable. Block means, instance initialization block or static block or try catch block. Access modifiers cannot be used for local variables but i am sure i can add public private protected ? It doesn't make sense to have access modifiers to method local variables, since, method local variable can only be accessed inside the method.

http://stackoverflow.com/a/22715286
answers question: http://stackoverflow.com/q/22713977
score: 0
type: Answer
has body: Looks like you have similar problem One of the solutions is to use Selenium to record web page interaction scenario and use that scenario from java

http://stackoverflow.com/a/22739008
score: -1
answers question: http://stackoverflow.com/q/22738984
upvote count: 0
has body: InstanceList[] means that you need to have a list of objects that are of they type InstanceList, same goes for String[] for these: Object[] means that anything that is a sublass of Object (any object) can be passed as arguments for the last two paramaters. In the top code this is exactly what they're doing but they create new objects for InstanceList and String,and then labels is the 2 objects they're passing.
type: Answer
downvote count: 1

http://stackoverflow.com/comment/43127281
type: Comment
score: 2
comment on: http://stackoverflow.com/a/26610279
type: AnswerComment
has text: This helped me too! I do not do java programming, just using some applets. And I also started to experience this nasty rendering bug after java update.

http://stackoverflow.com/a/22739223
has comment: http://stackoverflow.com/comment/34659422
has comment: http://stackoverflow.com/comment/34659473
has comment: http://stackoverflow.com/comment/34659503
answers question: http://stackoverflow.com/q/22738736
has comment: http://stackoverflow.com/comment/34659253
upvote count: 4
downvote count: 0
type: Answer
has body: Other questions have explained what the error message means from an intuitive perspective. However the "The compiler is smart, but not perfect!" comment is missing the point. In fact, the Java compiler is calling your example an error because the Java Language Specification requires it to call it an error. The Java compiler is not permitted to be "smart" about this. Here is what the JLS (for Java 71) actually says, and how it applies to a simplified version of the incorrect example, and then a corrected version. "If a method is declared to have a return type, then a compile-time error occurs if the body of the method can complete normally (JLS 14.1). In other words, a method with a return type must return only by using a return statement that provides a value return; it is not allowed to "drop off the end of its body". " - JLS 8.4.7 (Read JLS 14.1 for the definition of "normal completion" ...) And the rules for deciding whether a "normal" completion is possible are the reachability rules in JLS 14.21. And they say: "An if-then statement can complete normally iff it is reachable." "An if-then-else statement can complete normally iff the then-statement can complete normally or the else-statement can complete normally." "A break, continue, return, or throw statement cannot complete normally." (Where 'iff' means "if and only if" ...) Consider a simplified version of the example: public int test(boolean a) { if (a) { return 1; } else if (!a) { return 0; } } In this example, the else-statement is an if-then which can complete normally by rule #1. Therefore, by rule #2, the if-then-else statement can also complete normally. But that is a compilation error, because JLS 8.4.7 says that a method with a return type cannot complete normally. But if you change the example to this ... public int test(boolean a) { if (a) { return 1; } else { return 0; } } Now by rule #3, both the if-statement and the else-statement cannot complete normally. So by rule #2, the entire if-then-else c…
score: 4

http://stackoverflow.com/comment/34586088
has text: Let's consider I use this method, how can I retrieve the array? (There are several sub arrays)
score: 0
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/22699034

http://stackoverflow.com/a/22760612
has comment: http://stackoverflow.com/comment/68810844
has comment: http://stackoverflow.com/comment/34711213
answers question: http://stackoverflow.com/q/22758774
upvote count: 2
has body: If you're looking for local regression, Commons Math implements it as LoessInterpolator. You'll get the end result as a "spline," a smooth sequence of piecewise cubic polynomials.
type: Answer
has comment: http://stackoverflow.com/comment/34729275
has comment: http://stackoverflow.com/comment/34717221
score: 2
downvote count: 0
has comment: http://stackoverflow.com/comment/68801561

http://stackoverflow.com/a/22754937
type: AcceptedAnswer
downvote count: 0
has body: Well, Hibernate/JPA supports both accessor method and field based access type as you already aware of. In most of the situations in rich domain model, setter method may need to have some validation Accessor method Public void setPrice(final float price) { // perform some business validation plus few more operation as per the requirement this.price = price; } The above case will take bit more time for ORM engine to populate an entity. But in field based access will take comparatively less time to populate an entity. Hope This is helpful
type: Answer
accepted answer of: http://stackoverflow.com/q/22752981
score: 1
answers question: http://stackoverflow.com/q/22752981
upvote count: 1

http://stackoverflow.com/q/22783583
tagged with: java
has answer: http://stackoverflow.com/a/22785514
type: Question
has answer: http://stackoverflow.com/a/22787174
has body: I have a ReST API to an application with all controllers found under /api/, these all return JSON responses with a @ControllerAdvice which handles all exceptions to map to JSON formatted results. This works great as of spring 4.0 @ControllerAdvice now supports matching on annotations. What I can't work out is how to return a JSON result for a 401 - Unauthenticated and 400 - Bad Request responses. Instead Spring is simply returning the response to the container (tomcat) which renders this as HTML. How can I intercept this and render a JSON result using the same technique that my @ControllerAdvice is using. security.xml &lt;bean id="xBasicAuthenticationEntryPoint" class="com.example.security.XBasicAuthenticationEntryPoint"&gt; &lt;property name="realmName" value="com.example.unite"/&gt; &lt;/bean&gt; &lt;security:http pattern="/api/**" create-session="never" use-expressions="true"&gt; &lt;security:http-basic entry-point-ref="xBasicAuthenticationEntryPoint"/&gt; &lt;security:session-management /&gt; &lt;security:intercept-url pattern="/api/**" access="isAuthenticated()"/&gt; &lt;/security:http&gt; XBasicAuthenticationEntryPoint public class XBasicAuthenticationEntryPoint extends BasicAuthenticationEntryPoint { @Override public void commence(HttpServletRequest request, HttpServletResponse response, AuthenticationException authException) throws IOException, ServletException { HttpServletResponse httpResponse = (HttpServletResponse) response; httpResponse.sendError(HttpServletResponse.SC_UNAUTHORIZED, authException.getMessage()); } } I can solve 401 by using the BasicAuthenticationEntryPoint to write directly to the output stream, but I'm not sure it's the best approach. public class XBasicAuthenticationEntryPoint extends BasicAuthenticationEntryPoint { private final ObjectMapper om; @Autowired public XBasicAuthenticationEntryPoint(ObjectMapper om) { this.om = om; } @Override public void commence(HttpServletRequest request, HttpServletResponse response, AuthenticationExce…
downvote count: 0
tagged with: spring-security
upvote count: 28
has comment: http://stackoverflow.com/comment/34738615
answer count: 4
score: 28
favorite count: 0
has title: How can I get Spring-Security to return a 401 response as a JSON format?
has comment: http://stackoverflow.com/comment/34738832
type: UnansweredQuestion
tagged with: spring-mvc
has answer: http://stackoverflow.com/a/47504677
has answer: http://stackoverflow.com/a/22784147

http://stackoverflow.com/q/22762285
type: Question
answer count: 2
downvote count: 0
tagged with: sip
score: 2
has answer: http://stackoverflow.com/a/32960668
has title: Java JAIN SIP Presence
has answer: http://stackoverflow.com/a/22763617
favorite count: 0
upvote count: 2
type: UnansweredQuestion
tagged with: jain-sip
has body: I am currently writing an application in java using the the JAIN SIP library, I've been trying for the past couple of days to implement presence using SUBSCRIBE and NOTIFY messages. I currently have NOTIFY messages which has a content type of "message/sipfrag;version=2.0", and need this to be XML and PIDF. I'm aware I need to use an event header with "presence", and also a content type header. Are there any places I can go to where there is information on this or are there any other specific headers or classes and/or methods needed to make this work? I already have a client which I can make calls on, but need to implement presence now.
tagged with: java

http://stackoverflow.com/comment/35981010
comment on: http://stackoverflow.com/q/22674967
has text: actually yes , i got it solved , and will post the solution soon
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/q/22673705
upvote count: 1
has comment: http://stackoverflow.com/comment/34540718
score: 1
tagged with: java
type: Question
answer count: 2
downvote count: 0
has answer: http://stackoverflow.com/a/22673904
has answer: http://stackoverflow.com/a/22673820
tagged with: regex
favorite count: 0
has comment: http://stackoverflow.com/comment/34541513
has title: How to use split for CSV while escaping \
has body: I am trying to split a csv list. csvList=hello there, how are you, what is your name\, again I have to use the Java split function to get the three components: hello there how are you what is your name, again I want to escape the comma that is preceded by the '\'. Can anyone please help? Thanks.
type: UnansweredQuestion

http://stackoverflow.com/comment/34560609
score: 0
comment on: http://stackoverflow.com/a/22672857
type: Comment
has text: Thanx! This plus adding a temporary "resultListTemp" in performFiltering will also take care of the error message: "The content of the adapter has changed but ListView did not receive a notification". I think that the Google Places Autocomplete Training should be updated with these things.
type: AnswerComment

http://stackoverflow.com/comment/34725428
has text: @user25976 Sorry, i have not noticed that in your question. if you aiming for a randomized scramble, then no use of `Arrays.sort()` in that case. i will update the answer.
score: 0
type: Comment
comment on: http://stackoverflow.com/a/22755313
type: AnswerComment

http://stackoverflow.com/comment/34572130
type: QuestionComment
has text: Dirty hack, I've thought about that :)
score: 0
comment on: http://stackoverflow.com/q/22691422
type: Comment

http://stackoverflow.com/comment/34744246
has text: All the sun.xx classes are private to the Java implementation and off limits of Mockito. There are ways to get direct access to these classes but it is really not worth the effort.
type: Comment
type: QuestionComment
score: 2
comment on: http://stackoverflow.com/q/22784952

http://stackoverflow.com/a/22784739
upvote count: 2
answers question: http://stackoverflow.com/q/22784669
has comment: http://stackoverflow.com/comment/34739933
has comment: http://stackoverflow.com/comment/34739854
type: Answer
score: 2
has comment: http://stackoverflow.com/comment/34741398
downvote count: 0
has body: You can use libphonenumber String swissNumberStr = "044 668 18 00" PhoneNumberUtil phoneUtil = PhoneNumberUtil.getInstance(); try { PhoneNumber swissNumberProto = phoneUtil.parse(swissNumberStr, "CH"); } catch (NumberParseException e) { System.err.println("NumberParseException was thrown: " + e.toString()); } String num=phoneUtil.format(swissNumberProto, PhoneNumberFormat.NATIONAL) To get Country code:(e.g. +442446681800) you can take substring(second number) of phone number (4) then check if this number is country code ---> done if not take substring(second + third number) of phone number (44) then check if this number is country code ---> done if not take substring(second + third + fourth number) of phone number (424) then check if this number is country code ---> done if not use library as above ... But How to check Country Code: 1- add this array to string.xml on your app 93,AF 355,AL 213,DZ 376,AD 244,AO 672,AQ 54,AR 374,AM 297,AW 61,AU 43,AT 994,AZ 973,BH 880,BD 375,BY 32,BE 501,BZ 229,BJ 975,BT 591,BO 387,BA 267,BW 55,BR 673,BN 359,BG 226,BF 95,MM 257,BI 855,KH 237,CM 1,CA 238,CV 236,CF 235,TD 56,CL 86,CN 61,CX 61,CC 57,CO 269,KM 242,CG 243,CD 682,CK 506,CR 385,HR 53,CU 357,CY 420,CZ 45,DK 253,DJ 670,TL 593,EC 20,EG 503,SV 240,GQ 291,ER 372,EE 251,ET 500,FK 298,FO 679,FJ 358,FI 33,FR 689,PF 241,GA 220,GM 995,GE 49,DE 233,GH 350,GI 30,GR 299,GL 502,GT 224,GN 245,GW 592,GY 509,HT 504,HN 852,HK 36,HU 91,IN 62,ID 98,IR 964,IQ 353,IE 44,IM 972,IL 39,IT 225,CI 81,JP 962,JO 7,KZ 254,KE 686,KI 965,KW 996,KG 856,LA 371,LV 961,LB 266,LS 231,LR 218,LY 423,LI 370,LT 352,LU 853,MO 389,MK 261,MG 265,MW 60,MY 960,MV 223,ML 356,MT 692,MH 222,MR 230,MU 262,YT 52,MX 691,FM 373,MD 377,MC 976,MN 382,ME 212,MA 258,MZ 264,NA 674,NR 977,NP 31,NL 599,AN 687,NC 64,NZ 505,NI 227,NE 234,NG 683,NU 850,KP 47,NO 968,OM 92,PK 680,PW 507,PA 675,PG 595,PY 51,PE 63,PH 870,PN 48,PL 351,PT 1,PR 974,QA 40,RO 7,RU 250,RW 590,BL 685,WS 378,SM 239,ST 966,SA 221,SN 381,RS 248,SC 232,SL 65,SG 421,SK …
has comment: http://stackoverflow.com/comment/34740362

http://stackoverflow.com/comment/92269370
type: AnswerComment
type: Comment
has text: What happens to the lock if the holding process dies?
comment on: http://stackoverflow.com/a/24765278
score: 0

http://stackoverflow.com/q/22741606
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/34662213
tagged with: java
has comment: http://stackoverflow.com/comment/34662172
type: Question
has body: I was going through the tutorial by google and couldn't figure out how to place search icon on action bar. this is the main_activity_actions.xml code :- <item android:id="@+id/action_search" android:orderInCategory="100" android:icon="@drawable/ic_action_search" android:title="@string/action_search" android:showAsAction="always" /> <item android:id="@+id/action_settings" android:title="@string/action_settings" android:showAsAction="never" /> this is the MainActivity.java :- public class MainActivity extends ActionBarActivity { public final static String EXTRA_MESSAGE = "com.example.myfirstapp.MESSAGE"; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_display_message); getSupportActionBar().setDisplayHomeAsUpEnabled(true); if (savedInstanceState == null) { getSupportFragmentManager().beginTransaction() .add(R.id.container, new PlaceholderFragment()).commit(); } } @Override public boolean onCreateOptionsMenu(Menu menu) { MenuInflater inflater = getMenuInflater(); inflater.inflate(R.menu.main_activity_actions, menu); return true; } @Override public boolean onOptionsItemSelected(MenuItem item) { // Handle presses on the action bar items switch (item.getItemId()) { case R.id.action_search: openSearch(); return true; case R.id.action_settings: openSettings(); return true; default: 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; } } public void sendMessage(View view) { Intent intent = new Intent(this, DisplayMessageActivity.class); EditText editText = (EditText) findViewById(R.id.edit_message); String message = editText.getText().toString(); inten…
score: 0
linked to: http://stackoverflow.com/q/20084125
answer count: 1
has title: icon not displayed on actionbar
has comment: http://stackoverflow.com/comment/34662450
tagged with: http://stackoverflow.com/tag/xml
tagged with: android
has answer: http://stackoverflow.com/a/22741672
accepted answer: http://stackoverflow.com/a/22741672

http://stackoverflow.com/a/22729235
answers question: http://stackoverflow.com/q/22729216
upvote count: 1
has body: Make the inner calss static public class MyLinkedList{ protected Element head, tail; public static final class Element{ Object data; int priority; Element next; Element(Object obj, int priorit, Element element){ data = obj; priority = priorit; next = element; } } public static void main(String[]args){ MyLinkedList.Element e1 = new MyLinkedList.Element("any", 4, null); } }
has comment: http://stackoverflow.com/comment/34640458
type: Answer
downvote count: 0
score: 1

http://stackoverflow.com/a/22749781
has body: Start by reading through How to Use Scroll Panes There are at least two was to do this... First, by specifying the view component via the constructor... JScrollPane scrollPane = new JScrollPane(panel); Second, vie the setViewportView method... scrollPane.setViewportView(panel); Alternatively, you can set the JViewports view directly... scrollPane.getViewport().setView(panel); Make sure you are adding the scroll pane to the display...for example... JFrame frame = ... JPanel panel = ... frame.add(new JScollPsne(panel));
downvote count: 0
answers question: http://stackoverflow.com/q/22749647
has comment: http://stackoverflow.com/comment/34677411
has comment: http://stackoverflow.com/comment/34678107
type: Answer
score: 2
has comment: http://stackoverflow.com/comment/34677463
upvote count: 2
has comment: http://stackoverflow.com/comment/34678072

http://stackoverflow.com/comment/34687527
comment on: http://stackoverflow.com/q/22755484
has text: Post the full code. Otherwise its difficult to see
type: Comment
type: QuestionComment
score: 1

http://stackoverflow.com/a/22705145
type: AcceptedAnswer
downvote count: 0
score: 4
has body: As shown below: &lt;c:forEach var="entry" items="${map}"&gt; Key: &lt;c:out value="${entry.key}"/&gt; Value: &lt;c:out value="${entry.value}"/&gt; &lt;/c:forEach&gt; To get list value from the map using the key as below: ${map.department} And you can iterate over the list, as shown below: &lt;c:forEach items="${map.department}" var="element"&gt; &lt;tr&gt; &lt;td&gt;${element.deptName}&lt;/td&gt; &lt;/tr&gt; &lt;/c:forEach&gt;
type: Answer
has comment: http://stackoverflow.com/comment/34597309
accepted answer of: http://stackoverflow.com/q/22705107
answers question: http://stackoverflow.com/q/22705107
upvote count: 4

http://stackoverflow.com/comment/34713589
has text: @RajanMaurya Yes, just use `stock.fruit` in the other class.
type: AnswerComment
comment on: http://stackoverflow.com/a/22769966
type: Comment
score: 0

http://stackoverflow.com/comment/34741155
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/22785415
has text: Why don't you have a `Collection ` in your `Camera` instead (or a `List `)?

http://stackoverflow.com/comment/51944518
has text: Also duplicate of [Format date in java](http://stackoverflow.com/q/4772425/642706), and [Convert java.util.Date to String](http://stackoverflow.com/q/5683728/642706), and many others.
type: Comment
comment on: http://stackoverflow.com/q/22769882
type: QuestionComment
score: 0

http://stackoverflow.com/comment/34800363
type: Comment
type: QuestionComment
score: 0
comment on: http://stackoverflow.com/q/22794813
has text: You might split up your question into two topics. So far both answers are about the configuration part.

http://stackoverflow.com/comment/34601382
type: QuestionComment
has text: Try running with a `-X` flag to produce debug output. The output will be large, so pipe it to a file and look through the last past for any interesting stack traces and errors.
comment on: http://stackoverflow.com/q/22707510
score: 0
type: Comment

http://stackoverflow.com/comment/34498282
type: AnswerComment
comment on: http://stackoverflow.com/a/22649487
score: 0
type: Comment
has text: Hmmm the reason I went with a Looper is because I can choose to enqueue a task to the front of the queue. Is there a way I can do this with a ThreadPoolExecutor?

http://stackoverflow.com/q/22722085
has comment: http://stackoverflow.com/comment/34628479
has answer: http://stackoverflow.com/a/22727701
score: 0
has comment: http://stackoverflow.com/comment/34632543
has comment: http://stackoverflow.com/comment/34628254
type: UnansweredQuestion
linked to: http://stackoverflow.com/q/12361090
type: Question
tagged with: java
tagged with: ssl
has title: Hostname in certificate didn't match on wildcard cert
has body: This may be an apache/server configuration, or it might require a Java solution. On my server I have a few subdomains. I force https on all subdomains and I have a wildcard ssl certificate that is used for all subdomains. When I go to https://myapp1.myvendor.com and view the certificate in the browser I see the following common name: CN = *.myvendor.com I also have a Java program that posts to https://myapp1.myvendor.com/post.php however when I post from Java using: org.apache.http.client.methods.HttpPost httpPost = new HttpPost("https://myapp1.myvendor.com/post.php"); HttpResponse response = httpClient.execute(httpPost); I get the following error: javax.net.ssl.SSLException: hostname in certificate didn't match: &lt;myapp1.myvendor.com&gt; != &lt;myvendor.com&gt; OR &lt;myvendor.com&gt; OR &lt;www.myvendor.com&gt; What strikes me as odd is that it is trying to match myvendor.com or www.myvendor.com not *.myvendor.com. I do have a certificate installed for myvendor.com, but I stopped using it in favor of the wildcard cert. Any suggestions? Do you need more information? Apache Config: &lt;VirtualHost *:443&gt; SSLEngine On SSLCertificateFile /etc/pki/tls/certs/27c7d7842bf94d.crt SSLCertificateKeyFile /etc/pki/tls/private/mydomain.key SSLCACertificateFile /etc/pki/tls/certs/my_cert.crt ServerName myapp1.myvendor.com DocumentRoot /var/www/myvendor/myapp1/src/ ErrorLog /var/www/logs/myapp1/error.log CustomLog /var/www/logs/myapp1/access.log combined &lt;Directory /var/www/myvendor/myapp1/src/&gt; AllowOverride All &lt;/Directory&gt; &lt;/VirtualHost&gt; I also found this in a different config file that IS loaded: &lt;VirtualHost _default_:443&gt; SSLCertificateFile /etc/pki/tls/certs/local.crt SSLCertificateKeyFile /etc/pki/tls/private/local.key SSLCACertificateFile /etc/pki/tls/certs/my_local_cert.crt &lt;/VirtualHost&gt; I think it is getting this cert because this cert has: subject Alternative name: DNS Name=myvendor.com DNS Name=www.myvendor.com which matches the er…
tagged with: apache
answer count: 1

http://stackoverflow.com/comment/34550861
type: QuestionComment
comment on: http://stackoverflow.com/q/22679543
score: 0
has text: XSLT doesn't entertain Text to XML conversion. You can do the other way though(XML to Text).
type: Comment

http://stackoverflow.com/a/22765474
type: Answer
has comment: http://stackoverflow.com/comment/34706380
score: 3
downvote count: 0
answers question: http://stackoverflow.com/q/22765326
has comment: http://stackoverflow.com/comment/34705755
has comment: http://stackoverflow.com/comment/34705683
upvote count: 3
has comment: http://stackoverflow.com/comment/34706002
has body: You can use the following (simplified) Pattern: String input = "Gonzalez"; Pattern p = Pattern.compile("[aeiouy]", Pattern.CASE_INSENSITIVE); Matcher m = p.matcher(input); if (m.find()) { System.out.println(String.format("First vowel: %s", m.group())); } else { System.out.println("No vowels in input."); } Output First vowel: o Note This is a simplistic solution that won't work with accented vowels.
has comment: http://stackoverflow.com/comment/34706199
has comment: http://stackoverflow.com/comment/34705605

http://stackoverflow.com/comment/34635164
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/22726051
has text: Array l is half the length of array a, but you loop to the end of a. Hence l[I] is out of range halfway through.
score: 0

http://stackoverflow.com/comment/34641702
has text: but it is still on top
score: 0
comment on: http://stackoverflow.com/q/22729795
type: Comment
type: QuestionComment

http://stackoverflow.com/q/22680895
type: AnsweredQuestion
tagged with: webcam
has title: Javacv CanvasFrame not working as Executable Jar
type: Question
tagged with: java
has answer: http://stackoverflow.com/a/22808533
score: 0
has body: I am using java cv canvas frame in my program for face detection.The code is working fine when i am running it in eclipse.But the canvas frame is not loading when i am exporting the project as an executable jar file. What is the issue. Is there any configurations to be done?
tagged with: javacv
answer count: 1
accepted answer: http://stackoverflow.com/a/22808533

http://stackoverflow.com/comment/34533089
has text: His question isn't only about checked exceptions :)
type: AnswerComment
score: 0
type: Comment
comment on: http://stackoverflow.com/a/22669550

http://stackoverflow.com/a/22660644
score: 0
answers question: http://stackoverflow.com/q/22660096
type: Answer
has body: If you are using multi-part add method="post" enctype="multipart/form-data" in your html form http://www.w3schools.com/tags/att_form_enctype.asp

http://stackoverflow.com/comment/34591883
comment on: http://stackoverflow.com/q/22701694
has text: @XiJiaopin Add where in the list? Before the matching element, after it or to the end of the list?
score: 0
type: QuestionComment
type: Comment

http://stackoverflow.com/comment/80423975
has text: Can you think of a situation where, if you were allowed to name an inner lambda variable the same thing as the variable being initialized, it would lead to a runtime error?
comment on: http://stackoverflow.com/a/46399105
score: 0
type: AnswerComment
type: Comment

http://stackoverflow.com/a/22762735
has comment: http://stackoverflow.com/comment/34700696
answers question: http://stackoverflow.com/q/22762670
type: Answer
has comment: http://stackoverflow.com/comment/34702727
has body: try this... if (get_magic_quotes_gpc()) { $secret = stripslashes($_POST['secret']); } or use PHP latest version....
has comment: http://stackoverflow.com/comment/34731464
score: 0

http://stackoverflow.com/comment/34661982
has text: I wasn't aware that the actionCommand was set automatically without been called directly...
score: 0
type: Comment
comment on: http://stackoverflow.com/q/22740314
type: QuestionComment

ucanaccess
tag name: ucanaccess
tags question: http://stackoverflow.com/q/22693653
type: Tag

http://stackoverflow.com/q/22724970
accepted answer: http://stackoverflow.com/a/23282711
favorite count: 0
tagged with: service
type: Question
has comment: http://stackoverflow.com/comment/34634242
tagged with: android
has comment: http://stackoverflow.com/comment/34956251
has comment: http://stackoverflow.com/comment/34669094
has comment: http://stackoverflow.com/comment/34656896
tagged with: java
answer count: 3
has answer: http://stackoverflow.com/a/22759673
has comment: http://stackoverflow.com/comment/34648313
has comment: http://stackoverflow.com/comment/34893278
has answer: http://stackoverflow.com/a/22758803
upvote count: 1
tagged with: android-service
has answer: http://stackoverflow.com/a/23282711
has comment: http://stackoverflow.com/comment/34893146
possible better answer: http://stackoverflow.com/a/22758803
has body: I am trying to create a service which should log accelerometer values and timestamp on disk as fast as possible. It works fine as long as the Activity is present, but the problem is as soon as I quit the Activity which this service is coming with, the service stops. I put a toast in onCreate, onStartCommand and onDestroy, for first two, it works normally but it never shows anything on onDestroy so I am clue less what is the cause. I also put breakpoints in Android Studio on onDestroy but it does not fire too. Here is the complete code, please let me know what you think can be the problem: package com.embedonix.mobilehealth.services.accelerometerlog; import android.app.Service; import android.content.Context; import android.content.Intent; import android.hardware.Sensor; import android.hardware.SensorEvent; import android.hardware.SensorEventListener; import android.hardware.SensorManager; import android.os.Environment; import android.os.IBinder; import android.widget.Toast; import com.embedonix.mobilehealth.AppConstants; import java.io.File; import java.io.FileNotFoundException; import java.io.FileOutputStream; import java.io.IOException; import java.util.concurrent.ExecutorService; import java.util.concurrent.Executors; public class AccelerometerLogService extends Service { private boolean mIsServiceStarted = false; private Context mContext = null; private SensorManager mSensorManager = null; private Sensor mSensor; private File mLogFile = null; private FileOutputStream mFileStream = null; private AccelerometerLogService mReference = null; private Float[] mValues = null; private long mTimeStamp = 0; private ExecutorService mExecutor = null; /** * Default empty constructor needed by Android OS */ public AccelerometerLogService() { super(); } /** * Constructor which takes context as argument * * @param context */ public AccelerometerLogService(Context context) { super(); if (context != null) mContext = context; else mContext = getBaseContext(); } @Override public voi…
tagged with: ondestroy
has title: Android accelerometer logging service stops working and onDestroy is not being called
type: AnsweredQuestion
downvote count: 0
score: 1

http://stackoverflow.com/q/22680031
has title: Need help figuring out how to determine biggest and smallest count
has comment: http://stackoverflow.com/comment/34551399
has answer: http://stackoverflow.com/a/22697033
has comment: http://stackoverflow.com/comment/34574633
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/34574666
has comment: http://stackoverflow.com/comment/34597914
tagged with: java
has comment: http://stackoverflow.com/comment/34551558
type: Question
has comment: http://stackoverflow.com/comment/34597499
accepted answer: http://stackoverflow.com/a/22697033
has comment: http://stackoverflow.com/comment/34570812
answer count: 1
score: 0
has comment: http://stackoverflow.com/comment/34573953
has body: I need help trying to figure out how to answer the last 2 parts of this project I was given by coach at the local YMCA. I need to figure out what was the best and worst game of free throws shot by the team. I know the code is kinda clunky and I am sure there is a better way to write various methods to make it smoother, but i am new to Java and keep getting errors. Thanks. import java.util.Scanner; import java.util.Random; public class Final { public static void main(String[] args) { //Create input scanner for shooter percentage Scanner input = new Scanner(System.in); System.out.print("Enter Player's Free Throw Percentage: "); int percent = input.nextInt(); int inCount = 0; // game and total make/miss counts int outCount = 0; int Game1 = 0; int Game2 = 0; int Game3 = 0; int Game4 = 0; int Game5 = 0; // Game random num compared to user input percent and count for game and total System.out.println("Game 1:"); Random r = new Random(); for (int i = 0; i &lt; 10; ++i){ int randomInt = r.nextInt(100); if (percent &gt;= randomInt) { System.out.print("In" + " "); inCount++; Game1++; } if (percent &lt; randomInt) { System.out.print("Out" + " "); outCount++; } } System.out.println(); System.out.println("Free throws made: " + Game1 + " out of 10."); // Game random num compared to user input percent and count for game and total System.out.println(""); System.out.println("Game 2:"); Random r2 = new Random(); for (int i = 0; i &lt; 10; ++i){ int randomInt = r2.nextInt(100); if (percent &gt;= randomInt) { System.out.print("In" + " "); inCount++; Game2++; } if (percent &lt; randomInt) { System.out.print("Out" + " "); outCount++; } } System.out.println(); System.out.println("Free throws made: " + Game2 + " out of 10."); System.out.println(""); // Game random num compared to user input percent and count for game and total System.out.println(""); System.out.println("Game 3:"); Random r3 = new Random(); for (int i = 0; i &lt; 10; ++i){ int randomInt = r3.nextInt(100); if (percent &gt;= …
has comment: http://stackoverflow.com/comment/34551479
has comment: http://stackoverflow.com/comment/34551457

http://stackoverflow.com/a/22697447
has comment: http://stackoverflow.com/comment/34585634
upvote count: 1
type: AcceptedAnswer
has body: The Java Virtual Machine (JVM) is used to execute any Java program. However, all it does is execute the byte code in a Java binary, for example a Java archive (.jar) file. It does not include implementations of many of the Java EE libraries. A web application, typically deployed as a web archive (.war) file, usually requires libraries not provided by the JVM. In addition, the standard Java web application architecture means that the entry point for the application is not in the .war file - it is in the web application server, which then calls into the code provided in the .war file. The web application server, which includes full J2EE containers like Glassfish and also more limited web servers like Tomcat and Jetty, acts as an intermediate layer, running on a JVM and executing the web application provided in the .war file. Probably the best way to run your application on an IIS server is to set up the IIS server as the front end - so the client facing ports would be under IIS control - and set up the web server as a back end to which IIS forwards the relevant requests. The answers at the following question provide some links that may be useful: Deploy War File in Microsoft IIS 7
type: Answer
accepted answer of: http://stackoverflow.com/q/22695210
answers question: http://stackoverflow.com/q/22695210
downvote count: 0
score: 1

http://stackoverflow.com/a/22748279
type: Answer
upvote count: 1
accepted answer of: http://stackoverflow.com/q/22748243
answers question: http://stackoverflow.com/q/22748243
has body: Remove that png file (for now). Something might be corrupted in that file. Also, check your XML files, and ensure they are valid. Basically sounds like something is corrupt in your resources. Also, ensure you have tried 'Clean', then 'Build'
type: AcceptedAnswer
downvote count: 0
score: 1

http://stackoverflow.com/comment/50597633
has text: This won't work because InputFilter.filter() only accepts ints. [Found in docs](http://developer.android.com/reference/android/text/InputFilter.html)
type: AnswerComment
score: 3
type: Comment
comment on: http://stackoverflow.com/a/22708357

http://stackoverflow.com/a/22677939
upvote count: 6
score: 6
downvote count: 0
answers question: http://stackoverflow.com/q/22677467
has body: Methods have no state (except while a given method is running, of course), so none is saved between invocations &mdash; even for static methods.. Any static field saves its state for the duration of the JVM's execution (unless code changes its value, of course). JUnit uses one JVM for all of its tests, so, yes, static fields save state between tests. That's one of the biggest reason that people recommend not using static fields where it's possible to avoid them: it reduces the amount of global state you have to worry about, and thus makes it much easier to reason about tests.
type: Answer

http://stackoverflow.com/comment/34672933
type: Comment
comment on: http://stackoverflow.com/q/22747528
type: QuestionComment
has text: You have to actually create the individual ArrayList objects. The `new ArrayList[count]` operation only creates the array itself.
score: 0

http://stackoverflow.com/comment/34518064
score: 0
type: Comment
has text: Added notes regarding StringUtils.isNumeric
type: AnswerComment
comment on: http://stackoverflow.com/a/22661493

http://stackoverflow.com/comment/34620108
score: 0
has text: As far as I can tell my [paint](http://grepcode.com/file/repository.grepcode.com/java/root/jdk/openjdk/7u40-b43/javax/swing/tree/DefaultTreeCellRenderer.java#DefaultTreeCellRenderer.paint%28java.awt.Graphics%29) and [paintFocus](http://grepcode.com/file/repository.grepcode.com/java/root/jdk/openjdk/7u40-b43/javax/swing/tree/DefaultTreeCellRenderer.java#DefaultTreeCellRenderer.paintFocus%28java.awt.Graphics%2Cint%2Cint%2Cint%2Cint%2Cjava.awt.Color%29) implementation these are the two underline properties that controls focus drawing.
type: Comment
comment on: http://stackoverflow.com/a/22717328
type: AnswerComment

http://stackoverflow.com/q/22772109
tagged with: text
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/34718151
has body: I was curious if I could read a text file from my computer on an android phone using FileReader and Buffered Reader class. Is the text file loaded onto the android phone from my desktop when the application begins? This is the only relevant section of my code. I know the catch part is not there. public void TestSeizureDetected() throws FileNotFoundException { try { FileReader fr = new FileReader("C:/Users/desiyosh/Desktop/patient1.txt"); BufferedReader textReader = new BufferedReader(fr); String[] temp = new String[7681]; double[] convert = new double[7681]; for(int z= 0; z&lt;7861; z++) { temp[z] = textReader.readLine(); } textReader.close(); } }
score: 1
tagged with: java
upvote count: 1
type: Question
has comment: http://stackoverflow.com/comment/34718256
has answer: http://stackoverflow.com/a/22772327
tagged with: arrays
has comment: http://stackoverflow.com/comment/34718217
accepted answer: http://stackoverflow.com/a/22772327
has title: Text file onto Android Phone
answer count: 1
downvote count: 0
has comment: http://stackoverflow.com/comment/34718247
favorite count: 0
tagged with: android

http://stackoverflow.com/q/22689491
tagged with: timer
tagged with: android
has answer: http://stackoverflow.com/a/22690106
has body: My activity opens another activity after 10 seconds. I know how to open the another activity after some time. But what I want to do is also count every second so I can display it to the user. How can I do that? In my activity I have a textview on which I want to show the count down. public class RestingActivity extends Activity{ private Handler mHandler = new Handler(); @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_resting); mHandler.postDelayed(mLaunchTask, 10000); } public void skipRestTime(View view) { finish(); } private Runnable mLaunchTask = new Runnable() { public void run() { finish(); // Closing the activity } }; }
type: AnsweredQuestion
downvote count: 0
score: 1
tagged with: java
possible better answer: http://stackoverflow.com/a/22697335
type: Question
has answer: http://stackoverflow.com/a/22697335
has title: Show a countdown and change to another activity when countdown is over.
answer count: 2
upvote count: 1
accepted answer: http://stackoverflow.com/a/22690106
favorite count: 0

http://stackoverflow.com/comment/34715836
has text: try ` try { Thread.sleep(5000); } catch (InterruptedException e) { e.printStackTrace(); }`
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/22771005

http://stackoverflow.com/comment/34762882
type: AnswerComment
score: 0
type: Comment
comment on: http://stackoverflow.com/a/22786006
has text: Mean while you can check this below link which has sample code ( Look for second class in link given as PausableTask): http://handling-thread.blogspot.co.uk/2012/05/pause-and-resume-thread.html

http://stackoverflow.com/q/22697846
tagged with: swing
tagged with: mouse
has answer: http://stackoverflow.com/a/22698082
has title: How to check if and which mouse button is pressed in Swing
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/34590638
tagged with: java
tagged with: mouse-listeners
type: Question
has answer: http://stackoverflow.com/a/22698016
has answer: http://stackoverflow.com/a/22697923
accepted answer: http://stackoverflow.com/a/22697923
possible better answer: http://stackoverflow.com/a/22698016
score: 0
answer count: 3
has body: How can I check if currently any mouse button is pressed and if so, which one it is? The thing is that I need to use this kind of information in MouseListener.mouseEntered(). I checked MouseEvent but I could not find the method which would help me. The getButton() method seems to only return value if there has been change in buttons' state. Is there a way to find this out without manually keeping track of this somehow vie MouseListener.mousePressed()/mouseReleased() methods.
has comment: http://stackoverflow.com/comment/34583786

http://stackoverflow.com/q/22795053
upvote count: 1
type: Question
has comment: http://stackoverflow.com/comment/34758714
tagged with: graphics
has comment: http://stackoverflow.com/comment/34759039
has comment: http://stackoverflow.com/comment/34759770
has answer: http://stackoverflow.com/a/22795318
has comment: http://stackoverflow.com/comment/34759064
has body: I'm sorry if this sounds somewhat vague, but I am having trouble articulating exactly what it is in Java's Graphics Class that confounds me. What I am trying to do is simply draw a sequence of colored Strings. I have a method by which the Strings are parsed and ordered, but I cannot figure out how to convince Graphics to actually display the damn things once they're lined up. I understand there is a Graphics method drawString(), apparently designed to accomplish this very task, but nowhere can I find a reasonable explanation of how to implement it. It seems to require a Graphics object to operate upon, but I cannot see how I am to define such an object. Java does not allow Graphics objects to be initialized, it seems, and I cannot find any clear explanation of why that is or how to get around it. I have read numerous tutorials in which a very basic paint() method is used to demonstrate the functionality of drawString(), but every one I've encountered had the Strings hardcoded in and the method contained in a Graphics affiliated class, which will not serve my purposes. I cannot seem to even call the paint() method, at least not by any means I'm familiar with, and I have been unable to modify the parameters to accept, in addition to g, the variable Strings I wish to print. I'd be very grateful for any clarification of how to implement a Graphics object. I have spent the last two hours wrestling with this problem and would love to put it behind me. I'm getting a nullpointerexception at the setColor line. I have defined blue and red as colors earlier in the code. Canvas c = new Canvas(); Graphics g = c.getGraphics(); if (bool1) g.setColor(blue); else g.setColor(red); g.drawString(tval, x, y);
has comment: http://stackoverflow.com/comment/34758690
answer count: 1
favorite count: 0
score: -1
type: UnansweredQuestion
downvote count: 2
has title: Java Graphics Class Confusion
tagged with: java

http://stackoverflow.com/a/22799803
type: Answer
answers question: http://stackoverflow.com/q/22799785
downvote count: 0
has body: You can do it right in the original ArrayList: Pseudo-code: for(the next two elements) get the sum set the first element to the sum delete the second Code: for(int i = 0; i &lt; (list.size() - 1); i++) { int sum = list.get(i) + list.get(i + 1); list.set(i, sum); list.remove(i + 1); //i is incremented by ONE, because the element //after i was just deleted. }
score: 1
has comment: http://stackoverflow.com/comment/34767686
upvote count: 1

http://stackoverflow.com/comment/34625171
has text: :) Thanks a ton for the quick response !! I would like to show what i have done so far but there are around 10-12 classes. how can i send it to you??
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/22720537

http://stackoverflow.com/comment/34772254
comment on: http://stackoverflow.com/q/22802737
score: 0
type: Comment
type: QuestionComment
has text: I realize you've already developed this, but why write the logic in C++ and the GUI in Java? Why not just write the whole thing in Java, if you have to use Java for the GUI?

http://stackoverflow.com/a/22704276
has comment: http://stackoverflow.com/comment/34597861
upvote count: 2
type: AcceptedAnswer
has body: How to read from absolute location File file = new File("D:/FolderName/"); // Getting all files in directory File[] files = file.listFiles(); for (int i = 0; i &lt; files.length; i++) { System.out.println(files[i]); } // Reading a particular file BufferedReader reader = null; try { reader = new BufferedReader(new FileReader("D:/FolderName/testfile.xml")); String line = null; while(true) { line = reader.readLine(); if(line == null) break; System.out.println(line); } }catch(Exception e) { e.printStackTrace(); }finally { if(reader != null) { try { reader.close(); } catch (IOException e) { e.printStackTrace(); } } } How to read from root(web inf ) folder in web applications ServletContext sc = session.getServletContext(); URL url = ServletContext.getResource("/WEB-INF/testdata.xml") getResource("/WEB-INF/testdata.xml") gives you a URL getResourceAsStream gives you an input stream getRealPath gives you the path on disk of the relevant file. getServletContext().getRealPath("/WEB-INF/testdata.xml"); OR getServletContext().getResourceAsStream(...); OR context.getRealPath("/WEB-INF/testdata.xml");
type: Answer
accepted answer of: http://stackoverflow.com/q/22703950
answers question: http://stackoverflow.com/q/22703950
score: 2
downvote count: 0

http://stackoverflow.com/comment/34706928
has text: So... What have you tried?
type: QuestionComment
comment on: http://stackoverflow.com/q/22766117
score: 0
type: Comment

http://stackoverflow.com/a/22737885
accepted answer of: http://stackoverflow.com/q/22737789
type: Answer
answers question: http://stackoverflow.com/q/22737789
has body: I'm not entirely sure what you're trying to do, but this fixes your syntax errors. import java.util.ArrayList; import java.util.List; public class Foo { public static class Bar { public String sBar1, sBar2; public Bar(String sBar1, String sBar2) { this.sBar1 = sBar1; this.sBar2 = sBar2; } } String sFoo; List&lt;Bar&gt; bi; public Foo() { bi = new ArrayList&lt;&gt;(); } public Foo(String sFoo, List&lt;Bar&gt; bi) { this.sFoo = sFoo; this.bi = bi; } public final void runFooBar(String sFoo, Bar... barArgs) { this.sFoo = sFoo; for (Bar x : barArgs) { System.out.println(x.sBar1 + ":" + x.sBar2); } } public static void main(String[] args) { Foo fi = new Foo(); fi.runFooBar("foo 1", new Bar("1 sBar1", "1 sBar2"), new Bar("2 sBar1", "2 sBar2")); }//end main }//end class
downvote count: 0
has comment: http://stackoverflow.com/comment/34655887
has comment: http://stackoverflow.com/comment/34656061
score: 1
upvote count: 1
type: AcceptedAnswer

http://stackoverflow.com/comment/34711390
score: 0
type: Comment
type: QuestionComment
has text: What happens if you use version 3.8.2 of the android-maven-plugin?
comment on: http://stackoverflow.com/q/22768625

http://stackoverflow.com/q/22734962
tagged with: java
type: Question
tagged with: if-statement
tagged with: counter
has body: i need a counter that count +1 when clicks the button. I got this code, counter works fine, but only at the first click. After that, nothing count on click...pls help...thanks bSpravne.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { // TODO Auto-generated method stub a = tym.screen; b = nova.tcounter; if(a &lt;= b) { a++; } else { a =1; } nahodnyTym.setText("Hraje tým" + a); } });
score: 0
answer count: 1
tagged with: button
type: UnansweredQuestion
tagged with: count
has answer: http://stackoverflow.com/a/22735173
has title: counter if click the button +1

http://stackoverflow.com/q/22803142
type: UnansweredQuestion
tagged with: web-scraping
has answer: http://stackoverflow.com/a/22818402
has comment: http://stackoverflow.com/comment/34834414
tagged with: java
has title: Data Scraping using JSoup?
type: Question
score: 0
answer count: 2
tagged with: jsoup
has answer: http://stackoverflow.com/a/22806965
linked to: http://stackoverflow.com/q/22803854
has body: I want to get data from this web site with web scraping. http://www.upmandiparishad.in/commodityWiseAll.aspx I used JSoup before for more static HTML sites, but this one is difficult for me because before I get the HTML table on the site have to click one button and I don't know if it's possible to use JSoup to manipulate the button. After click this button I get a HTML table. So How can i achieve this? Thanks in advance

http://stackoverflow.com/q/22658215
has comment: http://stackoverflow.com/comment/34512596
tagged with: java
type: Question
downvote count: 0
has comment: http://stackoverflow.com/comment/34512700
has comment: http://stackoverflow.com/comment/34512618
tagged with: android
answer count: 1
has comment: http://stackoverflow.com/comment/34512533
has title: How to throw if element not found in android
favorite count: 0
upvote count: 2
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/34512997
has body: It's throwing UiObjectNotFoundException. public UiElement elementBy(UiSelector selector) throws UiObjectNotFoundException { return new UiElement(selector); }
has comment: http://stackoverflow.com/comment/34512637
score: 2
has answer: http://stackoverflow.com/a/22658659

http://stackoverflow.com/comment/34689334
type: QuestionComment
has text: Looks like 4 and 5 cannot be exactly represented like 7 can be..
comment on: http://stackoverflow.com/q/22756523
score: 0
type: Comment

http://stackoverflow.com/a/22767644
upvote count: 1
type: Answer
has body: I had the same issue, and it was because I passed the application context instead of the activity context. TableRow tr = new TableRow(getActivity()); TextView textview1 = new TextView(getActivity()); textview1.setText("unhappy"); tr.addView(textview1); TextView textview2 = new TextView(getActivity()); textview2.setText("happy"); tr.addView(textview2); also you should read trought this Android: How to track down the origin of a InflateException?
downvote count: 0
score: 1
answers question: http://stackoverflow.com/q/22767439

http://stackoverflow.com/comment/34800576
type: Comment
type: QuestionComment
has text: It would be usual debug of JBoss code that does jsp compilation, not debug of jsp code. I've added some links in the answer.
comment on: http://stackoverflow.com/q/22731864
score: 1

http://stackoverflow.com/a/75826540
type: Answer
answers question: http://stackoverflow.com/q/22663876
has body: How to install OpenCV on Linux in 2023 Install and build OpenCV # Install minimal prerequisites (Ubuntu 18.04 as reference) sudo apt update && sudo apt install -y cmake g++ wget unzip # Download and unpack sources wget -O opencv.zip https://github.com/opencv/opencv/archive/4.x.zip wget -O opencv_contrib.zip https://github.com/opencv/opencv_contrib/archive/4.x.zip unzip opencv.zip unzip opencv_contrib.zip # Create build directory and switch into it mkdir -p build && cd build # Configure cmake -DOPENCV_EXTRA_MODULES_PATH=../opencv_contrib-4.x/modules ../opencv-4.x # Build cmake --build . # Install sudo make install By default OpenCV will be installed to the /usr/local directory. ➤ tree /usr/local/share/java/opencv4 /usr/local/share/java/opencv4 ├── libopencv_java470.so └── opencv-470.jar 0 directories, 2 files So now you can use java bindings that you built or add maven pom.xml dependency. It's better to match versions, 4.7.0 and 4.7.0, but in my case version in maven repo was behind org.openpnp opencv 4.6.0-0 Run java with environment parameter LD_LIBRARY_PATH LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/local/share/java/opencv4/ and load OpenCV from Java with System.loadLibrary("opencv_java470"); // If bindings version match use System.loadLibrary(Core.NATIVE_LIBRARY_NAME);
score: 0

http://stackoverflow.com/comment/74579073
type: Comment
type: QuestionComment
score: 0
has text: @opeongo actually that was a long time ago and i remember the the problem did solve somehow. I'm not sure but i think i solved it with headless chrome
comment on: http://stackoverflow.com/q/22730227

http://stackoverflow.com/comment/34497093
type: Comment
comment on: http://stackoverflow.com/q/22649228
score: 2
has text: Take a look at [INSERT...ON DUPLICATE](https://dev.mysql.com/doc/refman/5.6/en/insert-on-duplicate.html)
type: QuestionComment

http://stackoverflow.com/a/41576491
type: Answer
answers question: http://stackoverflow.com/q/22671927
downvote count: 0
has body: Current Gradle versions use Gradle daemon by default. What actually happens is that after you press Ctrl+C (I think you meant it instead of Ctrl+Z) you don't just terminate your application, you terminate the whole Gradle process. It takes about 10 seconds. Shutdown hooks are executed, but with a delay, and as Gradle is disconnected from console output, you won't see any messages. Currently the simplest workaround is to add --no-daemon switch. There is an enhancement proposed to Gradle to fix this behaviour. You can vote for it: https://github.com/gradle/gradle/issues/1128
score: 3
upvote count: 3

http://stackoverflow.com/comment/34503946
score: 0
comment on: http://stackoverflow.com/q/22653181
has text: It's actually *not* in fact the same. It's distinctly different.
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/34602886
has text: If you imported the project with maven and if your maven project does not have anything special configured for the resources then whatever you have in the **/src/man/resources/** folder will be copied to your **/target/classes** folder.
comment on: http://stackoverflow.com/a/22708287
type: AnswerComment
score: 0
type: Comment

http://stackoverflow.com/a/22656270
answers question: http://stackoverflow.com/q/22650528
has body: As said in the GATE manual you can edit any of the existing lists in a text editor. Probably the most straight-forward way is to create these lists programatically. I.e. if you have them in a database, dump records in the gazetteer format (basically one word per line). If you have them in a csv or a web page, export them to the right format. Another option is to use a more advanced gazetteer which uses an ontology or semantic repository. See the manual link above for different gazetteers and how to work with them.
score: 2
downvote count: 0
type: AcceptedAnswer
upvote count: 2
type: Answer
accepted answer of: http://stackoverflow.com/q/22650528

http://stackoverflow.com/comment/34643614
type: Comment
comment on: http://stackoverflow.com/q/22731018
type: QuestionComment
has text: Are your images different sizes?
score: 0

http://stackoverflow.com/comment/34497278
score: 0
type: Comment
comment on: http://stackoverflow.com/a/22648870
has text: That response should be part of the answer.
type: AnswerComment

http://stackoverflow.com/comment/34795912
comment on: http://stackoverflow.com/a/22796629
has text: Yes, with java.lang.System.getProperty("java.io.tmpdir") the result is the same. A response doc is created with an empty .txt file.
type: AnswerComment
score: 0
type: Comment

http://stackoverflow.com/a/22796448
type: Answer
answers question: http://stackoverflow.com/q/22795986
has body: Try adding a @FXML tag before the method just as you did with the instance variables of the controller.
has comment: http://stackoverflow.com/comment/34761324
score: 0

http://stackoverflow.com/a/22682589
upvote count: 4
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/34556548
downvote count: 0
has comment: http://stackoverflow.com/comment/34556238
has comment: http://stackoverflow.com/comment/34556038
answers question: http://stackoverflow.com/q/22682016
has comment: http://stackoverflow.com/comment/34556359
type: Answer
has comment: http://stackoverflow.com/comment/34556169
has body: Using StringBuilder is a good idea when concatenating in a loop, as it will have better performances than the simple String concatenation. Here is a sample code as how to do it, using StringBuilder and modulo operation to check how many elements you want in the result: final int nbElems = 5; List&lt;String&gt; test = new ArrayList&lt;String&gt;(Arrays.asList("a,b,c,d,e,f,g,h,i,j".split(","))); StringBuilder sb = null; for (int i=0; i&lt;test.size(); i++) { if (i%nbElems==0) sb = new StringBuilder("\""); else sb.append("\" OR \""); sb.append(test.get(i)); if (i%nbElems==(nbElems-1) || i==(test.size()-1)) { sb.append("\""); final String result = sb.toString(); System.out.println(result); // TODO: do something } } Output: "a" OR "b" OR "c" OR "d" OR "e" "f" OR "g" OR "h" OR "i" OR "j"
has comment: http://stackoverflow.com/comment/34556149
accepted answer of: http://stackoverflow.com/q/22682016
score: 4

http://stackoverflow.com/q/22682404
tagged with: apk
linked to: http://stackoverflow.com/q/22677957
type: AnsweredQuestion
tagged with: installation
has comment: http://stackoverflow.com/comment/34555871
has title: Android java app installation under the hood
tagged with: java
accepted answer: http://stackoverflow.com/a/22732658
type: Question
has body: I am trying to understand what exactly is going on when you install an application (APK) on an Android device. I guess that files are are extracted from the package and copied somewhere on the device. Are there other steps going on? For example, is the package name of the application written somewhere in the OS like in somekind of registry? Is the application version number written as well somewhere or the OS reads the xml manifest of the application to know its installed version? This is related to another question where I suspect that some data was not erased correctly during the uninstallation of a debug app and I am trying to find what that might be.
score: 4
upvote count: 4
answer count: 1
downvote count: 0
favorite count: 0
has answer: http://stackoverflow.com/a/22732658
tagged with: package
has comment: http://stackoverflow.com/comment/34555524
tagged with: android

http://stackoverflow.com/comment/34728350
comment on: http://stackoverflow.com/a/22771807
score: 0
type: AnswerComment
type: Comment
has text: So why do I need to clear it when all of it can just be overwritten? Would not that be more resource saving? Or would not? Answer requested. Thanks.

filesystemwatcher
type: Tag
tags question: http://stackoverflow.com/q/22742528
tag name: filesystemwatcher

http://stackoverflow.com/q/22653388
tagged with: stored-procedures
tagged with: java
tagged with: hibernate
has title: Execute a stored procedure and get single out parameter in Hibernate
has answer: http://stackoverflow.com/a/22653643
answer count: 2
downvote count: 0
tagged with: jpa-2.0
favorite count: 0
tagged with: sql-server
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/36916216
score: 2
has body: Suppose I have a simple MS SQL Server procedure that takes 2 int arguments and returns the sum CREATE PROC add_them @param1 int, @param2 int, @result int OUTPUT AS BEGIN SET @result = @param1 + @param2; END Can I call this procedure from Hibernate (version 4.3.1)? So far I used a session.createSQLQuery("exec add_them :param1, :param2") approach setting the params later on and executing it with query.list().. But this doesn't work, since the procedure doesn't return a set, but a single out value. So, can I call this procedure?
upvote count: 2
type: Question

http://stackoverflow.com/a/22713250
accepted answer of: http://stackoverflow.com/q/22712836
has body: My gremlin-java/pipeline isn't as good as my gremlin-groovy, but one problem I see is that you aren't dealing with vertex equality properly in Java. This part: &amp;&amp; bundle.getObject() != v2 is valid for Groovy, but in Java I would write it as: &amp;&amp; !bundle.getObject().equals(v2)
upvote count: 2
score: 2
has comment: http://stackoverflow.com/comment/34613060
type: AcceptedAnswer
downvote count: 0
answers question: http://stackoverflow.com/q/22712836
type: Answer
has comment: http://stackoverflow.com/comment/34613454

http://stackoverflow.com/comment/34580916
comment on: http://stackoverflow.com/a/22695968
has text: I'm not sure how your consumer isn't stopped while the failure is occurring, since your Connection is invalid when the tcp connection is dropped. When you reconnect after the failure, call recover.
type: Comment
score: 0
type: AnswerComment

http://stackoverflow.com/q/22779872
has body: I'm having a problem with CAS. After a successful login CAS is redirecting me to an URL that includes the CAS ticket. This ticket is causing some problems when trying to manipulate the URL to access other entry points. So, the steps are: I navigate to the main URL of the app, and I'm redirected to the CAS login page I log in successfully I'm redirected back to the main URL The main URL includes the ticket http://.../.../secure/index?url=account/22222222&amp;ticket=ST-8543-0lfLCbblbF9Z1Nk7ATUA-udcsg1ab Any ideas about how to remove the ticket from the main URL after being redirected?
type: UnansweredQuestion
tagged with: spring
tagged with: java
type: Question
tagged with: jakarta-ee
has title: Remove CAS ticket from URL
answer count: 1
tagged with: spring-security
score: 0
tagged with: cas
has answer: http://stackoverflow.com/a/23001198

http://stackoverflow.com/comment/34562216
type: Comment
has text: The string I am using is a canonical path of file like (/x/home/rrs/data0). Maximum length wont be more than 1024 chars.
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/22686387

http://stackoverflow.com/comment/34764495
has text: @2rs2ts: It has nothing to do with the implementation of `BigDecimal` - that is just used to demonstrate the issue. The problem is `83.65` cannot be exactly stored into a floating-point value.
score: 1
comment on: http://stackoverflow.com/q/22797964
type: Comment
type: QuestionComment

http://stackoverflow.com/a/22753260
has comment: http://stackoverflow.com/comment/34709995
has comment: http://stackoverflow.com/comment/34705484
answers question: http://stackoverflow.com/q/22749110
score: 1
has body: This is a difficult question to answer, because the requirements are not properly stated. For example the first bunch of pseudo-code does not make it clear whether A is a set, a multi-set or a list. The notation (use of curly brackets, and U (union?)) seems to say set ... but the output seems to be a list. Or maybe it is supposed to be a schema for a data structure?? And even the inputs are not clearly described. But putting that on one side, there is still room for some (hopefully) helpful advice. Make sure that >>you&lt;&lt; understand the requirements. (I imagine that the real requirements for the assignment are better stated than this, and the details have been "lost in translation".) I would actually use an array list (or a StringBuilder) rather than a linked list for this. (But a properly implemented linked list ... implementing the List API ... would work.) But whatever data structure you chose, there is no point in implementing it from scratch ... unless you are specifically required to do that. There are perfectly good list classes in the Java standard libraries. You should reuse them ... rather than attempting to reinvent the wheel (and doing a bad job). If you are required to implement your own data structure type, then your current attempt is a mess. It looks like a hybrid between an array list and a linked list ... and doesn't succeed in being either. (For example, a decent array list implementation does not need a MAX_LIST, and doesn't have next pointers / indexes. And a linked list does not have any arrays inside it.)
has comment: http://stackoverflow.com/comment/34708083
accepted answer of: http://stackoverflow.com/q/22749110
upvote count: 1
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/34696689
type: Answer
downvote count: 0

http://stackoverflow.com/q/22794243
tagged with: java
has answer: http://stackoverflow.com/a/22794937
type: Question
answer count: 2
tagged with: android
has answer: http://stackoverflow.com/a/25241284
has title: Bitmap quality bad after sending (Android/Java)
type: UnansweredQuestion
has body: I'm getting a Bitmap with: View v1 = (View) wpm.getParent().getParent(); Bitmap cs = null; v1.setDrawingCacheEnabled(true); v1.buildDrawingCache(true); cs = Bitmap.createBitmap(v1.getDrawingCache(true)); Canvas canvas = new Canvas(cs); v1.draw(canvas); canvas.save(); v1.setDrawingCacheEnabled(false); String path = Images.Media.insertImage(getContext().getContentResolver(), cs, "MyImage", null); Uri file = Uri.parse(path); OutputStream outStream = null; try { outStream = getContext().getContentResolver().openOutputStream(file); } catch (FileNotFoundException e) { // TODO Auto-generated catch block e.printStackTrace(); } cs.compress(Bitmap.CompressFormat.JPEG, 100, outStream); //file senden Intent sharingIntent = new Intent(Intent.ACTION_SEND); sharingIntent.putExtra(Intent.EXTRA_STREAM, file); sharingIntent.setType("image/jpeg"); getContext().startActivity(Intent.createChooser(sharingIntent,"Erfolg teilen!")); When I send it via Facebook, Whatsapp,... the Quality is very bad. But if I copy it to my PC it looks normally and before I send it via Facebook I can check how it will look and there it looks normally too. Only after sending it it looks bad. How can I change this?
score: 0
tagged with: bitmap

http://stackoverflow.com/comment/34507318
comment on: http://stackoverflow.com/q/22655153
has text: i write in in c++ and now trying to transform it co java. I thought it is a normal thing to check string.
score: 0
type: Comment
type: QuestionComment

imagej
tags question: http://stackoverflow.com/q/22721666
type: Tag
tags question: http://stackoverflow.com/q/22658165
tag name: imagej

http://stackoverflow.com/q/22798216
score: 1
tagged with: java
upvote count: 1
has body: Sorry guys I know there is a lot of info on this topic, but I'm still stuck. I have two panels mainPanel and sidePanel. What I'm trying to do is paint an Image to the sidePanel. My sidePanel will have other components such as buttons and labels. I can add the Image to the sidePanel using a JLabel, however, sizing and positioning the image is a problem. Therefor, I'm experimenting with Graphics g to paint the Image onto the sidePanel instead. If anyone could help much would be appreciated. Thanks all that help.` import java.awt.BorderLayout; import java.awt.Color; import java.awt.Dimension; import java.awt.Graphics; import java.awt.Image; import javax.swing.ImageIcon; import javax.swing.JFrame; import javax.swing.JLabel; import javax.swing.JPanel; public class Gui extends JFrame { private JPanel j; private ImageIcon i; public Gui(){ this.setSize(800,600); this.setUp(); this.setVisible(true); this.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); } void setUp(){ j = new JPanel(); JPanel contentPanel = new JPanel(); contentPanel.setLayout(new BorderLayout()); contentPanel.setSize(new Dimension(800,600)); JPanel mainPanel = new JPanel(); JPanel sidePanel = new JPanel(); sidePanel.setPreferredSize(new Dimension(200,600)); mainPanel.setPreferredSize(new Dimension(600,600)); ImagePanel v = new ImagePanel(); //v.setBackground(Color.BLUE); v.setPreferredSize(new Dimension(100,100)); sidePanel.add(v); mainPanel.setBackground(Color.BLACK); sidePanel.setBackground(Color.RED); contentPanel.add(sidePanel, BorderLayout.WEST); contentPanel.add(mainPanel, BorderLayout.CENTER); this.add(contentPanel); } private class ImagePanel extends JPanel{ public void createImage(Graphics g){ super.paintComponent(g); ImageIcon i = new ImageIcon("/GUI Practice/src/images.jpeg"); Image ii = i.getImage(); g.drawImage(ii, 10, 10, 90, 90, Color.WHITE, this); repaint(); validate(); updateUI(); } } public static void main(String [] args){ Gui g = new Gui(); } } `
type: Question
tagged with: jpanel
has comment: http://stackoverflow.com/comment/34764637
tagged with: image
has title: Trying to paint an Image onto a JPanel
answer count: 1
downvote count: 0
favorite count: 0
has comment: http://stackoverflow.com/comment/34764821
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/22798413
linked to: http://stackoverflow.com/q/299495

http://stackoverflow.com/comment/34731488
has text: This is, unfortunately for you, not a *steering* community. What is possible depends on your own skill set. I think the spring reference documentation is the best place to start. http://projects.spring.io/spring-framework/
score: 0
comment on: http://stackoverflow.com/q/22779755
type: Comment
type: QuestionComment

http://stackoverflow.com/a/22687854
score: 0
has body: I like to offer you a different approach: Since there are only 52 (53) distinct cards (if you try to implement poker) build an enum like that: enum Card { SA, S1, S2, ..., SK, HA, H1, ... ) If you like to get fancy use other enums for color / value: enum CardColor { SPADE, HEART, ... } enum CardValue { ACE, TWO, ..., QUEEN, HEART } and put it in Card: enum Card { SA( Spade, ACE ), S2( Spade, TWO ) ... CardColor color, CardValue value public Card( CardColor color, CardValue value ){ this.color = color; this.value = value; } } From there on you can easily use EnumSet to manage them or put them into Lists and so on.
type: Answer
answers question: http://stackoverflow.com/q/22687504

http://stackoverflow.com/a/22773485
type: Answer
has comment: http://stackoverflow.com/comment/34720227
score: 0
has comment: http://stackoverflow.com/comment/34720412
has body: Well, I'm not sure if this is the best solution, but if all your input in the JSON is like "Trials n" then this could work out: for(JSONobject o: myArrayOfJSONs) { int n = 0; boolean finished = false; while(!finished) { if (!o.isNULL("Trial "+ n) { //do some stuff n++; } else { finished = true; } } }
answers question: http://stackoverflow.com/q/22773232

http://stackoverflow.com/a/22784258
score: 1
upvote count: 1
downvote count: 0
answers question: http://stackoverflow.com/q/22783879
has body: In your servlet add the below line. As I commented I think its a problem with web.xml. If you are using servlet 3.0 you can use the below ammotation or map in web.xml. @WebServlet("/Connecter") public class Connecter extends HttpServlet
type: Answer

http://stackoverflow.com/a/22718980
type: Answer
has comment: http://stackoverflow.com/comment/34622432
downvote count: 0
has comment: http://stackoverflow.com/comment/34623888
has comment: http://stackoverflow.com/comment/34622640
score: 3
accepted answer of: http://stackoverflow.com/q/22718898
upvote count: 3
has body: you can replace the employee with null whenever want to delete it. when inserting a new emplyee, you can first look at a null index and place it. private void deleteEmployee(){ Scanner scan = new Scanner(System.in); System.out.println("Enter the first name of the employee you want to delete from the list") String name = scan.nextLine(); for (int i = 0; i &lt; employees.length; i++) { if (employee[i] != null &amp;&amp; employees[i].getFirstName().equals(name)){ employees[i] = null; break; } if (i == employees.length - 1) { System.out.println("That requested person is not employed at this firm.") } }
answers question: http://stackoverflow.com/q/22718898
has comment: http://stackoverflow.com/comment/34631005
type: AcceptedAnswer

logging
tags question: http://stackoverflow.com/q/22727398
tags question: http://stackoverflow.com/q/22648305
tags question: http://stackoverflow.com/q/22734767
tag name: logging
tags question: http://stackoverflow.com/q/22687672
tags question: http://stackoverflow.com/q/22720865
tags question: http://stackoverflow.com/q/22762397
tags question: http://stackoverflow.com/q/22670196
tags question: http://stackoverflow.com/q/22692097
tags question: http://stackoverflow.com/q/22670627
tags question: http://stackoverflow.com/q/22732247
tags question: http://stackoverflow.com/q/22794414
tags question: http://stackoverflow.com/q/22713793
tags question: http://stackoverflow.com/q/22681389
tags question: http://stackoverflow.com/q/22656508
tags question: http://stackoverflow.com/q/22669343
tags question: http://stackoverflow.com/q/22689831
type: Tag

http://stackoverflow.com/q/22684758
tagged with: java
type: Question
has answer: http://stackoverflow.com/a/22684828
has title: How to assign a minimum value for parameters in a constructor (java)?
score: 0
has answer: http://stackoverflow.com/a/22684820
has comment: http://stackoverflow.com/comment/34559523
has answer: http://stackoverflow.com/a/22685143
tagged with: constructor
has answer: http://stackoverflow.com/a/22685059
answer count: 5
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/34559490
tagged with: parameters
has answer: http://stackoverflow.com/a/22685005
has body: For instance, I have a constructor: public Employee(int age, String name){ } Which command should I write in the constructor that it doesn't allow to create an employee object with the age parameter less than 21? I am not allowed to use exceptions. Thank you

http://stackoverflow.com/q/22676024
type: Question
tagged with: jtextarea
score: 0
has body: I am trying to do a small app that compares two similar texts contained in 2 JTextarea. I am wondering if it's possible to select text from the first JTextarea and automatically select the text on the second JTeaxtarea (lets consider that it's guarantee that the 2 JTextarea will have the same text for now) ? Should I share events or listeners ? Thank you
answer count: 1
tagged with: events
has title: Select text in 2 JTextarea at the same time
has answer: http://stackoverflow.com/a/22676432
accepted answer: http://stackoverflow.com/a/22676432
has comment: http://stackoverflow.com/comment/34545253
has comment: http://stackoverflow.com/comment/34545286
tagged with: swing
type: AnsweredQuestion
tagged with: java

http://stackoverflow.com/comment/34618116
has text: but I still have the same problem in the out.txt,I can't see any message inside
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/22716293

http://stackoverflow.com/a/22702196
has comment: http://stackoverflow.com/comment/34683831
has comment: http://stackoverflow.com/comment/34592354
accepted answer of: http://stackoverflow.com/q/22702173
has comment: http://stackoverflow.com/comment/34593554
type: Answer
has comment: http://stackoverflow.com/comment/34595785
score: 2
has comment: http://stackoverflow.com/comment/34592454
upvote count: 2
has comment: http://stackoverflow.com/comment/34619590
has comment: http://stackoverflow.com/comment/34623814
has body: operands and operators is an array to print array you can do System.out.println(Arrays.toString(operands)); System.out.println(Arrays.toString(operators)); And you should split it like this: String[] operands = expression.split("[\\+\\-\\*\\%\\/]"); String[] operators = expression.split("[0-9]+");
has comment: http://stackoverflow.com/comment/34592502
answers question: http://stackoverflow.com/q/22702173
has comment: http://stackoverflow.com/comment/34592588
has comment: http://stackoverflow.com/comment/34596155
type: AcceptedAnswer
downvote count: 0

http://stackoverflow.com/a/22743558
type: Answer
has comment: http://stackoverflow.com/comment/34670300
score: 2
upvote count: 2
has comment: http://stackoverflow.com/comment/34670544
has comment: http://stackoverflow.com/comment/34667071
has comment: http://stackoverflow.com/comment/34665925
has comment: http://stackoverflow.com/comment/34670391
has comment: http://stackoverflow.com/comment/34670444
has comment: http://stackoverflow.com/comment/34672549
has comment: http://stackoverflow.com/comment/34666496
downvote count: 0
has comment: http://stackoverflow.com/comment/34666321
has body: Use executeUpdate instead as it returns an int row count. UPDATE 1: According to the MySQL INSERT ... ON DUPLICATE KEY UPDATE documentation: With ON DUPLICATE KEY UPDATE, the affected-rows value per row is 1 if the row is inserted as a new row, and 2 if an existing row is updated. UPDATE 2: INSERT IGNORE may also be an option: INSERT IGNORE INTO `table`(`field1`) VALUES (?) executeUpdate should return 1 when a new row is inserted and 0 when there is a duplicate.
answers question: http://stackoverflow.com/q/22743497

http://stackoverflow.com/q/22666847
has body: I have deployed 2 web application in java on GlassFish server. I am using Glassfish Server 3.1.2.2. They both have java servlet pages from where they receive http requests, also the code is identical, only different parameters (for different clients). The first works well and the other process the http request very long. After that i noticed the next thing: I am constantly getting this warning in the Glassfish output in Netbeans. WARNING: GRIZZLY0023: Interrupting idle Thread: http-thread-pool-9990 Can anyone explain me why i get this warning, and how to solve it.
upvote count: 11
possible better answer: http://stackoverflow.com/a/23561078
tagged with: grizzly
has answer: http://stackoverflow.com/a/23561078
tagged with: java
tagged with: http
has answer: http://stackoverflow.com/a/26670600
has answer: http://stackoverflow.com/a/22668125
tagged with: warnings
has title: GRIZZLY0023 Glassfish warning
tagged with: glassfish
score: 11
answer count: 4
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/26369813
downvote count: 0
favorite count: 0
accepted answer: http://stackoverflow.com/a/22668125
type: Question

http://stackoverflow.com/q/22695739
has comment: http://stackoverflow.com/comment/34579565
type: Question
has answer: http://stackoverflow.com/a/22695810
has body: As the title tells,I have to write a method to say true if 2 string keys in a map do not have same string values and false otherwise.I have written the following method.However, it returns true in all cases.A suggestion here will help. public static boolean isUnique(Map&lt;String,String&gt; map) { Iterator&lt;String&gt; iter=map.keySet().iterator(); while(iter.hasNext()) { String s=iter.next(); if(map.containsValue(s)) return false; } return true; } Thanks in advance
score: 0
answer count: 1
type: UnansweredQuestion
has title: Keys mapping to same values in HashMap?
tagged with: java

http://stackoverflow.com/comment/34698366
has text: Just changed test case to no of task =1000000 and each task will loop 1000000 with operation (int a=10/10.) Totally surprised with results. Serially it took=689Sec and using executor service(8 core) it took just 185 Sec and CPU usage were almost 95%. Clearly it shows multi Thread approach were best. Does it mean if operation is linear in time multicore always perform well than serial.? What lesson should i take from these test cases.
type: Comment
score: 0
comment on: http://stackoverflow.com/a/22655515
type: AnswerComment

http://stackoverflow.com/a/22723898
upvote count: 1
type: AcceptedAnswer
answers question: http://stackoverflow.com/q/22720966
type: Answer
accepted answer of: http://stackoverflow.com/q/22720966
has comment: http://stackoverflow.com/comment/34631648
downvote count: 0
has body: Change the line where you parse the JSON, use this: List&lt;PdvResult&gt; pdvs = gson.fromJson(reader, new TypeToken&lt;List&lt;PdvResult&gt;&gt;() {}.getType()); You are using TypeToken&lt;PdvResult&gt;, and you have to use TypeToken&lt;List&lt;PdvResult&gt;&gt;, otherwise you're trying to parse your JSON into a PdvResult object, while you actually have an array of PdvResult objects!
score: 1
has comment: http://stackoverflow.com/comment/34642039
has comment: http://stackoverflow.com/comment/34632738

http://stackoverflow.com/comment/34747915
type: Comment
has text: I meant to write the content of the zip file, in your case the content of the file you want to zip will be an entry.
comment on: http://stackoverflow.com/a/22789124
type: AnswerComment
score: 0

http://stackoverflow.com/comment/34649022
comment on: http://stackoverflow.com/a/22733544
score: 0
type: AnswerComment
type: Comment
has text: Yes, i created. public class Ball { Random random = new Random(); private Point location; private int radius; private Color[] colors={Color.red,Color.blue,Color.yellow}; private int colorNumber=random.nextInt(colors.length); Color c = colors[colorNumber]; but it gives error at g.setColor public void paint (Graphics g) { g.setColor(colors);

http://stackoverflow.com/comment/34610284
has text: It is hard to read all code , please show important thing you think
comment on: http://stackoverflow.com/q/22712404
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/q/22658461
tagged with: amazon-ec2
answer count: 1
linked to: http://stackoverflow.com/q/4157303
tagged with: amazon-web-services
tagged with: jsch
score: 0
tagged with: linux
type: UnansweredQuestion
has body: I need to SCP a video file from my local machine to a EC2 cloud server using a Java program. I am using the JSCH library to do so. So far I can connect to the EC2 server and can run basic commands on it. Following is the code: import com.jcraft.jsch.*; import java.io.*; import java.io.IOException; public class EC2 { public static void main(String[] args) throws JSchException, IOException, InterruptedException { JSch jsch=new JSch(); jsch.addIdentity("yyyy.pem"); jsch.setConfig("StrictHostKeyChecking", "no"); //enter your own EC2 instance IP here Session session=jsch.getSession("ec2-user", "xx.xxx.xxx.xxx", 22); session.connect(); //run stuff String command = "whoami;hostname"; Channel channel = session.openChannel("exec"); ((ChannelExec) channel).setCommand(command); ((ChannelExec) channel).setErrStream(System.err); channel.connect(); InputStream input = channel.getInputStream(); //start reading the input from the executed commands on the shell byte[] tmp = new byte[1024]; while (true) { while (input.available() &gt; 0) { int i = input.read(tmp, 0, 1024); if (i &lt; 0) break; System.out.println(new String(tmp, 0, i)); } if (channel.isClosed()) { System.out.println("exit-status: " + channel.getExitStatus()); break; } Thread.sleep(1000); } channel.disconnect(); session.disconnect(); } } Now I am aware of the SCP syntax for file transfer . But the thing here is that every command that I now here will be run the EC2 server For eg: String command = "ls -l"; Will give me the home file list in the EC2. So how do I transfer the video stored on my laptop the home/ec2-user directory of the EC2 ?
has answer: http://stackoverflow.com/a/22664980
type: Question
tagged with: java
has title: Copy video from my own machine to EC2 server by running scp command (JSCH)

http://stackoverflow.com/comment/34672349
has text: Surely the source code (etc.) is in your source control system? You shouldn't need to "open" the Jar itself.
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/22747231
score: 1

class-variables
tag name: class-variables
tags question: http://stackoverflow.com/q/22729216
type: Tag
tags question: http://stackoverflow.com/q/22739281

http://stackoverflow.com/comment/34737384
type: Comment
type: QuestionComment
score: 0
comment on: http://stackoverflow.com/q/22783153
has text: She seems to be talking about 'mutable' data structures (as opposed to immutable ones). Or possibly resizable structures (arrays are not resizable but are always mutable - unless 0-length; `List` is resizeable, and may or may not be mutable, depending on the implementation - have a look at `Collections.unmodifiableList()` for example). 'Mutable' means most data structures in Java, since Java (historically) favours mutability (unlike, say, Clojure). Try reading up on `Set` and `Map` and some of their implementations (e.g. `TreeSet`, `HashMap`).

http://stackoverflow.com/comment/34748839
comment on: http://stackoverflow.com/q/22789734
score: 0
has text: Print out the value of `i`
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/34563396
type: QuestionComment
comment on: http://stackoverflow.com/q/22687028
has text: Imagine the inputs are Tom Walton the result should be TW. But it ends up being 171.
score: 0
type: Comment

http://stackoverflow.com/comment/34539226
comment on: http://stackoverflow.com/a/22660265
type: AnswerComment
score: 0
type: Comment
has text: I'm saying you can spend too much time worrying about casts and warnings for generics and not enough worrying about the 10 thousand other ways you can eff something up. If you know what you're casting then do it. Put a comment on the line to acknowledge what you're doing, then get on with life.

http://stackoverflow.com/a/22666904
score: 1
has body: import static java.lang.Math.*; Convert part: double input =-5.485747E-5; //for example double tmp = abs(input); tmp *= pow(10, abs(floor(log10(tmp)))); int out = (int) tmp; System.out.println(out); output: 5
answers question: http://stackoverflow.com/q/22665984
downvote count: 0
type: Answer
upvote count: 1

http://stackoverflow.com/q/22732106
has comment: http://stackoverflow.com/comment/34646467
downvote count: 1
has comment: http://stackoverflow.com/comment/34646381
tagged with: java
linked to: http://stackoverflow.com/q/7709041
score: -1
has comment: http://stackoverflow.com/comment/34645575
type: Question
upvote count: 0
has title: how to run a java program in command prompt
has comment: http://stackoverflow.com/comment/34645602
has answer: http://stackoverflow.com/a/22732287
has body: How to set the path in control panel.I was been trying to change the path in environmental variables but couldn't succeed .The error it was stating was javac is not recognised as an internal or external command operable program or batch file
answer count: 1
favorite count: 0
type: UnansweredQuestion

http://stackoverflow.com/q/22762845
has answer: http://stackoverflow.com/a/22763019
score: 0
accepted answer: http://stackoverflow.com/a/22763019
type: AnsweredQuestion
has body: I am trying to make an Android App that takes use of the built-inn SQLite database. I have been struggling to make it work, and have tried several modifications. When i launch the applications on mye phone (android 4.2) or emulator (Android 4.4) via eclipse i get several messages. I don't know where the NullPointerExceptions comes from 03-31 09:20:45.121: E/AndroidRuntime(991): FATAL EXCEPTION: main 03-31 09:20:45.121: E/AndroidRuntime(991): Process: com.example.julegaveliste2, PID: 991 03-31 09:20:45.121: E/AndroidRuntime(991): java.lang.RuntimeException: Unable to instantiate activity ComponentInfo{com.example.julegaveliste2/com.example.julegaveliste2.MainActivity}: java.lang.NullPointerException 03-31 09:20:45.121: E/AndroidRuntime(991): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2102) 03-31 09:20:45.121: E/AndroidRuntime(991): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2226) 03-31 09:20:45.121: E/AndroidRuntime(991): at android.app.ActivityThread.access$700(ActivityThread.java:135) 03-31 09:20:45.121: E/AndroidRuntime(991): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1397) 03-31 09:20:45.121: E/AndroidRuntime(991): at android.os.Handler.dispatchMessage(Handler.java:102) 03-31 09:20:45.121: E/AndroidRuntime(991): at android.os.Looper.loop(Looper.java:137) 03-31 09:20:45.121: E/AndroidRuntime(991): at android.app.ActivityThread.main(ActivityThread.java:4998) 03-31 09:20:45.121: E/AndroidRuntime(991): at java.lang.reflect.Method.invokeNative(Native Method) 03-31 09:20:45.121: E/AndroidRuntime(991): at java.lang.reflect.Method.invoke(Method.java:515) 03-31 09:20:45.121: E/AndroidRuntime(991): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:777) 03-31 09:20:45.121: E/AndroidRuntime(991): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:593) 03-31 09:20:45.121: E/AndroidRuntime(991): at dalvik.system.NativeStart.main(Native Method) 03-31 09:20:45.121:…
tagged with: java
type: Question
has title: Can't figure out where NullPointerException comes from
possible better answer: http://stackoverflow.com/a/22762898
has answer: http://stackoverflow.com/a/22762898
answer count: 3
tagged with: android
tagged with: sqlite
has answer: http://stackoverflow.com/a/22762899

http://stackoverflow.com/comment/42242212
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/22686193
score: 5
has text: @tier1 In menu follow path Menu >> Properties >> Java Compiler here I have made changes.

http://stackoverflow.com/comment/34566321
type: Comment
type: QuestionComment
has text: what data structure are you using and how do you populate it?
score: 1
comment on: http://stackoverflow.com/q/22688682

http://stackoverflow.com/q/22779717
tagged with: location
answer count: 1
has answer: http://stackoverflow.com/a/22780034
score: 0
tagged with: android
has body: I want to get my device position. sometimes current position on demand and sometimes periodically every 5 mins (even when the application is not visible). I have used LocationListener + LocationManager. LocationListener locListener = new MyLocationListener(); locManager.requestLocationUpdates(LocationManager.GPS_PROVIDER, 0, 0, locListener); LocationListener locListener = new MyLocationListener(); locManager.requestLocationUpdates(LocationManager.NETWORK_PROVIDER, 0, 0, locListener); but i see in Android dev site the use of LocationClient Why should I opt one of them over the other? is LocationClient for GPS provider only?
type: UnansweredQuestion
linked to: http://stackoverflow.com/q/18916273
tagged with: java
tagged with: google-play-services
type: Question
has title: locationListener + manager vs. GoogleServices + locationClient

http://stackoverflow.com/comment/34695227
comment on: http://stackoverflow.com/q/22722399
has text: I am unable to view your code as I am behind a firewall/proxy that is blocking. What I mean by ` ` is that the `<form:options>` tag is a Spring JSTL tag that generates HTML ` ` tags as a result. Are you getting any in the generated HTML source and they are simply not correct, or are you getting none generated at all? If the first, it's probably in your options being passed to the `<form:options>`, if the second then your list is empty. Thousands upon thousands of people use Spring, so we know it works. You have to assume it's your code and approach debugging systematically.
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/a/22693717
has body: This is because you use StringField. From the javadoc: A field that is indexed but not tokenized: the entire String value is indexed as a single token. Just use TextField instead and you should be ok.
upvote count: 2
type: Answer
answers question: http://stackoverflow.com/q/22693197
score: 2
downvote count: 0
accepted answer of: http://stackoverflow.com/q/22693197
type: AcceptedAnswer

http://stackoverflow.com/q/22735012
tagged with: jbpm
answer count: 1
has answer: http://stackoverflow.com/a/22743005
favorite count: 0
upvote count: 2
type: UnansweredQuestion
score: 2
tagged with: java
has title: Retrieve Humar Tasks list assigned to group in jBPM
tagged with: jboss
has body: We are interacting with jBPM6 from Java using REST API, using GetTasksAssignedAsPotentialOwner we can get the tasks lists assigned to the particular user but our requirement is that we need to get all the tasks assigned to a group which we are not able to. Is there any API which we can use to achieve this results or any alternative?
type: Question
downvote count: 0

http://stackoverflow.com/a/37832581
answers question: http://stackoverflow.com/q/22737535
downvote count: 1
has body: steps: control panel system and security system Remote settings Advanced tab click Environment variables create a J2D_D3D variable and set the value to false. worked for me,....
score: 0
type: Answer
upvote count: 1

http://stackoverflow.com/a/22670994
has comment: http://stackoverflow.com/comment/34539030
has body: I've had better luck using the Scribe project. Follow this example for an example of Twitter authentication. The example is currently broken though unless you remove line 50. request.addBodyParameter("status", "this is sparta! *");
upvote count: 1
accepted answer of: http://stackoverflow.com/q/22670874
answers question: http://stackoverflow.com/q/22670874
has comment: http://stackoverflow.com/comment/34535518
has comment: http://stackoverflow.com/comment/34536835
has comment: http://stackoverflow.com/comment/34536203
has comment: http://stackoverflow.com/comment/34537219
has comment: http://stackoverflow.com/comment/34536309
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/34538270
score: 1
has comment: http://stackoverflow.com/comment/34538779
has comment: http://stackoverflow.com/comment/34539482
type: Answer
has comment: http://stackoverflow.com/comment/34535794
has comment: http://stackoverflow.com/comment/34539377

http://stackoverflow.com/comment/34767278
type: QuestionComment
score: 0
comment on: http://stackoverflow.com/q/22799553
type: Comment
has text: @RafaEl that shouldn't be possible, since it's reading one character at a time and converting it. Granted I never RAN the code myself so experimental results is always more credible.

http://stackoverflow.com/comment/34772252
score: 0
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/22802737
has text: If the C++ program is writing to stdout rather than a file, java is getting the stdout rather than you redirecting it to a file. This would leave an empty file in its place.

http://stackoverflow.com/q/22761312
has title: JTextPane print text after previous line
tagged with: console
score: 0
answer count: 1
accepted answer: http://stackoverflow.com/a/22761431
has body: I got a program with a JTextPane. My problem comes when I want to print in it. Every time, it will print at first line and move the rest down one. How can I make it so it prints at the end of the text? I got this: //... public static enum Level { CLASSIC, MAJ, AJOUT, SUPRESSION, CONFIG; } public static void add(Level level,String Message){ switch(level){ case CLASSIC: try{ Color BLACK = new Color(0, 0, 0); StyleConstants.setForeground(Colors, BLACK); Text.insertString(0, "\n\t- Mise à jour # " + Message + " -\n\n", Colors); }catch(Exception e) { ConsoleError(); } break; case MAJ: try{ Color ORANGE = new Color(252, 156, 51); StyleConstants.setForeground(Colors, ORANGE); Text.insertString(0, Message + "\n", Colors); }catch(Exception e) { ConsoleError(); } break; case AJOUT: Color GREEN = new Color(58, 157, 52); StyleConstants.setForeground(Colors, GREEN); try{ Text.insertString(0, Message + "\n", Colors); }catch(Exception e) { ConsoleError(); } break; case SUPRESSION: Color RED = new Color(183, 19, 0); StyleConstants.setForeground(Colors, RED); try{ Text.insertString(0, Message + "\n", Colors); }catch(Exception e) { ConsoleError(); } break; case CONFIG: Color BLACK = new Color(0, 0, 0); StyleConstants.setForeground(Colors, BLACK); try{ Text.insertString(0, Message + "\n", Colors); }catch(Exception e) { ConsoleError(); } break; } } //...
tagged with: jtextpane
tagged with: swing
type: AnsweredQuestion
tagged with: java
tagged with: output
has answer: http://stackoverflow.com/a/22761431
type: Question
linked to: http://stackoverflow.com/q/4059198

http://stackoverflow.com/a/22798833
has comment: http://stackoverflow.com/comment/34766098
score: 1
upvote count: 1
has comment: http://stackoverflow.com/comment/34768687
has comment: http://stackoverflow.com/comment/34768099
has comment: http://stackoverflow.com/comment/34779311
accepted answer of: http://stackoverflow.com/q/22798361
type: AcceptedAnswer
downvote count: 0
has body: The getBounds() method in the Paddle class seems to be the problem. You are returning a Rectangle with upper left coordinates of paddleX and paddleX. I think you meant return new Rectangle(paddleX, paddleY, PADDLE_SIZE, PADDLE_THICKNESS); instead.
has comment: http://stackoverflow.com/comment/34768452
answers question: http://stackoverflow.com/q/22798361
type: Answer
has comment: http://stackoverflow.com/comment/34767697

http://stackoverflow.com/a/22792365
downvote count: 0
answers question: http://stackoverflow.com/q/22790290
has body: As others have commented, your base application class (I assume it is Generator) which extends SimpleApplication must not be abstract, i.e. it should implement, at least, the simpleInitApp method. See the JMonkey documentation for SimpleApplication or this basic example. For completion, I will mention that if you really needed to create a dummy instance of an abstract class, you can do so "inline", without explicitly writing the full implementing class. You just need to write the implementation of the abstract methods enclosed by curly brackets after the constructor invocation: public abstract class AbstractClass { private static AbstractClass a = new AbstractClass() { @Override public void abstract_method() {/*implementation*/} }; public abstract void abstract_method(); } An anonymous class is created behind the scenes. But I definitely don't think this is what you need in this case.
has comment: http://stackoverflow.com/comment/34838354
type: Answer
score: 1
upvote count: 1

http://stackoverflow.com/comment/36721776
has text: Sure. Sorry, I didn't realize this was a self-answer. If you were in a test environment already, you probably should have mentioned that in your question.
type: Comment
comment on: http://stackoverflow.com/a/22775822
score: 1
type: AnswerComment

http://stackoverflow.com/comment/34706920
has text: NVM lol maybe i could do for example when the button is clicked (if panel color is red print out red , else if panel is green print out green) would that be good
type: Comment
type: QuestionComment
score: 0
comment on: http://stackoverflow.com/q/22766001

http://stackoverflow.com/comment/34727042
has text: Pedantic: You mean "convert", not "cast".
type: Comment
comment on: http://stackoverflow.com/a/22777437
score: 0
type: AnswerComment

httpsurlconnection
type: Tag
tags question: http://stackoverflow.com/q/22726697
tags question: http://stackoverflow.com/q/22725750
tag name: httpsurlconnection

http://stackoverflow.com/q/22680989
tagged with: jboss
tagged with: batch-file
upvote count: 1
linked to: http://stackoverflow.com/q/14622207
answer count: 1
favorite count: 0
has title: Error when running add-user.bat for Wildfly server
type: AnsweredQuestion
downvote count: 0
has answer: http://stackoverflow.com/a/22681131
score: 1
accepted answer: http://stackoverflow.com/a/22681131
tagged with: java
tagged with: wildfly
linked to: http://stackoverflow.com/q/17172611
type: Question
has body: I'm trying to access the Administration console for Wildfly, but first it says I must run the 'add-user.bat' file in [server installation directory]/bin/ Which I do but then get an error saying, well, look: When I simply try and run the file by double clicking it I get: I'm running Windows 8.1 64bit (Urgh) and Java 8

http://stackoverflow.com/q/22774487
has comment: http://stackoverflow.com/comment/34722044
has comment: http://stackoverflow.com/comment/34722561
tagged with: java
has body: I am trying to make a set of numbers into letters but when I run the program there is no output import java.util.Scanner; import java.util.Arrays; class program { public static void main(String[] args) { Scanner S = new Scanner(System.in); System.out.println("Enter a set of numbers between 1 and 26 separated by a comma: "); String s = S.nextLine(); String[] number = s.split("[\\S,]+"); for (int a = 0; a &lt; number.length; a++) { if (number[a].equals("1")) { number[a] = number[a].replace(number[a], "A"); } } for (int a = 0; a &lt; number.length; a++) { if (number[a].equals("2")) { number[a] = number[a].replace(number[a], "B"); } } } }
type: Question
has title: i am trying to make a set of numbers into letters but when i run the program there is no output
has comment: http://stackoverflow.com/comment/34722783
has answer: http://stackoverflow.com/a/22774568
score: 0
answer count: 1
type: UnansweredQuestion

http://stackoverflow.com/comment/34605915
type: AnswerComment
type: Comment
score: 0
comment on: http://stackoverflow.com/a/22687327
has text: Thanks for your answer which is really helpful to me, and I got another problem here, could you please have a look at it? http://stackoverflow.com/questions/22710112/get-error-when-i-use-java-api-to-connect-hbasestandalone-mode-without-hadoop

http://stackoverflow.com/comment/34567353
comment on: http://stackoverflow.com/q/22687135
score: 0
has text: Test your server sending code. Something tells me that if you stripped out all the encryption and just sent a random byte array, you'd get a different response back.
type: Comment
type: QuestionComment

http://stackoverflow.com/q/22703165
tagged with: jpanel
possible better answer: http://stackoverflow.com/a/22703216
type: Question
has answer: http://stackoverflow.com/a/22703216
answer count: 2
score: 0
has title: Repaint only a specific JPanel inside a JFrame
has answer: http://stackoverflow.com/a/22703230
tagged with: repaint
has body: I am trying to create a paint component for the panel_1 JPanel, but I don't know how to do it. This is my class. This code works, except that it does not paint the panel_1. If I try and add it to the panel without painting it, it works just fine. Also I need that panel to refresh (repaints) automatically at a given interval. Please let help me. :D import java.awt.Color; import java.awt.EventQueue; import java.awt.Graphics; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import javax.swing.JButton; import javax.swing.JComboBox; import javax.swing.JFrame; import javax.swing.JLabel; import javax.swing.JPanel; import javax.swing.JTextArea; import javax.swing.JTextField; import javax.swing.Timer; import javax.swing.border.EmptyBorder; public class GUI extends JFrame implements ActionListener { private JPanel contentPane; private JTextField textField; private JTextField textField_1; private JTextField textField_2; private JTextField textField_3; private JButton btnStop, btnStart; private JComboBox comboBox_1, comboBox; private Manager manager = new Manager(); private String arrMin, arrMax, svcMin, svcMax, simTime; private JTextField textField_4; private JPanel panel_1 = new JPanel(){ @Override public void paintComponent(Graphics g){ paintComponents(g); panel_1.setBackground(Color.orange); panel_1.setVisible(true); System.out.println("Just testing"); } }; /** * Launch the application. */ public static void main(String[] args) { EventQueue.invokeLater(new Runnable() { public void run() { try { GUI frame = new GUI(); frame.setVisible(true); } catch (Exception e) { e.printStackTrace(); } } }); } /** * Create the frame. */ public GUI() { setResizable(false); setForeground(Color.DARK_GRAY); setBackground(Color.DARK_GRAY); setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); setBounds(100, 100, 700, 500); contentPane = new JPanel(); contentPane.setForeground(Color.DARK_GRAY); contentPane.setBackground(Color.DARK_GRAY); contentPane.setBorder(new EmptyBorder(5,…
tagged with: jframe
tagged with: swing
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/22703230
tagged with: java

http://stackoverflow.com/comment/34616174
comment on: http://stackoverflow.com/q/22715839
has text: Because not all decimals can be represented in binary. The 6697 at the end is the error.
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/34667381
score: 0
comment on: http://stackoverflow.com/q/22744355
has text: You're going to been to be more specific. What is the `.class` file; what package is the `class` in. How did you package it into a `jar`?
type: Comment
type: QuestionComment

http://stackoverflow.com/a/22747491
has body: What you are doing is not "wrong" at least. The list is constructed explicitly, which could be avoided with a small utility method, but there are few cases where something like this really matters. class IteratorToString { public static &lt;T&gt; String toString(Iterator&lt;T&gt; iterator) { if (!iterator.hasNext()) { return "[]"; } StringBuilder sb = new StringBuilder(); sb.append('['); while (true) { T t = iterator.next(); sb.append(t); if (!iterator.hasNext()) { return sb.append(']').toString(); } sb.append(',').append(' '); } } }
type: Answer
answers question: http://stackoverflow.com/q/22747104
score: 0

http://stackoverflow.com/comment/34688268
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/22755376
score: 1
has text: setting c3p0.autoCommitOnClose to true is IMHO a very bad idea unless you have a very good reason. [ see http://www.mchange.com/projects/c3p0/#autoCommitOnClose ] since you are not seeing exceptions (and have not described what you mean by "bugs...connected with database transaction/session management), one possibility is that you are occasionally commit()ing transactions that ought not to be committed, corrupting your database. otherwise, you'll need to give a better description of what's going wrong before i'll be able to help. btw, what version of c3p0 are you using?

http://stackoverflow.com/q/22704288
has comment: http://stackoverflow.com/comment/34596911
has body: I am unable to retrieve list data from JSTL here is my bean public class ProjectData { public List &lt;String&gt; srNumbers; public String comments; public String getComments() { return comments; } public List&lt;String&gt; getSrNumbers() { return srNumbers; } } This is my html snipet &lt;c:forEach items="${projectDataList}" var="projectDataList"&gt; &lt;c:forEach items="${projectDataList.srNumbers}" var="srNumbers"&gt; &lt;c:out value="${srNumbers}" /&gt;, &lt;/c:forEach&gt; &lt;/c:forEach&gt; below is what I am setting in the servlet request.setAttribute("projectDataList", projectDataList); the expected output is given below sr1,sr2,sr3 Defined the setters already
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/34595683
has comment: http://stackoverflow.com/comment/34595789
tagged with: java
has answer: http://stackoverflow.com/a/22704734
tagged with: servlets
type: Question
score: 0
has comment: http://stackoverflow.com/comment/34595638
tagged with: jstl
has comment: http://stackoverflow.com/comment/34596598
has title: unable to retrive list inside list in JSTL
has comment: http://stackoverflow.com/comment/34598225
has comment: http://stackoverflow.com/comment/34595812
answer count: 1
tagged with: jsp
has comment: http://stackoverflow.com/comment/34595780
has comment: http://stackoverflow.com/comment/34595633
accepted answer: http://stackoverflow.com/a/22704734
has comment: http://stackoverflow.com/comment/34595770
tagged with: http://stackoverflow.com/tag/html

http://stackoverflow.com/q/22703348
has body: public class MainActivity extends Activity { @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); Button PressMe = (Button)findViewById(R.id.btnPressMe); PressMe.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { startActivity(new Intent(Main.this, PiggyBank.class)); // TODO Auto-generated method stub } }); } I have project named PiggyBank. The PiggyBank containts two screens, a welcome screen and an input/output screen. The code above is for my first screen which is a welcome screen. A welcome screen has a button named Press Me. When a user pressed the button it takes him/her to the input/output screen. This is what the above code is supposed to do. But I have an error. The line startActivity(new Intent(Main.this, PiggyBank.class)); has two red underlines, the first one is under Main.this and the second one is under PiggyBank.class. How can I fix these two errors? PiggyBank.java import java.text.DecimalFormat; import android.os.Bundle; import android.app.Activity; import android.view.Menu; import android.view.View; import android.view.View.OnClickListener; import android.widget.Button; import android.widget.EditText; import android.widget.Spinner; import android.widget.TextView; public class PiggyBank2 extends Activity { String groupChoice; int NumberOfQuarters, NumberOfDimes, NumberOfNickels, NumberOfPennies; double TotalQuarters, TotalDimes, TotalNickels, TotalPennies; double Quarters, Dimes, Nickels,Pennies; double sumCost; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_piggy_bank2); final EditText quarters = (EditText) findViewById(R.id.txtQuaters); final EditText dimes = (EditText) findViewById(R.id.txtDimes); final EditText nickels = (EditText) findViewById(R.id.txtNickels); final EditText pennies = (EditText) findViewById(R.id.txtPennies); final Spinner group…
favorite count: 0
upvote count: 2
has title: Main.this error in Android code
tagged with: android
accepted answer: http://stackoverflow.com/a/22703465
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/34594127
score: 1
tagged with: java
has comment: http://stackoverflow.com/comment/34595791
possible better answer: http://stackoverflow.com/a/22704298
downvote count: 1
tagged with: android-emulator
type: Question
has answer: http://stackoverflow.com/a/22704298
has answer: http://stackoverflow.com/a/22703465
answer count: 2

http://stackoverflow.com/a/22741597
has comment: http://stackoverflow.com/comment/34662215
has body: The Javadoc of DataOutputStream.writeUTF states: First, two bytes are written to the output stream as if by the writeShort method giving the number of bytes to follow. This value is the number of bytes actually written out, not the length of the string. Two bytes means 16 bits: in 16 bits the maximum integer one can encode is 2^16 == 65535. DataInputStream.readUTF has the exact same restriction, because it first reads the number of UTF-8 bytes to consume, in the form of a 2-byte integer, which again can only have a maximum value of 65535. writeUTF first writes two bytes with the length, which has the same result as calling writeShort with the length and then writing the UTF-encoded bytes. writeUTF doesn't actually call writeShort - it builds up a single byte[] with both the 2-byte length and the UTF bytes. But that is why the Javadoc says "as if by the writeShort method" rather than just "by the writeShort method".
accepted answer of: http://stackoverflow.com/q/22741556
type: Answer
answers question: http://stackoverflow.com/q/22741556
has comment: http://stackoverflow.com/comment/34662125
upvote count: 20
score: 20
type: AcceptedAnswer
downvote count: 0

http://stackoverflow.com/comment/34554467
comment on: http://stackoverflow.com/q/22666348
type: Comment
has text: I think persistence storage in disk option only available in license feature.I just want to implement open source and want to implement storage using by myself. any pointer will be helpfull.how to do that.i dnt want BigMemory Go and MAX featurs.
type: QuestionComment
score: 0

http://stackoverflow.com/q/22715365
favorite count: 0
has comment: http://stackoverflow.com/comment/34615622
has comment: http://stackoverflow.com/comment/34615818
has comment: http://stackoverflow.com/comment/34615333
has answer: http://stackoverflow.com/a/22716726
tagged with: swing
type: AnsweredQuestion
downvote count: 0
score: 1
tagged with: java
has title: JTree disable highlight effect on certain nodes
type: Question
has body: I have a Jtree and I need to remove the highlight effect on certain node. So, now I have this for alla nodes and I would like have this on certain node: How can I achieve this ? Thanks
tagged with: jtree
possible better answer: http://stackoverflow.com/a/22715612
tagged with: defaultmutabletreenode
has comment: http://stackoverflow.com/comment/34615528
linked to: http://stackoverflow.com/q/10976594
answer count: 2
has answer: http://stackoverflow.com/a/22715612
upvote count: 1
accepted answer: http://stackoverflow.com/a/22716726

http://stackoverflow.com/a/22734896
score: 2
downvote count: 0
answers question: http://stackoverflow.com/q/22734742
upvote count: 2
type: Answer
has body: your issue is with ListView layout = (ListView) findViewById(R.id.allJokesList); layout.addView(adView); You need to add the adView inside the adapter http://googleadsdeveloper.blogspot.co.il/2012/03/embedding-admob-ads-within-listview-on.html

http://stackoverflow.com/a/22682527
type: Answer
answers question: http://stackoverflow.com/q/22682476
has comment: http://stackoverflow.com/comment/34555816
has body: String[] split = a.split(","); String beforeSecond = a[0] + "," + a[1]; String afterSecond = a[2] + "," + a[3];
score: 0

http://stackoverflow.com/q/22749387
tagged with: jtable
score: 0
answer count: 1
has comment: http://stackoverflow.com/comment/34676872
has body: How can I perform a mouse event handling when clicking a cell on my DefaultTableModel for example when clicking the first column of a row it prints the whole row. static DefaultTableModel dTableModel = new DefaultTableModel(databaseInfo, columns){ public Class getColumnClass(int column) { Class returnValue; // Verifying that the column exists (index &gt; 0 &amp;&amp; index &lt; number of columns if ((column &gt;= 0) &amp;&amp; (column &lt; getColumnCount())) { returnValue = getValueAt(0, column).getClass(); } else { // Returns the class for the item in the column returnValue = Object.class; } return returnValue; } }; thank you .
has answer: http://stackoverflow.com/a/22750856
has comment: http://stackoverflow.com/comment/34676980
type: UnansweredQuestion
tagged with: java
tagged with: swing
type: Question
tagged with: defaulttablemodel
has title: Java event handling on DefaultTableModel when a cell is clicked

http://stackoverflow.com/comment/34781170
type: AnswerComment
score: 0
type: Comment
has text: don't give anything in xml if u don't want any image in xml if u give anything in image resource then only pragmatically u have to remove this
comment on: http://stackoverflow.com/a/22807391

http://stackoverflow.com/a/22721204
has body: It means the client can perform an operation on an object without knowing if it is a single object or a collection of objects. Say we have an object of type Graphic which can be an individual shape like Circle or Rectangle or a collection of shapes. Then we can perform graphic.scaleSizeBy(2) to double the size.
type: Answer
score: 1
upvote count: 1
answers question: http://stackoverflow.com/q/22720922
downvote count: 0

http://stackoverflow.com/comment/34677604
score: 0
type: Comment
has text: @JamesMcMurray - you're totally right, although there isn't much of an alternative if all you have is a the name of a resource. Ideally, you'd just want to avoid this situation entirely.
comment on: http://stackoverflow.com/a/22749741
type: AnswerComment

http://stackoverflow.com/comment/34675416
type: AnswerComment
type: Comment
has text: You're welcome. Just be sure you will be able to reproduce it. Good luck on the math test. (And you can accept the answer to "close the case" if you deem it so.)
comment on: http://stackoverflow.com/a/22748597
score: 0

http://stackoverflow.com/q/22668908
score: 1
tagged with: java
type: Question
has comment: http://stackoverflow.com/comment/34531795
downvote count: 0
has title: java binary to decimal
answer count: 4
has answer: http://stackoverflow.com/a/22669307
favorite count: 0
has body: Im having trouble converting binary to a decimal. We have to use a function for the conversion and do it by hand rather than use a predefined function. This is what I have so far, I know it is a mess but I am stuck on how to fix it. Thanks! import java.util.Scanner; public class BinaryConversion { public static void main(String[] args) { Scanner input = new Scanner(System.in); String inString; int decimal; System.out.println("Enter a binary number: "); inString = input.nextLine(); while (!"-1".equals(inString)) { int i; int binaryLength; binaryLength = inString.length(); public static int binaryToDecimal (String binaryString) { for (i = binaryLength - 1, decimal = 0; i &gt;= 0; i--) { if (inString.charAt(i) == '1') decimal = decimal + Math.pow(2,inString.length() - 1 - i); } return (int) decimal; } System.out.println(decimal); System.out.println("Enter a binary number: "); inString = input.nextLine(); } System.out.println("All set !"); } }
tagged with: binary
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/22670309
upvote count: 1
has answer: http://stackoverflow.com/a/22669697
has answer: http://stackoverflow.com/a/22669337

http://stackoverflow.com/comment/34632402
comment on: http://stackoverflow.com/a/22723764
score: 0
type: Comment
has text: Thanks for the suggestion. I did convert the AlertDialog builder but the same results show up, with it working on my phone and other large screen devices but not on smaller screen emulators.
type: AnswerComment

http://stackoverflow.com/q/22766493
has body: Play refuses to accept a POST request when the data is unicode and I get: Error parsing application/x-www-form-urlencoded I was under the impression that everything is working great until I tried a request with text in Hebrew instead of English, so a request with value=hey works fine but a request with value=%u05D4%u05D9%u05D9 fails. I found something about it but he said he made it worked by changing play/api/mvc/ContentType.scala, something I'd like to avoid. Any ideas? Thanks! Edit I'm aware that the encoding does not fit the standards for application/x-www-form-urlencoded but that's the case I need to deal with, changing the client side currently is not an option and it uses the javascript escape method. I'm looking for a solution on the backend side of things, that is a Play solution. It would be nice to find a solution which can be implemented in java, but for now it looks like the solution is to write my own BodyParser (in scala).
has comment: http://stackoverflow.com/comment/34825863
type: Question
has answer: http://stackoverflow.com/a/22949244
has comment: http://stackoverflow.com/comment/34825501
has comment: http://stackoverflow.com/comment/34819966
tagged with: post
has comment: http://stackoverflow.com/comment/34826293
tagged with: playframework
has comment: http://stackoverflow.com/comment/34933278
upvote count: 1
answer count: 1
has comment: http://stackoverflow.com/comment/35024371
has comment: http://stackoverflow.com/comment/34841733
has comment: http://stackoverflow.com/comment/35024827
favorite count: 0
has comment: http://stackoverflow.com/comment/34841116
has comment: http://stackoverflow.com/comment/34928967
has comment: http://stackoverflow.com/comment/34824755
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/34823908
has title: Error parsing application/x-www-form-urlencoded with Unicode post data
tagged with: playframework-2.0
has comment: http://stackoverflow.com/comment/34825736
downvote count: 0
score: 1
tagged with: java

database
tags question: http://stackoverflow.com/q/22730078
tags question: http://stackoverflow.com/q/22775282
tags question: http://stackoverflow.com/q/22656237
tags question: http://stackoverflow.com/q/22686123
tags question: http://stackoverflow.com/q/22761356
tags question: http://stackoverflow.com/q/22663816
tags question: http://stackoverflow.com/q/22714738
tags question: http://stackoverflow.com/q/22801594
tags question: http://stackoverflow.com/q/22772868
tags question: http://stackoverflow.com/q/22683491
tags question: http://stackoverflow.com/q/22762138
type: Tag
tags question: http://stackoverflow.com/q/22770951
tags question: http://stackoverflow.com/q/22649651
tags question: http://stackoverflow.com/q/22701066
tags question: http://stackoverflow.com/q/22775532
tags question: http://stackoverflow.com/q/22748700
tags question: http://stackoverflow.com/q/22662453
tag name: database
tags question: http://stackoverflow.com/q/22675839
tags question: http://stackoverflow.com/q/22728129
tags question: http://stackoverflow.com/q/22672279
tags question: http://stackoverflow.com/q/22794565
tags question: http://stackoverflow.com/q/22762576
tags question: http://stackoverflow.com/q/22665942
tags question: http://stackoverflow.com/q/22698034
tags question: http://stackoverflow.com/q/22743497
tags question: http://stackoverflow.com/q/22729898
tags question: http://stackoverflow.com/q/22777159
tags question: http://stackoverflow.com/q/22793441

http://stackoverflow.com/a/22795134
accepted answer of: http://stackoverflow.com/q/22732274
score: 0
type: AcceptedAnswer
answers question: http://stackoverflow.com/q/22732274
has body: In the end, the problem was rather simple. When I was moving the app, I was always putting it on the desktop, which, in the case of my PC, sets by default all content as read-only (in relation to the app's privileges). Because of this, the app could not modify any files that were within folders on the desktop. Therefore, all I had to do was to move the app to another directory, such as C:\randomFolder, and the problem was solved. So, if anyone has a similar problem, moving the app elsewhere may be the solution. Alternatively, taking full ownership of the folder and its content can also work. When possible, it is usually better to have the app ask its user for a specific location to save its data.
type: Answer

http://stackoverflow.com/comment/34538721
type: Comment
has text: Could you write a URL example that could be applied for your 'ref' case? as fas as I know there's a getRef() method too.
comment on: http://stackoverflow.com/a/22672662
score: 0
type: AnswerComment

http://stackoverflow.com/a/22656778
has body: What about this instead of checking element.equals(): String element = null; if( rawLogText.contains("RequestType") ) { element = "RequestType"; } else if( rawLogText.contains("ResponseType") ) { element = "ResponseType"; } else { return; } //continue the process
downvote count: 0
answers question: http://stackoverflow.com/q/22656684
upvote count: 3
type: Answer
score: 3

http://stackoverflow.com/a/22683688
type: Answer
has body: Try this: <EditText android:id="@+id/verificationCodeEditText" style="@style/textOnBg" android:layout_width="fill_parent" android:layout_height="wrap_content" android:layout_gravity="center" android:background="@android:color/transparent" android:gravity="center" android:imeOptions="actionSend" android:inputType="phone" android:paddingLeft="5dip" android:paddingRight="5dip" android:textColor="#516063" android:textColorHint="#b4c8cf" android:textSize="25dp" > </EditText> Hope this will help :).
score: 0
answers question: http://stackoverflow.com/q/22682979

http://stackoverflow.com/a/22718997
answers question: http://stackoverflow.com/q/22718898
type: Answer
score: 2
downvote count: 0
has body: You may want to use ArrayLists for this problem. ArrayLists are Java's way of creating a mutable array. With arraylists, the array can be automatically expanded and reduced based on the number of objects in the Array. You can add and delete objects using the index or variable name. Sample Code: ArrayList&lt;Employee&gt; employees = new ArrayList&lt;&gt;; Then you can use the following methods: employees.remove(int index); employees.remove(Object o); Check this out for more reference: http://docs.oracle.com/javase/7/docs/api/java/util/ArrayList.html
upvote count: 2

http://stackoverflow.com/comment/34701959
has text: hello, in iOS you don't develop in java, you uses Objective-c
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/22763213

http://stackoverflow.com/a/22669967
has comment: http://stackoverflow.com/comment/34534400
type: Answer
score: 2
accepted answer of: http://stackoverflow.com/q/22669882
upvote count: 2
has body: This has been answered elsewhere, to some extent. Since Java 7u6, all substrings are their own String object. So you would not just allocate memory for 16 more bytes, you would allocate memory for a whole String object. credit: https://stackoverflow.com/a/14193606/1159805 edit: Here's a copy of the proposal explaining why the change was made: http://mail.openjdk.java.net/pipermail/core-libs-dev/2012-May/010257.html
answers question: http://stackoverflow.com/q/22669882
has comment: http://stackoverflow.com/comment/34540380
has comment: http://stackoverflow.com/comment/34551236
type: AcceptedAnswer
downvote count: 0

http://stackoverflow.com/comment/34720691
comment on: http://stackoverflow.com/q/22773754
score: 0
type: Comment
has text: @hiphopdroid Yes, that is my hope, but I haven't found anything to support it yet. I am attempting to try right now.
type: QuestionComment

http://stackoverflow.com/a/22681005
score: 7
answers question: http://stackoverflow.com/q/22680383
accepted answer of: http://stackoverflow.com/q/22680383
has comment: http://stackoverflow.com/comment/34553367
has comment: http://stackoverflow.com/comment/34553229
upvote count: 7
type: AcceptedAnswer
has body: try ternary operator ?: If your input is fixed from 100 to 200 then you can try: for(int i = 100; i &lt; 200; i++) { System.out.print(i+ ((i%10==9) ? "\n" : " ")); } will output: 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 ... Here is Demo on IDEONE But if you input is not fixed then try ie 105 to 200: int start = 105; for(int i = start; i &lt; 200; i++) { System.out.print(i+ ((i-(start-1))%10==0 ? "\n" : " ")); } will output: 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 ... Here is demo
type: Answer
downvote count: 0

http://stackoverflow.com/comment/34671430
has text: I assume English isn't your first language, but if "X is way too expensive compared to Y" this does imply that X is more expensive than Y. Yes I agree that the rules for final help only in very few situations, but I disagree that the cost of a single StoreLoad barrier is prohibitively expensive or should stop anybody from using the final modifier! If you benchmark the code and can really show a significant performance impact of the barrier, sure remove it - but I can't imagine a single non-contrived example where this would be the case.
comment on: http://stackoverflow.com/a/22745616
type: Comment
score: 0
type: AnswerComment

http://stackoverflow.com/comment/34753532
type: Comment
type: QuestionComment
has text: @camickr so you are saying that iam obliged to create 3 panels with titled borders, and then affect them to my GridBagLayout container ?
comment on: http://stackoverflow.com/q/22790716
score: 0

http://stackoverflow.com/q/22656336
has body: I installed JDK on Linux. There is a problem that says: -bash: ./jdk-6u31-linux-i586.bin: cannot execute binary file. How can I solve it?
score: 0
answer count: 1
tagged with: linux
has title: -bash: ./jdk-6u31-linux-i586.bin: cannot execute binary file
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/34509768
tagged with: java
has answer: http://stackoverflow.com/a/22656451
type: Question

http://stackoverflow.com/a/22705217
accepted answer of: http://stackoverflow.com/q/22705189
has comment: http://stackoverflow.com/comment/34598757
answers question: http://stackoverflow.com/q/22705189
type: AcceptedAnswer
score: 27
has comment: http://stackoverflow.com/comment/34598401
type: Answer
upvote count: 27
has comment: http://stackoverflow.com/comment/34598528
downvote count: 0
has body: Take a look at JFileChooser#setAcceptAllFileFilterUsed Determines whether the AcceptAll FileFilter is used as an available choice in the choosable filter list. If false, the AcceptAll file filter is removed from the list of available file filters. If true, the AcceptAll file filter will become the the actively used file filter.
has comment: http://stackoverflow.com/comment/34598433

http://stackoverflow.com/comment/34666540
type: Comment
comment on: http://stackoverflow.com/a/22743641
type: AnswerComment
score: 0
has text: @StephenC regarding your last edit, yes, I see that there are two different things here, publishing the reference and using the reference. However, I think my point still remains: if publishing the reference also forces a happens-before relation, then using final fields does not seem to have any effect here, right?

http://stackoverflow.com/a/22676047
has body: You imported import static org.junit.Assert.assertArrayEquals; but not import static org.junit.Assert.assertEquals; You could also import every static member of Assert with import static org.junit.Assert.*; Without these, Java thinks you are calling the method assertEquals defined in the class the code is declared in. Such a method does not exist.
score: 31
upvote count: 31
answers question: http://stackoverflow.com/q/22676040
type: AcceptedAnswer
downvote count: 0
accepted answer of: http://stackoverflow.com/q/22676040
type: Answer

http://stackoverflow.com/comment/34566849
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/22688682
has text: For such a small number of elements go with `insertion sort`,because it has low overhead and is `adaptive`, If your integers are bounded (i.e. in a given range you know) radix sort/ counting sort is the algorithm of choice
score: 0

http://stackoverflow.com/a/22653785
has comment: http://stackoverflow.com/comment/34551358
downvote count: 1
has comment: http://stackoverflow.com/comment/34552785
type: Answer
has body: you need to call getClasses() method of Class. AbsSavedState.Class.getDeclaredClasses()
upvote count: 0
answers question: http://stackoverflow.com/q/22653683
score: -1

http://stackoverflow.com/q/22686586
has answer: http://stackoverflow.com/a/22686985
type: Question
linked to: http://stackoverflow.com/q/22648079
score: 10
has comment: http://stackoverflow.com/comment/34572960
has body: I was playing around with Java 8 lambdas, method references and interface default methods to explore the wonderful world of currying, and then I got this Java error I cannot understand. Here is the code : public class Main { public interface CurryBiConsumer&lt;T, U&gt; extends BiConsumer&lt;T, U&gt; { default public CurryConsumer&lt;U&gt; curryFirst(T t) { return (u) -&gt; accept(t, u); } default public CurryConsumer&lt;T&gt; currySecond(U u) { return (t) -&gt; accept(t, u); } } public interface CurryConsumer&lt;T&gt; extends Consumer&lt;T&gt; { default public Runnable curry(T t) { return () -&gt; accept(t); } } static void execute(Runnable r) { System.out.println("BEFORE"); r.run(); System.out.println("AFTER"); } static void display(String str, int count) { System.out.println("DISP: " + str + " " + count); } public static void main(String[] args) { CurryBiConsumer&lt;String, Integer&gt; bc = Main::display; execute(bc.curryFirst("Salomon").curry(42)); } } Eclipse gives me no error but when I run it, I get this runtime error : Exception in thread "main" java.lang.BootstrapMethodError: call site initialization exception at java.lang.invoke.CallSite.makeSite(CallSite.java:328) at java.lang.invoke.MethodHandleNatives.linkCallSite(MethodHandleNatives.java:296) at com.test8.Main.main(Main.java:34) Caused by: java.lang.ClassFormatError: Duplicate method name&amp;signature in class file com/test8/Main$$Lambda$1 at sun.misc.Unsafe.defineAnonymousClass(Native Method) at java.lang.invoke.InnerClassLambdaMetafactory.spinInnerClass(InnerClassLambdaMetafactory.java:324) at java.lang.invoke.InnerClassLambdaMetafactory.buildCallSite(InnerClassLambdaMetafactory.java:194) at java.lang.invoke.LambdaMetafactory.altMetafactory(LambdaMetafactory.java:473) at java.lang.invoke.CallSite.makeSite(CallSite.java:301) ... 2 more Can someone explain What is this error, why it is happening and how to get around it ? Thanks :)
answer count: 2
possible better answer: http://stackoverflow.com/a/77531448
downvote count: 0
accepted answer: http://stackoverflow.com/a/22686985
has answer: http://stackoverflow.com/a/77531448
favorite count: 0
has comment: http://stackoverflow.com/comment/34563036
tagged with: java-8
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/34563674
has comment: http://stackoverflow.com/comment/34562455
tagged with: java
has title: Java 8: Duplicate method name&signature lambda
upvote count: 10

http://stackoverflow.com/q/22669799
score: 0
has comment: http://stackoverflow.com/comment/34533539
has title: Searching Text from Oracle database based on text pattern
type: UnansweredQuestion
tagged with: oracle-database
tagged with: spring-mvc
answer count: 0
tagged with: java
type: Question
has comment: http://stackoverflow.com/comment/34533889
has body: I have requirement where user has search box where he will enter multiple string seperated by spaces. I have to search in such a way that all strings matching should be shown first and then matching second criteria and atlast least matching. For example, if the user searches "Device Failed Due", then it must show records matching "Device Failed Due ",then "Device Failed "or "Failed Due " and other criteria ,atlast single search pattern. Can anyone sugggest me good and best way of doing using java from oracle DB. Please kindly Provide me how to do it in best way import java.util.ArrayList; import java.util.List; import java.util.StringTokenizer; public class Test { String input; //input String StringBuffer output; //Holds the output String delimiter = ","; //Delimiter (default comma (,)) String arrayOfWords[]; List li=new ArrayList(); /* * Generates combinations by applying the * concept of recursion */ private void nextCombination(int position, int remainder) { output.append(arrayOfWords[position]+this.delimiter); if (remainder == 1) { li.add(output.substring(0,output.length()-1).replace(",",".*")); // System.out.println(output.substring(0,output.length()-1)); } else { for (int i = position + 1; i + remainder - 1 &lt;= arrayOfWords.length; i++) nextCombination(i, remainder - 1); } output.delete(output.indexOf(arrayOfWords[position]),output.length()); } public void generateCombinations(String input, String delimiter) { output = new StringBuffer(); this.input = input; this.delimiter = delimiter; /* * Splitting the words by delimiter and storing in * an array. */ StringTokenizer buf = new StringTokenizer(input,delimiter); int lengthOfArray = buf.countTokens(); arrayOfWords = new String[lengthOfArray]; int i = 0; while(buf.hasMoreTokens()) { arrayOfWords[i] = buf.nextToken(); i++; } for (int j = 1; j &lt;= lengthOfArray; j++) for (int k = 0; k + j &lt;= lengthOfArray; k++) { nextCombination(k, j); } System.out.println(li); } public void generateCombinations(String input…

http://stackoverflow.com/q/22790716
tagged with: swing
tagged with: titled-border
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/22814053
has comment: http://stackoverflow.com/comment/34753532
tagged with: java
has comment: http://stackoverflow.com/comment/34762940
has comment: http://stackoverflow.com/comment/34751047
type: Question
tagged with: gridbaglayout
answer count: 2
has comment: http://stackoverflow.com/comment/34781002
has comment: http://stackoverflow.com/comment/34751486
has title: how to add a TiltledBorder in a GridBagLayout?
has comment: http://stackoverflow.com/comment/34757569
possible better answer: http://stackoverflow.com/a/22791070
score: 0
has answer: http://stackoverflow.com/a/22791070
has comment: http://stackoverflow.com/comment/34762835
has answer: http://stackoverflow.com/a/22814053
has comment: http://stackoverflow.com/comment/34758606
has comment: http://stackoverflow.com/comment/34762126
has comment: http://stackoverflow.com/comment/34750785
has comment: http://stackoverflow.com/comment/34792512
has body: I am trying to make an UI with Swing using only one Container with the GridBagLayout ! My problem is that I want to regroup some JtextFields and Jlabels under one title (TitledBorder) in my interface, is there a way to add the border directly in my container, or should I create another JPanel to regroup my components and then add the hole Panel to my GridBagLayout ?

http://stackoverflow.com/q/22660846
has body: I have event dates, titles, venues, attendees, start &amp; end times, location and other metadata collected from users via forms then stored in a mysql database table. I would like to retrieve the events from the database and list them in Google Calender style. So far I only know of JFXtras Agenda having this kind of implementation. I've been trying for a long time now to work with JFXtras Agenda but I'm stuck at retrieving the events from the database and listing them on the Agenda as Appointments. How do I go about it? I'm ready to try out any other implementation that lists events from data base like Google Calender does. Thank you in advance. Ps. I think my problem is that I don't understand what an appointment group is from AppointmentGroup Interface (Class Agenda.AppointmentImpl) is supposed to do/ what it is.... From the API: ".......An appointment group is a binding element between appointments; it contains information about visualization....." What does "binding element between appointments" mean?
accepted answer: http://stackoverflow.com/a/22680098
tagged with: java
tagged with: javafx
type: Question
has comment: http://stackoverflow.com/comment/34550341
answer count: 1
tagged with: jfxtras
score: 0
has title: How to list dates from database onto JFXtras Agenda as Appointments: Google Calender style event listing
linked to: http://stackoverflow.com/q/22681781
has comment: http://stackoverflow.com/comment/34550880
has comment: http://stackoverflow.com/comment/34549153
tagged with: calendar
has answer: http://stackoverflow.com/a/22680098
type: AnsweredQuestion

http://stackoverflow.com/comment/34521546
has text: Thank you @IRus and learned a new thing of jdk 7
score: 0
comment on: http://stackoverflow.com/q/22660651
type: Comment
type: QuestionComment

http://stackoverflow.com/q/22745397
type: Question
has comment: http://stackoverflow.com/comment/34669053
has comment: http://stackoverflow.com/comment/34669039
has comment: http://stackoverflow.com/comment/34669193
tagged with: listview
has body: That's my class and layouts.. testlayout dot java package com.example.project1; import android.app.ListActivity; public class testLayout extends ListActivity { Project1 mAct; void setNewWindow() { mAct=Project1.getMAct(); //Project1 context (Project1 - MainActivity) mAct.setContentView(R.layout.testlayout); String[] values = new String[] { "Android", "iPhone", "WindowsMobile", "Blackberry", "WebOS", "Ubuntu", "Windows7", "Max OS X", "Linux", "OS/2", "Ubuntu", "Windows7", "Max OS X", "Linux", "OS/2", "Ubuntu", "Windows7", "Max OS X", "Linux", "OS/2", "Android", "iPhone", "WindowsMobile" }; setListAdapter(new MyPerformanceArrayAdapter(mAct, values)); } } testlayout.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;ListView android:id="@+id/listView2" android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_alignParentLeft="true" android:layout_alignParentTop="true" &gt; &lt;/ListView&gt; &lt;/RelativeLayout&gt; MyPerformanceArrayAdapter.java package com.example.project1; import android.app.Activity; import android.util.Log; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; import android.widget.ArrayAdapter; import android.widget.ImageView; import android.widget.TextView; public class MyPerformanceArrayAdapter extends ArrayAdapter&lt;String&gt; { private final Project1 context1; private final String[] names1; static class ViewHolder { public TextView text; public ImageView image; } public MyPerformanceArrayAdapter(Project1 context, String[] names) { super(Project1.getMAct(), R.layout.rowlayout, names); context1 = Project1.getMAct(); names1 = names; Log.v("4", "GOOD"); } @Override public View getView(int position, View convertView, ViewGroup parent) { View rowView = convertView; Log.v("3", "GOOD"); // reuse views if (rowView == null) { Layo…
tagged with: android
has comment: http://stackoverflow.com/comment/34669155
answer count: 0
type: UnansweredQuestion
has title: Performance Optimization ListView
tagged with: cells
has comment: http://stackoverflow.com/comment/34668983
score: 0
tagged with: java
has comment: http://stackoverflow.com/comment/34669007

http://stackoverflow.com/comment/34647776
type: Comment
has text: @skiwi Re proposed edits, I saw those, and they're more concise but also more obscure. I'd suggest that anyone who wants to can post the alternative in his/her own answer.
score: 1
comment on: http://stackoverflow.com/a/22726869
type: AnswerComment

http://stackoverflow.com/comment/34665498
comment on: http://stackoverflow.com/q/22743247
has text: well. it is in fact a homework assignment. I am a novice and i really am not able to understand how to count the constructs. if u can then pease give me a little hint regarding that with a piece of code or something
score: 0
type: Comment
type: QuestionComment

mockito
tags question: http://stackoverflow.com/q/22670841
tags question: http://stackoverflow.com/q/22655553
tag name: mockito
tags question: http://stackoverflow.com/q/22665919
tags question: http://stackoverflow.com/q/22731488
tags question: http://stackoverflow.com/q/22782848
tags question: http://stackoverflow.com/q/22722930
tags question: http://stackoverflow.com/q/22714359
tags question: http://stackoverflow.com/q/22658624
tags question: http://stackoverflow.com/q/22724946
type: Tag
tags question: http://stackoverflow.com/q/22751541
tags question: http://stackoverflow.com/q/22741941
tags question: http://stackoverflow.com/q/22671145
tags question: http://stackoverflow.com/q/22775281
tags question: http://stackoverflow.com/q/22649651
tags question: http://stackoverflow.com/q/22784952
tags question: http://stackoverflow.com/q/22707031

http://stackoverflow.com/q/22806800
score: 0
has answer: http://stackoverflow.com/a/22807084
answer count: 1
type: UnansweredQuestion
has body: I have to exposed a REST servivce, This service will take json string and then it will vaerify against the json schema, to check if input json string confirms the json schema. If input json string confirms the schmea then i have to create a asynch thread which will process the json data. Please guide , how can i perform following: Json string validation against json scheam using Google's Gson. How can i create asynch thread which will be process my json request after the validation is successfull. If the validation is not possible using Google's Gson, then what other logic i can use.
has title: JSON string validation with Google's Gson?
tagged with: java
tagged with: http://stackoverflow.com/tag/json
type: Question

cryptography
tag name: cryptography
type: Tag
tags question: http://stackoverflow.com/q/22783294
tags question: http://stackoverflow.com/q/22661097
tags question: http://stackoverflow.com/q/22757681

http://stackoverflow.com/comment/34625136
type: QuestionComment
has text: Try dropping withoutProcedureColumnMetaDataAccess() call.
comment on: http://stackoverflow.com/q/22694486
score: 0
type: Comment

http://stackoverflow.com/comment/34650570
type: Comment
comment on: http://stackoverflow.com/a/22733539
has text: @Saml92 Added code at the end of the post to show how to loop through all fixtures in a body
score: 0
type: AnswerComment

http://stackoverflow.com/comment/34863432
comment on: http://stackoverflow.com/a/22798758
type: Comment
has text: Alright I'll explain it better. If you have a character moving down the screen and the canvas translating as well, the canvas will eventually be in a position where the bitmap is eventually not shown anymore. How would you be able to draw a bitmap after the next one in succession so that the character appears to be moving down the bitmap endlessly?
score: 0
type: AnswerComment

http://stackoverflow.com/q/22726903
has title: How to download tweets for a phrase from twitter
type: AnsweredQuestion
downvote count: 0
has comment: http://stackoverflow.com/comment/34636696
score: 1
has comment: http://stackoverflow.com/comment/34636756
favorite count: 0
type: Question
accepted answer: http://stackoverflow.com/a/22734247
has body: I'm doing a project on Twitter data and want to be able to download tweets and the user who tweeted it for a given keyword. I want to download say around 5000 tweets for each such keyword, may be around 4 such words. How do I start with it ? I'm trying to found some resources online and many of them are in Python or they are outdated with old API. I want to use Java for downloading the tweets. Any suggestions on good libraries to do this or tutorials will be helpful. I also went through the Twitter API docs in twitter website and I do not have time at this moment to implement all myself using their API. I'm trying to find if there is a quick off the shelf way using any library.
has comment: http://stackoverflow.com/comment/34637805
upvote count: 1
answer count: 1
has comment: http://stackoverflow.com/comment/34636888
tagged with: java
tagged with: twitter
has answer: http://stackoverflow.com/a/22734247

http://stackoverflow.com/comment/34729242
type: Comment
has text: That sounds perfect. I will have a look at finmath - just need to get to grips with some of the financial terminology!
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/22768852

http://stackoverflow.com/q/22692300
has comment: http://stackoverflow.com/comment/34573500
has answer: http://stackoverflow.com/a/22692425
answer count: 4
has body: I am learning Android and taking the MOOC offered by Maryland University. In one of the lectures I noticed the following line of code: String output = (val == answer) ? "42" : "We may never know"; My guess is that this is equivalent to: if(val == answer){ String output = "42"; }else{ String output = "We may never know"; } Is my assumption correct? PS: Is there anywhere besides coursera where I can take certified android classes online?
tagged with: java
has answer: http://stackoverflow.com/a/22692355
upvote count: 1
downvote count: 1
type: Question
has title: Java grammar questions
score: 0
has comment: http://stackoverflow.com/comment/34573571
has comment: http://stackoverflow.com/comment/34573233
favorite count: 0
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/22692392
tagged with: android
has answer: http://stackoverflow.com/a/22692371

http://stackoverflow.com/comment/34756264
comment on: http://stackoverflow.com/a/22793657
type: Comment
score: 1
type: AnswerComment
has text: @user3472788 Don't forget to check this as a correct answer ;)

http://stackoverflow.com/comment/34531018
has text: Your logic escapes me, sorry; can you make the rules more explicit? Between "Wednesday at 10:14am" and "Thursday at 10:14am", as far as I can see, there is only one day's milliseconds worth...
comment on: http://stackoverflow.com/q/22668462
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/34907349
has text: This does not provide an answer to the question. To critique or request clarification from an author, leave a comment below their post - you can always comment on your own posts, and once you have sufficient [reputation](http://stackoverflow.com/help/whats-reputation) you will be able to [comment on any post](http://stackoverflow.com/help/privileges/comment).
comment on: http://stackoverflow.com/a/22877177
score: 0
type: Comment
type: AnswerComment

http://stackoverflow.com/comment/34764751
type: QuestionComment
comment on: http://stackoverflow.com/q/22798220
has text: http://en.wikipedia.org/wiki/Callback_(computer_programming) but to run it back on UI thread you have to post it back to UI handler ... anyway, AsyncTask is easier to use
score: 0
type: Comment

http://stackoverflow.com/comment/34633305
score: 0
type: QuestionComment
comment on: http://stackoverflow.com/q/22724871
type: Comment
has text: What about getIntent().getStringExtra() for your two strings?

http://stackoverflow.com/q/22660907
downvote count: 1
type: Question
has body: I'm trying to add ActionBar-PushToRefresh to my project. I've followed the instructions from Chris Banes Github there: Github ActionBar-PullToRefresh Here is my view from which I want to enable the PullToRefresh feature: &lt;uk.co.senab.actionbarpulltorefresh.library.PullToRefreshLayout xmlns:android="http://schemas.android.com/apk/res/android" android:id="@+id/ptr_layout" android:layout_width="match_parent" android:layout_height="match_parent"&gt; &lt;!-- Your content, here we're using a ScrollView --&gt; &lt;TextView android:layout_width="wrap_content" android:layout_height="wrap_content" android:textAppearance="?android:attr/textAppearanceLarge" android:text="PULLTOREFRESH THE VIEW" android:id="@+id/textView1" /&gt; &lt;ScrollView android:layout_width="match_parent" android:layout_height="match_parent"&gt; &lt;/ScrollView&gt; &lt;/uk.co.senab.actionbarpulltorefresh.library.PullToRefreshLayout&gt; And here is my Activity to display the view: package com.Test.pulltorefresh; import android.app.Activity; import android.os.Bundle; import uk.co.senab.actionbarpulltorefresh.library.ActionBarPullToRefresh; import uk.co.senab.actionbarpulltorefresh.library.Options; import uk.co.senab.actionbarpulltorefresh.library.PullToRefreshLayout; public class MainActivity extends Activity { private PullToRefreshLayout mPullToRefreshLayout; @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); // Now find the PullToRefreshLayout to setup mPullToRefreshLayout = (PullToRefreshLayout) findViewById(R.id.ptr_layout); // Now setup the PullToRefreshLayout ActionBarPullToRefresh.from(this) // Mark All Children as pullable .allChildrenArePullable() // Set the OnRefreshListener //.listener(this) // Finally commit the setup to our PullToRefreshLayout .setup(mPullToRefreshLayout); } } When I launch my app, I got the blank view but nothing happens when I'm trying to PushToRefresh my view. Can someone show me how to f…
has answer: http://stackoverflow.com/a/22660979
has answer: http://stackoverflow.com/a/26442761
answer count: 2
favorite count: 0
type: UnansweredQuestion
tagged with: android
tagged with: android-actionbar
tagged with: pull-to-refresh
upvote count: 2
score: 1
tagged with: java
has title: ActionBar-PullToRefresh nothing happens

http://stackoverflow.com/a/22723121
answers question: http://stackoverflow.com/q/22723096
has comment: http://stackoverflow.com/comment/34630733
downvote count: 0
has comment: http://stackoverflow.com/comment/34629792
score: 4
has body: If you want the one label stuck on the other label, then give the background label a layout and add the overlay JLabel onto it. For example: import java.awt.BorderLayout; import java.awt.Color; import java.awt.Dimension; import java.awt.FlowLayout; import java.awt.Font; import java.awt.image.BufferedImage; import java.io.IOException; import java.net.URL; import javax.imageio.ImageIO; import javax.swing.*; public class OverlayingLabels extends JPanel { private static final String IMAGE_PATH = "https://duke.kenai.com/italian/BouncingDuke.gif"; public OverlayingLabels() { setLayout(new BorderLayout()); try { URL imageUrl = new URL(IMAGE_PATH); BufferedImage image = ImageIO.read(imageUrl); ImageIcon icon = new ImageIcon(image); JLabel bigLabel = new JLabel(icon); bigLabel.setLayout(new FlowLayout()); JLabel littleLabel = new JLabel("Little Label"); littleLabel.setFont(littleLabel.getFont().deriveFont(Font.BOLD, 36)); littleLabel.setForeground(Color.YELLOW); // ****** here we add the little label to the big label ****** bigLabel.add(littleLabel); JScrollPane scrollPane = new JScrollPane(bigLabel); scrollPane.setVerticalScrollBarPolicy(JScrollPane.VERTICAL_SCROLLBAR_ALWAYS); int width = bigLabel.getPreferredSize().width; int height = bigLabel.getPreferredSize().height / 2; scrollPane.getViewport().setPreferredSize(new Dimension(width, height)); add(scrollPane); } catch (IOException e) { e.printStackTrace(); } } private static void createAndShowGui() { OverlayingLabels mainPanel = new OverlayingLabels(); JFrame frame = new JFrame("OverlayingLabels"); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); frame.getContentPane().add(mainPanel); frame.pack(); frame.setLocationByPlatform(true); frame.setVisible(true); } public static void main(String[] args) { SwingUtilities.invokeLater(new Runnable() { public void run() { createAndShowGui(); } }); } }
type: Answer
has comment: http://stackoverflow.com/comment/34629822
has comment: http://stackoverflow.com/comment/34630434
upvote count: 4

http://stackoverflow.com/comment/34636515
type: Comment
has text: I have checked it 20 times but the values are same... its 0.85714287 at 565 position. I am sure its your bug in code...
score: 0
type: QuestionComment
comment on: http://stackoverflow.com/q/22726755

http://stackoverflow.com/comment/39419471
score: 1
type: AnswerComment
comment on: http://stackoverflow.com/a/25292049
type: Comment
has text: `XSSFWorkbook` is used to open `.xlsx` type files, your proposed solution throws an `InvalidFormatException` and does not remedy the problem.

http://stackoverflow.com/comment/34717037
type: Comment
has text: The instance variable and the return type is only an example to simplify the problem. The object returned in my project is really a HashMap.
comment on: http://stackoverflow.com/a/22766751
score: 0
type: AnswerComment

http://stackoverflow.com/a/22691309
has body: Check periodically if the thread is still alive with Thread.isAlive() before instanciating a new one.
type: Answer
answers question: http://stackoverflow.com/q/22691039
score: 0

http://stackoverflow.com/a/22791070
score: 0
has comment: http://stackoverflow.com/comment/34753447
type: Answer
answers question: http://stackoverflow.com/q/22790716
has body: Try This : import java.awt.*; import java.awt.event.*; import javax.swing.*; import javax.swing.border.*; class SwingLayoutDemo { private JFrame mainFrame; private JLabel headerLabel; private JLabel statusLabel; private JPanel controlPanel; private JLabel msglabel; public SwingLayoutDemo(){ prepareGUI(); } public static void main(String[] args){ SwingLayoutDemo swingLayoutDemo = new SwingLayoutDemo(); swingLayoutDemo.showGridBagLayoutDemo(); } private void prepareGUI(){ mainFrame = new JFrame("Java SWING Examples"); mainFrame.setSize(400,400); mainFrame.setLayout(new GridLayout(3, 1)); headerLabel = new JLabel("",JLabel.CENTER ); statusLabel = new JLabel("",JLabel.CENTER); statusLabel.setSize(350,100); mainFrame.addWindowListener(new WindowAdapter() { public void windowClosing(WindowEvent windowEvent){ System.exit(0); } }); controlPanel = new JPanel(); controlPanel.setBorder(new TitledBorder ( new LineBorder (Color.black, 5), "Title String")); controlPanel.add(new JLabel("TitledBorder using LineBorder")); controlPanel.setLayout(new FlowLayout()); mainFrame.add(headerLabel); mainFrame.add(controlPanel); mainFrame.add(statusLabel); mainFrame.setVisible(true); } private void showGridBagLayoutDemo(){ headerLabel.setText("Layout in action: GridBagLayout"); JPanel panel = new JPanel(); panel.setBackground(Color.darkGray); panel.setSize(300,300); GridBagLayout layout = new GridBagLayout(); panel.setLayout(layout); GridBagConstraints gbc = new GridBagConstraints(); gbc.fill = GridBagConstraints.HORIZONTAL; gbc.gridx = 0; gbc.gridy = 0; panel.add(new JButton("Button 1"),gbc); gbc.gridx = 1; gbc.gridy = 0; panel.add(new JButton("Button 2"),gbc); gbc.fill = GridBagConstraints.HORIZONTAL; gbc.ipady = 20; gbc.gridx = 0; gbc.gridy = 1; panel.add(new JButton("Button 3"),gbc); gbc.gridx = 1; gbc.gridy = 1; panel.add(new JButton("Button 4"),gbc); gbc.gridx = 0; gbc.gridy = 2; gbc.fill = GridBagConstraints.HORIZONTAL; gbc.gridwidth = 2; panel.add(new JButton("Button 5"),gbc); control…

http://stackoverflow.com/comment/34704095
has text: @user3086819 The code I posted to print the splittedArray will show you all your elements in one row, just an example of how you can access them. Both options contain already all the elements, I mean they are already stored "somewhere". If you want to access the second column of the first row of the matrix: `matrix.get(0).get(1)`. splittedArray contains all your elements in one single row/column (as you would like to think about it).
comment on: http://stackoverflow.com/a/22762875
score: 0
type: AnswerComment
type: Comment

http://stackoverflow.com/q/22708292
tagged with: android
tagged with: android-activity
favorite count: 0
has comment: http://stackoverflow.com/comment/34602844
linked to: http://stackoverflow.com/q/20469023
type: UnansweredQuestion
upvote count: 1
linked to: http://stackoverflow.com/q/5179041
has body: In my app have some Activities, but in a particular point 've the stack otherActivities -> A -> B -> newA Now, i've some weird things to do: -if I'm in B and I press the back button i will return in A. -if I'm in newA and press back I don't want to see neither A and B, but return to the activity stack (already Achieved to skip B)
answer count: 0
score: 1
tagged with: stack
linked to: http://stackoverflow.com/q/12776981
tagged with: java
has title: Remove a specific previous activity from stack
type: Question
duplicate of: http://stackoverflow.com/q/12776981
downvote count: 0

http://stackoverflow.com/a/22944678
has body: I've fixed the the issue by doing the following. After solving those steps, I was able to run the site on Tomcat without any issues: Marked the scopes as "provided" in the pom files for spring. Marked the scopes as "provided" in the pom files for all other libraries. Fixed sdk version mismatch issue
type: AcceptedAnswer
score: 8
type: Answer
downvote count: 0
accepted answer of: http://stackoverflow.com/q/22768037
upvote count: 8
answers question: http://stackoverflow.com/q/22768037

http://stackoverflow.com/a/22753525
has body: public class YourActivity extends Activity { private ListView lv; public void onCreate(Bundle saveInstanceState) { super.onCreate(saveInstanceState); setContentView(R.layout.your_layout); lv = (ListView) findViewById(R.id.your_list_view_id); // Instanciating an array list (you don't need to do this, // you already have yours). List&lt;String&gt; your_array_list = new ArrayList&lt;String&gt;(); your_array_list.add("foo"); your_array_list.add("bar"); // This is the array adapter, it takes the context of the activity as a // first parameter, the type of list view as a second parameter and your // array as a third parameter. ArrayAdapter&lt;String&gt; arrayAdapter = new ArrayAdapter&lt;String&gt;( this, android.R.layout.simple_list_item_1, your_array_list ); lv.setAdapter(arrayAdapter); } }
score: 0
answers question: http://stackoverflow.com/q/22753454
type: Answer

http://stackoverflow.com/comment/34716951
type: QuestionComment
comment on: http://stackoverflow.com/q/22771471
has text: I have read answers and they are saying `StringBuilder` object points to same reference so we can change then what if I made the reference to `null` why I am still getting `ReturnCool` as answer why not `null`
score: 0
type: Comment

http://stackoverflow.com/q/22731506
possible better answer: http://stackoverflow.com/a/22731720
accepted answer: http://stackoverflow.com/a/22731713
answer count: 2
has title: How to query with email id using Hibernate using Session.get()?
upvote count: 1
has answer: http://stackoverflow.com/a/22731713
favorite count: 0
tagged with: hibernate-mapping
type: AnsweredQuestion
downvote count: 0
score: 1
tagged with: java
tagged with: hibernate
has answer: http://stackoverflow.com/a/22731720
type: Question
has body: I am just getting started with Hibernate. And I'm building a sample application where I'm signing up users by their email address. And when they log in, they use that email address and password. Now, how do I get/retrieve a record/result while querying with their email ids? My code looks like this: Configuration config = new Configuration(); SessionFactory sessionFactory = config.configure().buildSessionFactory(); Session session = sessionFactory.openSession(); try{ Transaction tx = session.beginTransaction(); LoginBean L = (LoginBean)session.get(LoginBean.class,loginBean.getEmail()); }catch(HibernateException HE){ System.out.println(HE.getMessage()); } Of course the email field is a String. And Session.get() takes class,integer as its arguments. I do have a primary key of type Integer but I'd like to do a search/get using the email field. How do I go about it?

http://stackoverflow.com/q/22723772
type: Question
answer count: 2
has comment: http://stackoverflow.com/comment/34631426
score: 0
has comment: http://stackoverflow.com/comment/34631067
type: UnansweredQuestion
has title: Find the minimum distance beween 2 nodes
has body: Can anyone help me figure it out how to solve my problem. I need to find the shortest path between 2 given nodes. So far I have managed to save all posible paths in a list, and now I'm trying to find the minimal distance. here is my code: public class A { private static int[][] adjacency = new int [6][6]; static int n = 6; private static final int START = 1; private static final int END = 4; private Map&lt;Integer, LinkedHashSet&lt;Integer&gt;&gt; map = new HashMap(); private Map&lt;Integer, List&lt;Integer&gt;&gt; pathsFound = new HashMap(); public void addEdge(int node1, int node2) { LinkedHashSet&lt;Integer&gt; adjacent = map.get(node1); if(adjacent==null) { adjacent = new LinkedHashSet(); map.put(node1, adjacent); } adjacent.add(node2); } public LinkedList&lt;Integer&gt; adjacentNodes(Integer last) { LinkedHashSet&lt;Integer&gt; adjacent = map.get(last); if(adjacent==null) { return new LinkedList(); } return new LinkedList&lt;Integer&gt;(adjacent); } public static void main(String[] args) { LinkedList&lt;Integer&gt; visited = new LinkedList&lt;Integer&gt;(); visited.add(START); A graph = new A(); for (int i=0;i&lt;n;i++) for (int j=0;j&lt;n;j++) adjacency[i][j] = 0; adjacency[0][1] = 1; adjacency[0][2] = 2; adjacency[1][0] = 1; adjacency[1][3] = 5; adjacency[1][4] = 9; adjacency[1][5] = 6; adjacency[2][0] = 2; adjacency[2][4] = 7; adjacency[2][5] = 2; adjacency[3][1] = 5; adjacency[4][1] = 9; adjacency[4][2] = 7; adjacency[4][5] = 1; adjacency[5][1] = 6; adjacency[5][2] = 2; adjacency[5][4] = 1; graph.addEdge(0,1); graph.addEdge(0,2); graph.addEdge(1,0); graph.addEdge(1,3); graph.addEdge(1,4); graph.addEdge(1,5); graph.addEdge(2,0); graph.addEdge(2,4); graph.addEdge(2,5); graph.addEdge(3,1); graph.addEdge(4,1); graph.addEdge(4,2); graph.addEdge(4,5); graph.addEdge(5,1); graph.addEdge(5,2); graph.addEdge(5,4); graph.breadthFirst(visited); } public void breadthFirst(LinkedList&lt;Integer&gt; visited) { LinkedList&lt;Integer&gt; nodes = adjacentNodes(visited.getLas…
tagged with: java
has answer: http://stackoverflow.com/a/22723882
has answer: http://stackoverflow.com/a/22724020

http://stackoverflow.com/q/22748928
has comment: http://stackoverflow.com/comment/34675992
type: Question
accepted answer: http://stackoverflow.com/a/22749055
has comment: http://stackoverflow.com/comment/34675690
score: 0
tagged with: java
tagged with: http://stackoverflow.com/tag/json
tagged with: gson
has comment: http://stackoverflow.com/comment/34675596
answer count: 1
has body: I need to know if it's possible to do the following. I need to pass some objects over tcp. I choose to convert them to JSON using Gson. But this objects can have different types. Mainly i have: public class NetMessage { public int code; public Object obj; } there is the code and an object it can have different class types. How can I rebuild my object after transfer to it's initial type? Test: public static void main(String[] args) { Gsonizer gs = new Gsonizer(); Invoice v = new Invoice(123, 123, 10.1); NetMessage nm = new NetMessage(2, v); String s = (String) gs.toNet(nm); NetMessage nm2 = (NetMessage) gs.fromNet(s); System.out.println("&gt; " +nm2.code); System.out.println("&gt; " +(Object)nm2.obj.getClass()); &lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt; * } My * marks a totally different type, it's an internal class from Gson lib it prints: class com.google.gson.internal.LinkedTreeMap Again how could I accomplish that I rebuild the object to it's initial type. Edit: Gson deserialize code: public Object fromNet(String obj){ return gsonizer.fromJson(obj, NetMessage.class); }
has comment: http://stackoverflow.com/comment/34676179
has answer: http://stackoverflow.com/a/22749055
has comment: http://stackoverflow.com/comment/34675561
type: AnsweredQuestion
has title: Getting the class of an object

http://stackoverflow.com/q/22712674
downvote count: 2
answer count: 1
has comment: http://stackoverflow.com/comment/34610410
type: UnansweredQuestion
has title: How can i go to previous screen using static variable
has comment: http://stackoverflow.com/comment/34610743
has comment: http://stackoverflow.com/comment/34611363
upvote count: 0
has comment: http://stackoverflow.com/comment/34610464
has answer: http://stackoverflow.com/a/22712974
has comment: http://stackoverflow.com/comment/34611515
favorite count: 0
type: Question
tagged with: android
tagged with: gesture-recognition
score: -2
has body: I have problem implementing this since last 1 hour, I have more then 15 screen and slider menu as well in my code. What i am trying to achieve is when user swipe left a slider should open and when user swipes right he/she should able to go to previous screen where he/she came from. So my problem start's here as i have implemented slider in my project so user can come from any screen out of 15 screen, so to handle this problem i took one static variable and increment it on each screen and then i have checked the value of static variable. Based on static variable's value i am trying to move to previous screen but not able to do. I have implemented SimpleGestureListener in my code. Following is my code. public class ChangeWallpaper extends Activity implements OnClickListener, SimpleGestureListener { //Declaration goes here SimpleGestureFilter detector; then inside onCreate method i have detector = new SimpleGestureFilter(this, this); and finally, @Override public boolean dispatchTouchEvent(MotionEvent me) { // Call onTouchEvent of SimpleGestureFilter class this.detector.onTouchEvent(me); return super.dispatchTouchEvent(me); } @Override public void onSwipe(int direction) { switch (direction) { case SimpleGestureFilter.SWIPE_RIGHT: if (Const.prevNext == 1) { Intent profile = new Intent(ChangeWallpaper.this, Profile_Detail.class); startActivity(profile); break; } else if (Const.prevNext == 3) { Intent comment = new Intent(ChangeWallpaper.this, Comment.class); startActivity(comment); break; } else if (Const.prevNext == 4) { Intent post = new Intent(ChangeWallpaper.this, Post.class); startActivity(post); break; } else if (Const.prevNext == 5) { Intent post2 = new Intent(ChangeWallpaper.this, Post_Two.class); startActivity(post2); break; } else if (Const.prevNext == 6) { Intent chat = new Intent(ChangeWallpaper.this, Chat.class); startActivity(chat); break; } else if (Const.prevNext == 7) { Intent following = new Intent(ChangeWallpaper.this, Following.class); startActivity(f…
has comment: http://stackoverflow.com/comment/34611778
has comment: http://stackoverflow.com/comment/34611288
tagged with: constants
has comment: http://stackoverflow.com/comment/34611475
tagged with: java
tagged with: static-variables

http://stackoverflow.com/a/22668306
downvote count: 0
has body: Threadpool is suitable only when you use it for operations that takes less time to complete. Threadpool threads are not suitable for long running operations, as it can easily lead to thread starvation. If you require your thread to have a specific priority, then threadpool thread is not suitable. You have tasks that cause the thread to block for long periods of time. The thread pool has a maximum number of threads, so a large number of blocked thread pool threads might prevent tasks from starting.
answers question: http://stackoverflow.com/q/22663194
type: Answer
upvote count: 6
score: 6

http://stackoverflow.com/comment/59520842
has text: Also, to make for a great answer, it helps to add textual commentary/descriptions of your provided solution, to help the OP (and future readers!) understand your answer.
comment on: http://stackoverflow.com/a/35931472
score: 1
type: AnswerComment
type: Comment

http://stackoverflow.com/q/22796370
type: UnansweredQuestion
has body: I've created Java based uninstaller - but one problem still exists - how can I delete uninstaller .jar file (and related directories - for example .../SomeApplication/uninstaller/uninstaller.jar) after I close it? It is not very nice to leave some files after uninstall..
tagged with: java
has answer: http://stackoverflow.com/a/22796460
has title: Force delete .jar file after closing it (creating Java uninstaller)
type: Question
tagged with: jar
has answer: http://stackoverflow.com/a/22796473
score: 0
answer count: 2
tagged with: windows

http://stackoverflow.com/q/22750373
downvote count: 0
favorite count: 0
possible better answer: http://stackoverflow.com/a/27004928
tagged with: android
type: AnsweredQuestion
has body: I am trying to calculate the height above map (ignoring topography) given a zoom level. I know the equation for scale at a specific zoom level is 591657550.5/2^(level-1) (https://gis.stackexchange.com/questions/7430/google-maps-zoom-level-ratio), but I am unsure on how to use this information (or whether or not this is the right information) to solve for height above map. Any help is appreciated.
upvote count: 1
has answer: http://stackoverflow.com/a/22776285
accepted answer: http://stackoverflow.com/a/22776285
type: Question
has comment: http://stackoverflow.com/comment/34689823
has title: Calculate height above map given zoom level in google maps
has answer: http://stackoverflow.com/a/27004928
score: 1
tagged with: math
tagged with: java
answer count: 2
tagged with: google-maps
tagged with: google-maps-api-2
has comment: http://stackoverflow.com/comment/34725111

http://stackoverflow.com/comment/34727612
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/22777662
has text: So i should just replace MY_AD_UNIT_ID with 154050.

http://stackoverflow.com/comment/34779611
score: 0
type: Comment
type: QuestionComment
has text: Those voting to close as "unclear" would help us all by adding comments to help clarify the question.
comment on: http://stackoverflow.com/q/22806362

http://stackoverflow.com/q/22793006
tagged with: java-8
has comment: http://stackoverflow.com/comment/34755510
has comment: http://stackoverflow.com/comment/58669405
tagged with: foreach
type: AnsweredQuestion
downvote count: 0
tagged with: java
has answer: http://stackoverflow.com/a/22793335
accepted answer: http://stackoverflow.com/a/22793335
has body: Is there a way to build a forEach method in Java 8 that iterates with an index? Ideally I'd like something like this: params.forEach((idx, e) -&gt; query.bind(idx, e)); The best I could do right now is: int idx = 0; params.forEach(e -&gt; { query.bind(idx, e); idx++; });
type: Question
linked to: http://stackoverflow.com/q/18552005
has answer: http://stackoverflow.com/a/22793114
duplicate of: http://stackoverflow.com/q/18552005
has comment: http://stackoverflow.com/comment/34755122
score: 214
has comment: http://stackoverflow.com/comment/61531696
tagged with: for-loop
answer count: 3
possible better answer: http://stackoverflow.com/a/22793119
has comment: http://stackoverflow.com/comment/34755462
has answer: http://stackoverflow.com/a/22793119
upvote count: 214
favorite count: 0
has title: Java 8 forEach with index
has comment: http://stackoverflow.com/comment/34754910

http://stackoverflow.com/comment/34514084
type: Comment
comment on: http://stackoverflow.com/a/22657297
has text: and yet, it doesnt work, i tried the simplest thing there, exactly the same way u written it..
score: 0
type: AnswerComment

http://stackoverflow.com/a/22705008
type: Answer
score: 1
upvote count: 1
has comment: http://stackoverflow.com/comment/34598452
has body: The Out of Memory issue is something that occurs due to the improper handling of Heap. You must optimise the code to avoid that. As a temporary fix you can increase the heap space. -XX:MaxPermSize=512m -Xms512m -Xmx1024m
downvote count: 0
answers question: http://stackoverflow.com/q/22704852

http://stackoverflow.com/q/22746126
score: 0
has body: HyperJAXB generates @ManyToOne Annotations for XSD 1:1-relationships like: &lt;xs:element name="typeName" type="otherType" /&gt; or &lt;xs:element name="typeName" type="otherType" minOccurs="0" maxOccurs="1" /&gt; This is not the expected behaviour since it should generate @OneToOne Annotations. Well, the customization guide describes that you can customize this behaviour by adding instructions to every single element definition (see http://confluence.highsource.org/display/HJ3/Making+schema-derived+classes+ready+for+JPA, paragraph "Mapping as one-to-one"). This is fine, but I need a global configuration for this. Can anybody please tell me, what to put in bindings.xjb to achieve this goal?
answer count: 1
tagged with: java
type: UnansweredQuestion
tagged with: jaxb
tagged with: jpa
has title: HyperJAXB: How to use always @OneToOne instead of @ManyToOne
has answer: http://stackoverflow.com/a/22747610
type: Question
tagged with: xsd
tagged with: hyperjaxb

http://stackoverflow.com/q/22667099
score: 1
tagged with: java
answer count: 1
downvote count: 0
favorite count: 0
tagged with: jdialog
has title: Java with many Forms
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/22667133
has body: If I am going about this all wrong please let me know. What I have: JFrame JDialog Main executable What I want to do Have a way to open the JDialog (the class extends the JDialog) and have the JFrame pause and wait for the JDialog to be closed before doing anything else. The JDialog is actually just hidden so I can then call a method to pull the data that the user input. My Issues Cant figure out how to make the JFrame wait until the JDialog is closed before executing more code If possible I would like the JFrame to be disabled until the JDialog is closed.
upvote count: 1
tagged with: swing
type: Question

http://stackoverflow.com/q/22682979
tagged with: layout
has answer: http://stackoverflow.com/a/22683779
has body: i have this simple xml block: however, when i put text in this editText the cursor is a bit to the left. only after filling 80% of the editText the text seems centered. update tried this: but it didn't help <EditText android:id="@+id/verificationCodeEditText" style="@style/textOnBg" android:layout_width="match_parent"
has comment: http://stackoverflow.com/comment/34556412
has title: why is my text in editText not centered horizontally?
has answer: http://stackoverflow.com/a/22683173
downvote count: 0
answer count: 7
has answer: http://stackoverflow.com/a/22683067
tagged with: textview
favorite count: 0
has answer: http://stackoverflow.com/a/22683145
upvote count: 2
possible better answer: http://stackoverflow.com/a/22683067
has answer: http://stackoverflow.com/a/22683176
tagged with: android
has answer: http://stackoverflow.com/a/22683688
type: AnsweredQuestion
score: 2
has answer: http://stackoverflow.com/a/22683364
has comment: http://stackoverflow.com/comment/34556436
accepted answer: http://stackoverflow.com/a/22683173
tagged with: java
type: Question
has comment: http://stackoverflow.com/comment/34556805
tagged with: android-layout
has comment: http://stackoverflow.com/comment/34556471

http://stackoverflow.com/q/22777254
has comment: http://stackoverflow.com/comment/34746266
score: 0
has title: Subclipse icon error (not under version control)
answer count: 0
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/34726766
tagged with: svn
tagged with: java
tagged with: subclipse
has body: I have recently reinstalled Subclipse and next to some of my packages within some projects are a question mark indicating that the project is not under version control. However, it is under version control; .svn files are up to date and command line works fine. If I commit from subclipse, it'll go through fine and the question mark will disappear. However: org.apache.subversion.javahl.ClientException: Entry already exists svn:'/home/user/workspace/ProjectA/src/packageA/file.java' is already under version control
tagged with: eclipse
type: Question
has comment: http://stackoverflow.com/comment/34760932
tagged with: version-control

http://stackoverflow.com/q/22773390
tagged with: manifest
has body: I am currently trying to read and write to excel (xlsx not xls) from java using Apache POI. The problem is I need not only the poi-ooxml jars but also the dependencies. How can I create a class path to link all these together? The ones I am currently using include: poi-ooxml-3.10 poi-ooxml-schemas-3.10 dom4j- 1.6.1 xmlbeans-2.3.0 stax-api-1.0.1 Also do I write them into the poi-ooxml manifest or do I create an entirely new one? Sorry I am a bit of a rookie. This is the poi-ooxml-3.10 manifest just for reference if needed Manifest-Version: 1.0 Ant-Version: Apache Ant 1.8.2 Created-By: 1.7.0_51-b13 (Oracle Corporation) Built-By: yegor Specification-Title: Apache POI Specification-Version: 3.10-FINAL Specification-Vendor: The Apache Software Foundation Implementation-Title: Apache POI Implementation-Version: 3.10-FINAL Implementation-Vendor-Id: org.apache.poi Implementation-Vendor: The Apache Software Foundation
score: 0
answer count: 1
has answer: http://stackoverflow.com/a/22774175
type: UnansweredQuestion
tagged with: excel
tagged with: apache-poi
tagged with: java
has title: How to build a class path to other jar files in a manifest
type: Question

http://stackoverflow.com/a/22663171
type: AcceptedAnswer
downvote count: 0
score: 1
type: Answer
upvote count: 1
accepted answer of: http://stackoverflow.com/q/22662666
answers question: http://stackoverflow.com/q/22662666
has body: Your onDraw() method should look like this: @Override protected void onDraw(Canvas canvas) { paint.setColor(Color.RED); canvas.drawBitmap(size, 0, 0, paint); canvas.drawBitmap( mBitmap, 0, 0, mBitmapPaint); canvas.drawPath( mPath, mPaint); canvas.drawPath( circlePath, circlePaint); } All Bitmap decoding and resizing should be done outside (in the constructor or only when the view is resized), there is no need to decode and resize it every time when the result will be same every time.

http://stackoverflow.com/a/67785926
type: Answer
answers question: http://stackoverflow.com/q/22658322
downvote count: 0
has body: Interesting results for Java 8 and Java 11. I used the code, provided by leventov with little modification: @OutputTimeUnit(TimeUnit.NANOSECONDS) @BenchmarkMode(Mode.AverageTime) @OperationsPerInvocation(BenchmarkMain.N) public class BenchmarkMain { public static final int N = 10000; static List&lt;Integer&gt; sourceList = new ArrayList&lt;&gt;(); static { for (int i = 0; i &lt; N; i++) { sourceList.add(i); } } @Benchmark public List&lt;Double&gt; vanilla() { List&lt;Double&gt; result = new ArrayList&lt;&gt;(sourceList.size() / 2 + 1); for (Integer i : sourceList) { if (i % 2 == 0){ result.add(Math.sqrt(i)); } } return result; } @Benchmark public List&lt;Double&gt; stream() { return sourceList.stream() .filter(i -&gt; i % 2 == 0) .map(Math::sqrt) .collect(Collectors.toCollection( () -&gt; new ArrayList&lt;&gt;(sourceList.size() / 2 + 1))); } /** * @param args the command line arguments */ public static void main(String[] args) throws IOException { org.openjdk.jmh.Main.main(args); } } Java 8: # JMH version: 1.31 # VM version: JDK 1.8.0_262, OpenJDK 64-Bit Server VM, 25.262-b19 # VM invoker: /opt/jdk1.8.0_262/jre/bin/java # VM options: &lt;none&gt; # Blackhole mode: full + dont-inline hint # Warmup: 5 iterations, 10 s each # Measurement: 5 iterations, 10 s each # Timeout: 10 min per iteration # Threads: 1 thread, will synchronize iterations # Benchmark mode: Average time, time/op ... Benchmark Mode Cnt Score Error Units BenchmarkMain.stream avgt 25 10.680 ± 0.744 ns/op BenchmarkMain.vanilla avgt 25 6.490 ± 0.159 ns/op Java 11: # JMH version: 1.31 # VM version: JDK 11.0.2, OpenJDK 64-Bit Server VM, 11.0.2+9 # VM invoker: /opt/jdk-11.0.2/bin/java # VM options: &lt;none&gt; # Blackhole mode: full + dont-inline hint # Warmup: 5 iterations, 10 s each # Measurement: 5 iterations, 10 s each # Timeout: 10 min per iteration # Threads: 1 thread, will synchronize iterations # Benchmark mode: Average time, time/op ... Benchmark Mode Cnt Score Error Units BenchmarkMain.stream avgt…
score: 3
upvote count: 3

http://stackoverflow.com/comment/34686565
type: Comment
type: QuestionComment
has text: You must have missed or using some wrong version Libs...
comment on: http://stackoverflow.com/q/22751385
score: 0

http://stackoverflow.com/q/22678243
downvote count: 0
tagged with: x11
tagged with: applet
has body: I am trying to use X Server on Browser hence i initially tried weirdx-1.0.32.jar . by running the same with java -jar command ,and i faced success by manipulating DISPLAY env variable (2.png). But when i tried to run the applet in browser(on apache server) , i was not able to open my application on XServer (i.e. browser) (1.png), am i missing some configuration ? is there any other alternative for weirdx ?
favorite count: 0
type: UnansweredQuestion
tagged with: xserver
answer count: 0
score: 1
tagged with: java
tagged with: x11-forwarding
upvote count: 1
type: Question
has title: unable to run XServer (wierdx) on browser

http://stackoverflow.com/q/22649378
has answer: http://stackoverflow.com/a/22649545
tagged with: arraylist
score: 0
answer count: 3
tagged with: deduplication
has answer: http://stackoverflow.com/a/22740204
linked to: http://stackoverflow.com/q/2839137
type: UnansweredQuestion
has body: I need your help in java code such as how can I get unique records from an arraylist which is multidimensional array of casting a class of Value objects(setters and getters). I'm reading a table and putting all records in an ararylist of arraylist. "table" will have entire table per say 3 columns 25 rows in which some material numbers are unique and some are duplicated. I wanted to get rid of duplicate material number rows and ONLY get unique material number of rows. ArrayList&lt;EssVO&gt; recordInstance = new ArrayList&lt;EssVO&gt;(); EssVO ESSvorecord = new EssVO(); for (int i = 0; i &lt; table.getNumRows(); i++){ table.setRow(i); ESSvorecord = new EssVO(); ESSvorecord.setCONTRACT_NUMBER(table.getString("CONTRACT_NUMBER")); ESSvorecord.setCONTRACT_LINE_ITEM(table.getString("CONTRACT_LINE_ITEM")); ESSvorecord.setMATERIAL_NUMBER(table.getString("MATERIAL_NUMBER")); recordInstance.add(ESSvorecord); } //Display Iterator&lt;EssVO&gt; itrForSubs = recordInstance.iterator(); while(itrForSubs.hasNext()){ ESSvorecord = itrForSubs.next(); ESSvorecord.getCONTRACT_NUMBER(); ESSvorecord.getCONTRACT_LINE_ITEM(); ESSvorecord.getMATERIAL_NUMBER(); } Appreciate of your input and help. Thanks Raj
has title: How to get unique rows using SET class from an Arraylist of "Arraylist string objects" of Type Setters & Getters class
tagged with: java
has answer: http://stackoverflow.com/a/22650691
type: Question

http://stackoverflow.com/q/22732129
tagged with: p2p
has answer: http://stackoverflow.com/a/28126215
score: 0
tagged with: android
tagged with: wifi
has body: is there a possibility to let an Android app communicate over Wifi P2P with other device, wich has the same app running, without asking the user to communicate for every device. The problem is: I want to make a multiplayer game for many users on the same time and the app should not ask everyone to pair the devices with the others. It should be done in background, without showing messages to the users. Is this possible? Thanks for your help.
type: AnsweredQuestion
tagged with: java
type: Question
accepted answer: http://stackoverflow.com/a/28126215
has title: Android Wifi P2P without asking user
answer count: 1

http://stackoverflow.com/comment/34736507
score: 0
comment on: http://stackoverflow.com/q/22782734
type: Comment
type: QuestionComment
has text: ok, will paste relevant pieces

http://stackoverflow.com/q/22685153
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/34560033
tagged with: java
has answer: http://stackoverflow.com/a/24606302
type: Question
accepted answer: http://stackoverflow.com/a/24606302
has title: Subpackage for custom events in Java
has comment: http://stackoverflow.com/comment/34560100
has comment: http://stackoverflow.com/comment/34560002
has comment: http://stackoverflow.com/comment/34613059
score: 0
answer count: 1
tagged with: events
tagged with: listener
has comment: http://stackoverflow.com/comment/34565129
has body: Lets assume I have got the four classes divided into two packages: I created packages myapp.engine and myapp.engine.events for its event-handling stuff. As you can see, this creates cyclic dependecy between packages. How to avoid this? In other words: where is the best place to keep event-related classes?
tagged with: package
has comment: http://stackoverflow.com/comment/34613295
has comment: http://stackoverflow.com/comment/34560634

http://stackoverflow.com/a/22790996
has comment: http://stackoverflow.com/comment/58687191
type: Answer
upvote count: 1
downvote count: 1
has comment: http://stackoverflow.com/comment/58673794
type: AcceptedAnswer
score: 0
accepted answer of: http://stackoverflow.com/q/22790222
answers question: http://stackoverflow.com/q/22790222
has body: There is several way to craete JSON object.. make it manually like string,use MAP.And yes there is an helper class in ES that is XContentBuilder .for more info about that @refer. As per my considerations its better use any JSON API to create a valid object and easy to use.refer

http://stackoverflow.com/a/40556381
upvote count: 85
has body: Use Guava's MoreCollectors.onlyElement() (source code). A collector that takes a stream containing exactly one element and returns that element. The returned collector throws an IllegalArgumentException if the stream consists of two or more elements, and a NoSuchElementException if the stream is empty. This does what you want, throwing an exception if the stream does not contain exactly one element. Usage: import static com.google.common.collect.MoreCollectors.onlyElement; User match = users.stream().filter((user) -&gt; user.getId() &lt; 0).collect(onlyElement());
downvote count: 1
answers question: http://stackoverflow.com/q/22694884
has comment: http://stackoverflow.com/comment/69409024
score: 84
type: Answer

http://stackoverflow.com/comment/34765276
comment on: http://stackoverflow.com/a/22798501
type: AnswerComment
has text: The first one is because you are using `request.getParameter("id")` but your form has no input with `name='id'`: `<input type='hidden' name='id' value='<%=id%>' />`
type: Comment
score: 0

http://stackoverflow.com/q/22786184
tagged with: methods
downvote count: 1
has answer: http://stackoverflow.com/a/22786243
tagged with: arraylist
answer count: 4
type: AnsweredQuestion
score: 1
favorite count: 0
has answer: http://stackoverflow.com/a/22786304
tagged with: return
type: Question
upvote count: 2
has answer: http://stackoverflow.com/a/22786232
accepted answer: http://stackoverflow.com/a/22786243
has answer: http://stackoverflow.com/a/22786233
has body: public ArrayList&lt;detailTom&gt; read() { try { /*System.out.println("Hello");*/ BufferedReader in = new BufferedReader(new FileReader("G:/sample.txt")); String data; ArrayList &lt;String&gt; list = new ArrayList&lt;String&gt;(); ArrayList&lt;String&gt; tomList= new ArrayList&lt;String&gt;(); ArrayList&lt;detailTom&gt; tomData = new ArrayList&lt;detailTom&gt;(); while((data= in.readLine())!=null) { /*System.out.println(data);*/ String[] splits=data.split(" "); for(int i=0;i&lt;splits.length;i++) { if (splits[i].equals("tom")) { detailTom dummy= new detailTom(); dummy.name="tom"; dummy.mark1=Integer.parseInt(splits[1]); dummy.mark2=Integer.parseInt(splits[2]); dummy.mark3=Integer.parseInt(splits[3]); dummy.mark4=Integer.parseInt(splits[4]); dummy.mark5=Integer.parseInt(splits[5]); tomData.add(dummy); } } } } catch (FileNotFoundException ex) { Logger.getLogger(MyInterface.class.getName()).log(Level.SEVERE, null, ex); } catch (IOException ex) { Logger.getLogger(MyInterface.class.getName()).log(Level.SEVERE, null, ex); } return tomData; } Hello! I am trying to return a variable tomData which is an object of class ArrayList. detailTom is a class which has variables , getters , setters and so forth . What I want to do is my method read() to return tomData. But I get an error at the line return tomData. The error says:- cannot find symbol Symbol: variable tomData
has title: Returning a arraylist variable from a method in java
possible better answer: http://stackoverflow.com/a/22786232
tagged with: java

http://stackoverflow.com/comment/34616977
score: 0
type: Comment
type: QuestionComment
has text: if there is error in your code..than correct it ur self..;)
comment on: http://stackoverflow.com/q/22716265

http://stackoverflow.com/q/22750567
has body: Consider the following class that just gets an IP and port number : package view; import java.awt.*; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import java.net.InetAddress; import javax.swing.*; import javax.swing.border.EmptyBorder; /** * Server side * @author X * */ class ServerConnector implements ActionListener { private JFrame m_frame = null; private JTextField m_serverIP; private JTextField m_serverPort; // you can use also JPasswordField private JButton m_submitButton; // location of the jframe private final int m_centerX = 500; private final int m_centerY = 300; // dimensions of the jframe private final int m_sizeX = 1650; private final int m_sizeY = 150; private String m_ip; private String m_port; private boolean ready = false; /** * Ctor */ ServerConnector() { m_frame = new JFrame("Sever Side Listener"); m_frame.setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE); m_serverIP = new JTextField(20); m_serverPort = new JTextField(20); JPanel gui = new JPanel(new BorderLayout(3,3)); gui.setBorder(new EmptyBorder(5,5,5,5)); gui.setSize(m_sizeX , m_sizeY); m_frame.setContentPane(gui); JPanel labels = new JPanel(new GridLayout(0,1)); JPanel controls = new JPanel(new GridLayout(0,1)); gui.add(labels, BorderLayout.WEST); gui.add(controls, BorderLayout.CENTER); labels.add(new JLabel("Server IP: ")); controls.add(m_serverIP); labels.add(new JLabel("Server Port: ")); controls.add(m_serverPort); m_submitButton = new JButton("Start Listening"); m_submitButton.addActionListener(this); gui.add(m_submitButton, BorderLayout.SOUTH); m_frame.setLocation(m_centerX , m_centerY); m_frame.setSize(m_sizeX , m_sizeY); m_frame.pack(); m_frame.setVisible(true); } public static void main(String[] args) { new ServerConnector(); } @Override public void actionPerformed(ActionEvent event) { Object object = event.getSource(); if (object == this.m_submitButton) { // grab all values from the connection box // if one of them is missing then display an alert message …
tagged with: while-loop
linked to: http://stackoverflow.com/q/22744326
tagged with: dependencies
linked to: http://stackoverflow.com/q/22620807
type: AnsweredQuestion
tagged with: java
type: Question
has answer: http://stackoverflow.com/a/22750600
linked to: http://stackoverflow.com/q/22288265
has title: Break a while(true) dependency from class A that depends on class B
accepted answer: http://stackoverflow.com/a/22750600
score: 0
answer count: 1

http://stackoverflow.com/comment/34707506
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/22765805
score: 0
has text: like I said, `please read the documentation for rawQuery.` It does not do what you think it does (or your variables are poorly named).

http://stackoverflow.com/q/22684770
has body: I am trying to parse a html response which is in xml format. DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance(); DocumentBuilder builder = factory.newDocumentBuilder(); InputStream in = new FileInputStream(htmlresponse); InputSource inputSource = new InputSource(new InputStreamReader(in)); Document xmlDocument = builder.parse(inputSource); //Error is here However I get an error on line which I have commented on. Error - "the method parse(InputStream) in the type DocumentBuilder is not applicable for the arguments (InputSource)"
has answer: http://stackoverflow.com/a/22685052
has title: Document builder from xml gives error
type: UnansweredQuestion
tagged with: http://stackoverflow.com/tag/html
tagged with: http://stackoverflow.com/tag/xml
has answer: http://stackoverflow.com/a/31809251
tagged with: java
type: Question
score: 0
answer count: 2
tagged with: xml-parsing

http://stackoverflow.com/comment/34731418
comment on: http://stackoverflow.com/q/22779889
score: 0
type: Comment
type: QuestionComment
has text: You utilize a graphics library. If you ask which graphics library you should use, this will become opinion based.

http://stackoverflow.com/a/22785300
type: AcceptedAnswer
downvote count: 0
type: Answer
has body: use HttpConnection.Response's method contentType to get content type and decide accordingly Connection.Response res = Jsoup.connect("http://www.google.com/").timeout(10*1000).execute(); String contentType=res.contentType();
score: 1
upvote count: 1
answers question: http://stackoverflow.com/q/22782380
accepted answer of: http://stackoverflow.com/q/22782380

http://stackoverflow.com/q/22770769
answer count: 1
accepted answer: http://stackoverflow.com/a/22770795
tagged with: variables
tagged with: awt
score: 0
has answer: http://stackoverflow.com/a/22770795
has body: I'm trying to program an BMI calculator, but for some reason I can't get it to work. I'm quite a noob at Java so please be considerate :). Names of classes and variables are in Swedish, but aren't that hard to understand. e.g. langd is length and vikt is weight. This is my code: package prog2; import java.awt.*; import java.awt.event.*; import java.text.DecimalFormat; import javax.swing.*; public class BMI extends JFrame{ JTextField langdfalt; JTextField viktfalt; DecimalFormat fmt = new DecimalFormat ("0.00"); JLabel resultat; BMI(){ super("BMI Kalkylator 1.0"); setLayout(new FlowLayout()); JLabel langd = new JLabel ("Längd (m):"); add(langd); langdfalt = new JTextField(4); add(langdfalt); JLabel vikt = new JLabel ("Vikt (kg):"); add(vikt); viktfalt = new JTextField(4); add(viktfalt); JButton berakna = new JButton ("Beräkna"); berakna.addActionListener(new BeraknaLyss()); add(berakna); setDefaultCloseOperation(EXIT_ON_CLOSE); setSize(330, 100); setVisible(true); setLocation(820, 400); JLabel bmiVisning = new JLabel("Ditt BMI-värde är"); add (bmiVisning); JLabel resultat = new JLabel (""); add (resultat); } class BeraknaLyss implements ActionListener{ public void actionPerformed(ActionEvent ave){ double vikt = Double.parseDouble(viktfalt.getText()); double langd = Double.parseDouble(langdfalt.getText()); int bmi = (int)beraknaBMI(vikt, langd); **resultat.setText(String.valueOf(bmi));** } } public double beraknaBMI(double vikt, double langd){ return vikt / (langd * langd); } public static void main(String[] args) { new BMI(); } } And the error I'm getting is NullPointerException at row 43 which I bolded. Here is the all the error code: Exception in thread "AWT-EventQueue-0" java.lang.NullPointerException at prog2.BMI$BeraknaLyss.actionPerformed(BMI.java:43) at javax.swing.AbstractButton.fireActionPerformed(Unknown Source) at javax.swing.AbstractButton$Handler.actionPerformed(Unknown Source) at javax.swing.DefaultButtonModel.fireActionPerformed(Unknown Source) at java…
has title: I'm trying to create a BMI-calculator with Java using GUI, but I recieve an syntaxerror
tagged with: swing
type: AnsweredQuestion
tagged with: java
type: Question

http://stackoverflow.com/comment/34533081
score: 0
type: Comment
type: QuestionComment
has text: @user3465486: What you're saying is "I don't want to use it the way the API was designed to be used, I want to hack around it." It's not designed to be used that way; use `putAll`. `loadAll` is *only* designed to be used to load a group of keys passed to it in the `Iterable`, possibly in some more efficient way.
comment on: http://stackoverflow.com/q/22669278

http://stackoverflow.com/q/22651909
has comment: http://stackoverflow.com/comment/34501840
tagged with: java
has title: Casting from an int to char
has comment: http://stackoverflow.com/comment/34501916
type: Question
has comment: http://stackoverflow.com/comment/34501940
tagged with: casting
answer count: 1
linked to: http://stackoverflow.com/q/833709
score: 0
has comment: http://stackoverflow.com/comment/34501862
has body: so I want to cast from an integer to a character, like 65 to A, but when I do System.out.println((char)65); it prints out in eclipse a box with a question mark in it. How can I cast from an int to a char? Thanks!
has answer: http://stackoverflow.com/a/22651953
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/34501929
has comment: http://stackoverflow.com/comment/34501980

http://stackoverflow.com/q/22680691
tagged with: hashtable
type: UnansweredQuestion
tagged with: swing
type: Question
tagged with: java
has title: Displaying HashTable Data In JTable?
tagged with: jtable
linked to: http://stackoverflow.com/q/9132987
score: 0
has answer: http://stackoverflow.com/a/22680749
has body: I Have a hash Table hashtable c = new Hashtable(); Employee emp = new Employee("E1001","Sky"); c.put("E1001",emp); Then I have a JTable Object[][] data = { {"", ""}, }; String[] headers = {"Employee Code", "Employee First Name"}; JTable table = new JTable(data, headers); I Cant seem to Figure out how to add the hashtable items into the JTable
answer count: 1

http://stackoverflow.com/comment/34570725
has text: I tried and everything works fine. But when one second is left on the count down it takes much more time to close the activity. It looks like it adds one more second. Do you also have the same problem?
type: AnswerComment
comment on: http://stackoverflow.com/a/22690106
score: 0
type: Comment

http://stackoverflow.com/comment/34778118
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/22805909
has text: How about adding those threads to a List and check whether they completed or not. and make sure to wait till completed http://stackoverflow.com/questions/702415/how-to-know-if-other-threads-have-finished

http://stackoverflow.com/comment/34519515
score: 0
type: QuestionComment
type: Comment
has text: Kalyan: Sorry, unless you meant declaring MyApplication the manifest in a different way?
comment on: http://stackoverflow.com/q/22661128

http://stackoverflow.com/comment/34522610
type: AnswerComment
has text: @Tonio: Yes, you're quite right: shifts by x and y axises and rotation transformations. But according the picture in the question it is the simplest (canonical) ellipse that's required. So I've omited x = x + dx; y = y + dy; and the rotation matrix
type: Comment
comment on: http://stackoverflow.com/a/22663682
score: 0

http://stackoverflow.com/a/22726196
downvote count: 0
upvote count: 2
has body: createQuery is used to create an HQL query which is Hibernate's custom query language similar to SQL. You want createSQLQuery.
type: Answer
score: 2
answers question: http://stackoverflow.com/q/22726128

http://stackoverflow.com/comment/34694835
type: AnswerComment
comment on: http://stackoverflow.com/a/22759136
score: 0
type: Comment
has text: try the aboves aswell. Also did you recompile the jar file ?

http://stackoverflow.com/a/22668817
has body: How about a simpler: return S1.replace(S2, ""); Note that your example does not work: Mississippi River becomes Mssippi River. If you actually want to remove all the is and ss, you could use a regex: return S1.replaceAll("[" + S2 + "]", ""); which returns Mpp Rver - that assumes that s2 does not contain any regex-specific characters.
answers question: http://stackoverflow.com/q/22668741
score: 2
upvote count: 3
downvote count: 1
has comment: http://stackoverflow.com/comment/34531608
has comment: http://stackoverflow.com/comment/34531656
has comment: http://stackoverflow.com/comment/34531974
type: Answer
has comment: http://stackoverflow.com/comment/34531590

http://stackoverflow.com/comment/34528038
type: Comment
has text: convert the numeric strings to numbers `Double.parseDouble(String)` and do a series of `if` statements to find value of operator `if(Strings.equal("*",operator))` etc.
type: QuestionComment
comment on: http://stackoverflow.com/q/22666861
score: 1

selenium-webdriver
tags question: http://stackoverflow.com/q/22705488
tags question: http://stackoverflow.com/q/22683166
tags question: http://stackoverflow.com/q/22679454
tags question: http://stackoverflow.com/q/22780964
tags question: http://stackoverflow.com/q/22656615
tags question: http://stackoverflow.com/q/22657831
tags question: http://stackoverflow.com/q/22711974
tags question: http://stackoverflow.com/q/22726717
tags question: http://stackoverflow.com/q/22659139
tags question: http://stackoverflow.com/q/22778004
tags question: http://stackoverflow.com/q/22711441
tags question: http://stackoverflow.com/q/22768882
tags question: http://stackoverflow.com/q/22714112
tags question: http://stackoverflow.com/q/22707284
tags question: http://stackoverflow.com/q/22776355
tags question: http://stackoverflow.com/q/22762401
tags question: http://stackoverflow.com/q/22800382
tags question: http://stackoverflow.com/q/22651007
tags question: http://stackoverflow.com/q/22709200
tags question: http://stackoverflow.com/q/22657736
tag name: selenium-webdriver
tags question: http://stackoverflow.com/q/22743026
tags question: http://stackoverflow.com/q/22767591
tags question: http://stackoverflow.com/q/22677801
tags question: http://stackoverflow.com/q/22783045
tags question: http://stackoverflow.com/q/22712378
tags question: http://stackoverflow.com/q/22807527
tags question: http://stackoverflow.com/q/22704709
tags question: http://stackoverflow.com/q/22683555
tags question: http://stackoverflow.com/q/22705045
tags question: http://stackoverflow.com/q/22779522
type: Tag
tags question: http://stackoverflow.com/q/22729341
tags question: http://stackoverflow.com/q/22706049
tags question: http://stackoverflow.com/q/22711171
tags question: http://stackoverflow.com/q/22707732
tags question: http://stackoverflow.com/q/22763752
tags question: http://stackoverflow.com/q/22760828
tags question: http://stackoverflow.com/q/22652692

http://stackoverflow.com/comment/34512169
type: AnswerComment
comment on: http://stackoverflow.com/a/22657670
type: Comment
has text: i Dont have login page i am doing login through facebook??
score: 0

http://stackoverflow.com/a/22799271
accepted answer of: http://stackoverflow.com/q/22799067
downvote count: 0
score: 4
answers question: http://stackoverflow.com/q/22799067
type: AcceptedAnswer
type: Answer
has comment: http://stackoverflow.com/comment/34766788
upvote count: 4
has body: The Java 8 answer: int[] results = Arrays.stream(arr) .filter(s -&gt; s.matches("-?[0-9]+")) .mapToInt(s -&gt; Integer.parseInt(s)) .toArray(); EDIT: Even better: int[] results = Arrays.stream(arr) .filter(s -&gt; s.matches("-?[0-9]+")) .mapToInt(Integer::parseInt) .toArray(); demonstrating yet another new cool language feature. I should have seen this the first time. It's pathetic that I haven't yet mastered Java 8 despite its being officially available for a whole two weeks now.

filewriter
tag name: filewriter
tags question: http://stackoverflow.com/q/22777605
type: Tag

http://stackoverflow.com/q/22667156
upvote count: 5
has answer: http://stackoverflow.com/a/22669325
has comment: http://stackoverflow.com/comment/34529464
accepted answer: http://stackoverflow.com/a/22669325
favorite count: 0
has comment: http://stackoverflow.com/comment/34537421
tagged with: annotations
has body: I'm instantiating some beans by XML configuration and instance factory methods: &lt;bean id="galleryBeanFactory" class="de.tikron.webapp.gallery.bean.XmlGalleryBeanFactory" /&gt; &lt;bean id="pictureBean" factory-bean="galleryBeanFactory" factory-method="createPictureBean" scope="prototype" /&gt; I instantiate my prototype beans programmatic by BeanFactory.getBean("bean", arguments...): BeanFactory bf = ContextLoader.getCurrentWebApplicationContext(); PictureBean pictureBean = (PictureBean) bf.getBean("pictureBean", picture); With Spring 3 I want to change to annotated java-based bean configuration. Here is my FactoryBean: @Configuration public class AnnotatedGalleryBeanFactory implements GalleryBeanFactory @Bean @Scope(BeanDefinition.SCOPE_PROTOTYPE) protected PictureBean createPictureBean(Picture picture) { PictureBean bean = new PictureBean(); bean.setPicture(picture); return bean; } } My Question: How can I pass parameters here? The code above results into org.springframework.beans.factory.NoSuchBeanDefinitionException: No qualifying bean of type [...model.Picture] found for dependency.
tagged with: spring
type: Question
type: AnsweredQuestion
tagged with: configuration
tagged with: java
has title: Spring FactoryBean method with arguments
has comment: http://stackoverflow.com/comment/34622857
score: 5
answer count: 1
downvote count: 0

http://stackoverflow.com/comment/34583491
score: 0
has text: i tried to run the program by doing n=10 and x=3 the answer should be 18 but i get 17 @C.B
comment on: http://stackoverflow.com/a/22697609
type: AnswerComment
type: Comment

http://stackoverflow.com/comment/34602321
type: QuestionComment
has text: Check this http://stackoverflow.com/questions/15273449/what-does-system-in-read-actually-return
comment on: http://stackoverflow.com/q/22708071
score: 0
type: Comment

http://stackoverflow.com/comment/34633246
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/22723313
score: 0
has text: Hi Jeffrey. The output I'm getting is posted here on PasteBin http://pastebin.com/mbN7TRjA

http://stackoverflow.com/q/22801376
type: Question
has comment: http://stackoverflow.com/comment/34770069
score: 0
has comment: http://stackoverflow.com/comment/34777736
answer count: 1
has title: setOnClickListener(new View.OnClickListener() creates java.lang.NullPointerException
has comment: http://stackoverflow.com/comment/34774862
favorite count: 0
type: UnansweredQuestion
tagged with: android
has comment: http://stackoverflow.com/comment/34770172
has comment: http://stackoverflow.com/comment/34770167
has comment: http://stackoverflow.com/comment/34770126
has answer: http://stackoverflow.com/a/22801469
has comment: http://stackoverflow.com/comment/34770085
has body: I'm following a online tutorial but I can't work out what I'm doing wrong. I'm trying to create a clickable 'sign up' text. Here is my code protected TextView mSignUpTextView; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_login); mSignUpTextView = (TextView)findViewById(R.id.signUpText); mSignUpTextView.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { Intent intent = new Intent(LoginActivity.this, SignUpActivity.class); startActivity(intent); } }); and here is the logcat error 04-02 11:55:11.683: E/AndroidRuntime(31564): FATAL EXCEPTION: main 04-02 11:55:11.683: E/AndroidRuntime(31564): java.lang.RuntimeException: Unable to start activity ComponentInfo{com.pbg.swapzy/com.pbg.swapzy.LoginActivity}: java.lang.NullPointerException 04-02 11:55:11.683: E/AndroidRuntime(31564): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2097) 04-02 11:55:11.683: E/AndroidRuntime(31564): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2122) 04-02 11:55:11.683: E/AndroidRuntime(31564): at android.app.ActivityThread.access$600(ActivityThread.java:140) 04-02 11:55:11.683: E/AndroidRuntime(31564): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1228) 04-02 11:55:11.683: E/AndroidRuntime(31564): at android.os.Handler.dispatchMessage(Handler.java:99) 04-02 11:55:11.683: E/AndroidRuntime(31564): at android.os.Looper.loop(Looper.java:137) 04-02 11:55:11.683: E/AndroidRuntime(31564): at android.app.ActivityThread.main (ActivityThread.java:4895) 04-02 11:55:11.683: E/AndroidRuntime(31564): at java.lang.reflect.Method.invokeNative(Native Method) 04-02 11:55:11.683: E/AndroidRuntime(31564): at java.lang.reflect.Method.invoke(Method.java:511) 04-02 11:55:11.683: E/AndroidRuntime(31564): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:994) 04-02 11:55:11.683: E/AndroidRuntime(31564)…
tagged with: java
upvote count: 1
tagged with: eclipse
downvote count: 1

http://stackoverflow.com/comment/34630842
comment on: http://stackoverflow.com/q/22723631
score: 1
type: Comment
type: QuestionComment
has text: the question title would be a good title for a rock song by the way

http://stackoverflow.com/a/22735074
type: Answer
accepted answer of: http://stackoverflow.com/q/22735038
upvote count: 2
answers question: http://stackoverflow.com/q/22735038
score: 2
type: AcceptedAnswer
downvote count: 0
has body: The correct delimiter for separating the parameters in the JDBC conncetion string is &amp;, not %. Your connection string should look like this: con = (Connection) DriverManager.getConnection ("jdbc:mysql://localhost:3306/myslconn?user=root&amp;password=123456");

http://stackoverflow.com/a/22662809
has comment: http://stackoverflow.com/comment/34526366
has body: You need to loop through all the files in that folder and save the files one by one. I guess this is what you are doing now. You can't copy the folder entirely. or you can use commons-io FileUtils
has comment: http://stackoverflow.com/comment/34526243
answers question: http://stackoverflow.com/q/22662586
score: 0
has comment: http://stackoverflow.com/comment/34522050
type: Answer
has comment: http://stackoverflow.com/comment/34535264